php

Step Debugger for PHP other than Zend Debugger

I just wanted to see if anyone is aware of any other debuggers capable of stepping through code. I am aware of xdebug and use it as well as Zend Debugger and other debugging scripts (i've written my own widgets for this already). However I am looking for a good replacement for step debugging - I've searched and searched but have yet to...

looping array problem

I have a simplified ajay script, from which I have removed all nonrelevant code. The problem I am having is first with my columns array and the subsequent foreach loop. I want to go through each element and change the corresponding element to YES if true and NO if false, I don't see why it isn't working. If there are any problems such a...

Simple PHP form Validation and the validation symbols

Hi have some forms that I want to use some basic php validation (regular expressions) on, how do you go about doing it? I have just general text input, usernames, passwords and date to validate. I would also like to know how to check for empty input boxes. I have looked on the interenet for this stuff but I haven't found any good tutoria...

Facebook-WordPress comment/feedback integration

Currently I have my Facebook profile automatically republish blog posts from a WordPress instance. What I would like to be able to do, however, is to also have comments posted to either the blog of Facebook show up on the other in the appropriate location. Is there a way to do this with the Facebook API? ...

PHP File Validation using If statements uploads.

Hi I am quite new to php but i have been following some tutorials but they don't seem to work so I have tried to adapt them. I have tested this code and it works to a point but theres something else I can't get my head around, the php file is not uploading (fine) but the details are still being writen to the datbase although the $ok is...

Dynamic Include

What would be the safest way to include pages with $_GET without puttingt allowed pages in an array/use switch etc. I have many pages so no thank you. $content = addslashes($_GET['content']); if (file_exists(PAGE_PATH."$content.html")) { include(PAGE_PATH."$content.html"); } How safe is that? Thanks. ...

How to turn off magic quotes on shared hosting?

I want to turn off php's magic quotes. I don't have access to php.ini. When I tried to add php_flag magic_quotes_gpc off to my .htaccess file, i get a 500 internal server error. This is what my .htaccess file looks liks: AddType x-mapp-php5 .php php_flag magic_quotes_gpc off Then I tried to use ini_set('magic_quotes_gpc', 'O'), but...

Coding of parameter-value for SELECT in PHP-MySQL

alt A below is a statement from a php-mysql tutorial. It works as it should. I found the id-value rather obfuscated and tested alt B. This also worked! What is the point with the id-value of alt A? MySQL 5.0.51, PHP 5.2.6 // alt A : $sql="SELECT * FROM exempel WHERE id = '".$q."'"; // alt B : $sql="SELECT * FROM exempel W...

How can I make a wufoo like web app

I want to mimic wufoo form builder web app, I used jquery to drag and drop elements on a workspace, but I need a way to let the user save his finished work , and download his work as html page, can any one help!!! ...

What is the problem with this ajax(with prototype)?

Hello i have the next code: php side: <?php print_r($_POST); print_r($_GET); die(); ?> In javascript: voteAjax = function(typez, actionz, idz){ new Ajax.Request( 'http://localhost/reporeade/Vote/Ajax/?rand='+Math.random()*500000, {asynchronous:true, evalScripts:true, method:'post', par...

PHP RecursiveIteratorIterator and nested sets

Hi, I have a set of objects in a hierachy. There's a top "root" node and that has child nodes, which in turn have child nodes etc. I'm trying to save this structure into a DB using the nested set model, where each "side" of each node is numbered to define the hierarchy, as in: http://dev.mysql.com/tech-resources/articles/hierarchical...

How might I integrate phpunit with Hudson CI?

Hello! We are looking at switching from phpundercontrol to Hudson (it looks to have some really cool features!) but I can't figure out how to get phpunit logs to show up. I have phpunit running fine in Hudson with ant, and --log-xml is putting a phpunit.xml in the appropriate builds/ folder for that build. But I can't figure out how to ...

List active forum threads

$sql = mysql_query("SELECT * FROM posts WHERE post_content = 'thread' ORDER BY post_date DESC LIMIT 65"); while($row = mysql_fetch_array($sql)){ echo "$row['post_contentID']"; } I'm want to list forum threads that there has recently been posts posted in. The "problem" is that it lists the same thread more than once. If I have posted...

Best way to handle storing/displaying dates in different timezones in PHP?

I've been reading up on this topic for the past few hours, and I think I've got a handle on it, but I'd like some confirmation. Situation I want a user in, say, California to be able to post a comment that will be stored in MySQL. I then want a user in, say, Texas to be able to view the comment with the post date adjusted to his or her...

Anything wrong with running PHP and Ruby on the same Apache server?

We are trying to figure out the best way to distribute our applications among our available servers, which are few in number. Assuming adequate RAM and CPU power, is there any reason we shouldn't run mod_php and mod_rails (Passenger) within the same Apache server? Would they clash or conflict somehow? ...

what is the correct way to send post data with cURL in PHP?

when using cURL in php to send data in a POST, you use set the cURL option CURLOPT_POSTFIELDS to the data here's some example data array('foo'=>'bar','ninja'=>'pirate') now here's where i'm confused. half of the example code i've seen do some preprocessing on the array, and encode and smush the data into a properly formatted url strin...

Dynamically display a CSV file as an HTML table on a web page.

I'd like to take a CSV file living server-side and display it dynamically as an html table. E.g., this: Name, Age, Sex "Cantor, Georg", 163, M should become this: <html><body><table> <tr> <td>Name</td> <td>Age</td> <td>Sex</td> </tr> <tr> <td>Cantor, Georg</td> <td>163</td> <td>M</td> </td> </table></body></html> Solutions in any l...

Is user logged in variable with PHP

Hi I've built a class called Login with a construct that either logs them in or it doesn't... I also have a static function called isAuthenticated which is meant to check if the user is logged in or not... I've been messing around with static functions etc but can't seem to get what I want. Ideally, it'd be where I can easily go <?php...

Code Refactor Class Pattern

I am currently trying to refactor my codebase for an app I am making, I have an existing setup but it is not even close to being flexible and everything is dependent on everything else (aggregated to each class for example). So, after reading PHP Design Patterns and countless articles on patterns and how they relate to scalable applicat...

php file manipulation functions fails on my localhost saying permission denied

im running on windows xp and i am an administrator, im using the latest xampp bundle available from their site and i receive these kinds of errors when i use file manipulation functions on php... Warning: chmod() [function.chmod]: Permission denied in... Warning: opendir(/feeds) [function.opendir]: failed to open dir: Permission denied ...