php

Is this MySQL query the best idea?

Hi guys. The project I'm working on has two type of accounts, "people" and "companies". I hold a single "users" table with all the accounts and just the basic info needed for login (email, pass, etc), and two other tables "user_profiles" (regular people) and "company_profiles" (companies) that hold more specific columns for each type, bo...

Zend_Form: how to check 2 fields are identical

I have created a form to add a user to a database and make user available for login. Now I have two password fields (the second is for validation of the first). How can I add a validator for this kind of validation to zend_form? This is my code for the two password fields: $password = new Zend_Form_Element_Password('password', array(...

Calling fcsh from PHP script

Hi, My question is whether or not Flex's fcsh can be called from within a PHP script. Here is the background: I have been created a simple process that creates a simple quiz/tutorial by converting a text file into a .mxml file and compiling to a .swf file using the mxmlc compiler. This works well from the command line, but I wanted t...

PHP: Cookie domain / subdomain control.

Hi All, I'm working on a site with multiple subdomains, some of which should get their own session. I think I've got it worked out, but have noticed something about cookie handling that I don't understand. I don't see anything in the docs that explains it, so thought I would see if anyone here has some light to shed on the question. ...

PHP - sort an array based on another array?

Is it possible in PHP to do something like this? How would you go about writing a function? Here is an example. The order is the most important thing. $customer['address'] = '123 fake st'; $customer['name'] = 'Tim'; $customer['dob'] = '12/08/1986'; $customer['dontSortMe'] = 'this value doesnt need to be sorted'; And I'd like to do som...

Code Coverage tools for PHP

Is there any code coverage tool available for PHP? I wish to check the code coverage of my code and API's written in PHP, but have not been able to lay my hands on any code coverage tool for PHP, as it is more of a server side language and dynamic in nature. Does anyone know of a method by which code coverage for PHP can be executed? ...

member control through admin account using php

I am new to php. I made a member registration on login page and adm too. So inside admin I wanted to get the list of the members and delete the members I dont want. So I took the a code from a sample code for phone book from http://localhost/xamp and editted it to my requirement I am able to retrieve the members but unable to delete the...

Plaintext/HTML Email doesn't work in mac mail client.

The code below is the code i am using. It works fine in thunderbird but not in mac mail client (and i assume anything made by microsoft. I currently do not have access to this to test it in). Much as i am aware of the idiosyncrasies of the various mail clients, I am flummoxed by this! It's fairly self explanatory but i am trying to send ...

How do I match a square bracket literal using RegEx?

What's the regex to match a square bracket? I'm using \] in a pattern in eregi_replace, but it doesn't seem to be able to find a ]... ...

Javascript AJAX function not loading

Hello, I had a realtivley simple ajax application, which I have broken up to be more modular. The code is at the link below, and what I have mainly done is add the GetRecordSet function and allowed fetchcompelte to take a variable for which layer to put data in. It should work fine in thery. When I put alert()s in, the code seems to exe...

Is there an equivalent to Trac written in PHP?

Is there an equivalent to Trac written in PHP? I need something that integrates with SVN and is free. It should allow me to browse the SVN source, have some kind of bug tracking and show recent changes in the SVN. A wiki isn't essential. Thanks in advance. ...

javascript function not working

i have the following javascript code: http://www.nomorepasting.com/getpaste.php?pasteid=22561 in which the function makewindows does not seem to be working. it does actuall create a window, however the html either contains what is quotes, or if I change it to child1.document.write(json_encode($row2["ARTICLE_DESC"])); creats a blank...

AJAX, PHP Sessions and simultaneous requests

I'll get straight to the point! My javascript sends about 20 AJAX requests to my PHP file to respond to (via an external web API) when the user submits their search. The results are stored in an array in the session array. I've read that browsers will only allow 2 simultaneous requests to a server. My first problem is that while there...

json_encode and mysql unicode problem

i have the following javascript code: http://www.nomorepasting.com/getpaste.php?pasteid=22561 Which works fine(the makewindows function has been changed to show it is a php variable), however the html contains unicode characters, and will only be assigned characters leading up to the first unicode character. If I make a small test file...

How do I programatically restart a system service(not apache) from apache in linux?

I need to simple way to allow an end user to restart tomcat from a web page served from apache on the same box. We're trying to make it easy for our QC department to deploy a new version of our webapp to apache. We're using samba, but we need an easy way for them to stop / start the tomcat server before/after the deployment. This would...

Is the LAMP stack appropriate for Enterprise use?

Is the LAMP (Linux, Apache, MySQL, PHP / Ruby / Python) stack appropriate for Enterprise use? To be clear, by "Enterprise", I mean a large or very large company, where security, robustness, availability of skill sets, Total Cost of Ownership (TCO), scalability, and availability of tools are key considerations. Said another way, a compa...

What does this Regular Expression do

$pee = preg_replace( '|<p>|', "$1<p>", $pee ); This regular expression is from the Wordpress source code (formatting.php, wpautop function); I'm not sure what it does, can anyone help? Actually I'm trying to port this function to Python...if anyone knows of an existing port already, that would be much better as I'm really bad with reg...

PHP Frameworks - Are they solely personal preference?

I'm new to the world of PHP frameworks and, after some initial investigation, came up with the following list of popular choices: CakePHP CodeIgniter Symfony Zend I'm trying not to repeat the "Which is best?" question, which seems to elicit not much more than personal preference. Is this the case? Is one truly "better" than the other...

How do I check to see if a Smarty variable is already assigned?

How do I check to see if a particular value has already been assigned to Smarty and if not assign a (default) value? Answer: if ($this->cismarty->get_template_vars('test') === null) { $this->cismarty->assign('test', 'Default value'); } ...

Symphony VS CakePHP : which one is closest to PHP

I'm mostly a Rails developer but sometimes, I have to code in PHP. Because stackoverflow.com prefers questions that can be answered, I'd like to have a idea which one of the two is closest to PHP? Sometimes, I'm under the impression that CakePHP is a outdated copy of Rails that wants to look like Ruby but fails at it and thus leaving th...