php

I'm confused about something in the Zend Framework.

How do you decide if something goes in the view or the controller? Here are some specific examples: Zend_Captcha: Does the controller generate the captcha and pass it to the view or does the view generate it? Zend_Alc: Does the view decide if a segment of the view should be displayed to the user or do you have multiple views dependin...

Log to file via PHP or log to MySQL database - which is quicker?

I have a database driven website serving about 50,000 pages. I want to track each webpage/record hit. I will do this by creating logs, and then batch processing the logs once a day. I am not concerned with how I will do the batch process, only with the quickest way to log. How would you log, which do you think is quicker: a) Use PHP t...

What are the best tutorials about caching with PHP?

What are the best resources or tutorials for caching in PHP 5? I'm looking for something that I could possibly build on my own. Zend Cache, APC, and similar utilities are also options, but I really want to steer away from full-fledged templating systems like Smarty, etc. ...

How do I get the key values from $_POST?

echo $_POST["name"]; //returns the value a user typed into the "name" field I would like to be able to also return the text of the key. In this example, I want to return the text "name". Can I do this? ...

Rewrite all queries to not need the .php extension using a mod_rewrite RewriteRule.

I'd like all queries like http://mysite.com/something/otherthing?foo=bar&x=y to be rewritten as http://mysite.com/something/otherthing.php?foo=bar&x=y In other words, just make the .php extension optional, universally. ...

How to let PHP to create subdomain automatically for each user?

Hi, How do I create subdomain like http://user.mywebsite.com ? Do i have to access htaccess somehow? Is it actually simply possible to create it via pure php code or I need to use some external script-server side language? To those who answered: Well, then, should i ask my hosting if they provide some sort of DNS access?? ...

Why are my PHP sessions dying? And why can't I restore them?

I have an app using PHP and the PayPal API. The basic way it works to get a payment is that you do a web service call to PayPal to get a token and then do a browser redirect to PayPal with that token for the user to pay. After the payment details have been confirmed, PayPal redirects back to the URL you originally set in the service call...

Eclipse PDT and .yml file, cannot open?

I am using Symphony framework and I have the default sandbox inside the Eclipse IDE. When I double click schema.yml instead of open in Eclipse it requests Windows to select a program to choose. I am a Visual Studio guy and I do not understand why it doesn't open in Eclipse, what should I do? ...

XDebug and PHP Debugging

How do you setup a multi-developer XDebug PHP environment. I have a linux machine with Apache and Xdebug loaded and a php.ini file that I think is correct. I found a python proxy script that I'm using to proxy the calls from the PDT Eclipse IDE's my developers are using to the Apache/Xdebug running on the same web server. I set the ideke...

What is the best free PHP framework working on shared hosting and why?

I tried symfony only. It was a little tricky (also because there is no command line or ssh connection in my hosting plan) to rearrange directory and linking in order to work on my hosting service, I did the same tricks on the local version to make the deployment easy but sometimes (don't know if is a cache problem or what) there were dif...

enter multiple variables into table, assigning to each appropriate record

I display data into an html table, w/ a drop down box with a list of venues. Each volunteer will be assigned a venue. I envision being able to go down thru the html table and assigning each volunteer a venue. The drop down box contains all the possible venues that they can be assigned to. <select> <option value="1">Setup</option> <optio...

Compare Strings given in $_POST with php

I have a form that is sending in sizes of things, and I need to see what the strings are equal to so that I can set the price accordingly. When i try to do this, it says that they are not equal, and i get no prices. This is the code i'm using: if ($_POST['sizes'] == "Small ($30)"){$total = "30";} if ($_POST['sizes'] == "Medium ($40)"){$...

Custom Filters/Validators in Zend Framework

I have a Zend Framework application structure as below: /application /library /Zend /Core /Filter /MyFilter.php /Validator /MyValidator.php I would like to put custom filters and validators in their respective folders and have them loaded automatically when used. However, I cannot figure...

How do I determine my controllers in MVC?

Hello, I'm fairly new to MVC coming from a php background where I designed by view and created pages when I needed something like say a login form. I'd have a file called login. This only sucked when I needed a new login form to login a different type of user. Say an admin. I'd then have to create a new page called login-admin.php o...

PHP 5.x syncronized file access (no database)

Hi, I'm mostly familiar with Java, C and C++ in which there are ways to control that only one thread is accessing a resource at any given time. Now I'm in search for something similar but in PHP 5.x. To formulate my problem with one example: I have an ASCII-file which only stores a number, the value of a page load counter. At applicat...

Is there a way to determine whether an e-mail reaches its destination?

I have a PHP script that sends out critical e-mails that needs to reach its destination. I know how to check whether the e-mail sent successfully, the only issue is knowing whether it actually got to its recipient. Any suggestions? If there is no way of knowing, how would you handle this situation? ...

How do I tell if someone's faking a filetype? (PHP)

I'm programming something that allows users to store documents and pictures on a webserver, to be stored and retrieved later. When users upload files to my server, PHP tells me what filetype it is based on the extension. However, I'm afraid that users could rename a zip file as somezipfile.png and store it, thus keeping a zip file on m...

Uninitialized string offset error from PHP import script

I have an import-from-excel script as part of a CMS that previously ran without issue. My shared-hosting provider has recently upgraded their infrastructure, including PHP from 5.1 to 5.2.6, and the script now returns "Uninitialized string offset: -XXX in /path/scriptname.php on line 27" (XXX being a decreasing number from 512 and /path...

Simple PHP ORM

I'm looking for an ORM (Object-Relational Mapper) for PHP. I want something simple that I can get started with quickly. I'm used to ActiveRecord in Rails, but I don't need a full framework. My partner knows PHP, but is not really a programmer, and learning a framework would take more time than the project. Thanks, Craig ...

Prevent direct access to a PHP page.

How do I prevent my users from accessing directly pages meant for ajax calls only? Passing a key during ajax call seems like a solution, whereas access without the key will not be processed. But it is also easy to fabricate the key, no? Curse of View Source... p/s: Using Apache as webserver. EDIT: To answer why, I have jQuery ui-tabs ...