php

ISAPI_Rewrite: Zend PHP Framework project setup

How do I go about getting the isapi_rewrite working on IIS 6.0? My shared hosting account supports ISAPI_Rewrite - I've run the provided tests to confirm. I'm only able to access the index page of my Zend PHP project, but get the 404 error for other actions in my index controller class definition. I've basically placed the code: [ISA...

Locating memory leak in Apache httpd process, PHP/Doctrine-based application

I have a PHP application using these components: Apache 2.2.3-31 on Centos 5.4 PHP 5.2.10 Xdebug 2.0.5 with Remote Debugging enabled APC 3.0.19 Doctrine ORM for PHP 1.2.1 using Query Caching and Results Caching via APC MySQL 5.0.77 using Query Caching I've noticed that when I start up Apache, I eventually end up 10 child processes. ...

Historical security flaws of popular PHP CMS's?

I'm creating a PHP CMS, one that I hope will be used by the public. Security is a major concern and I'd like to learn from some of the popular PHP CMS's like Wordpress, Joomla, Drupal, etc. What are some security flaws or vulnerabilities that they have they had in the past that I can avoid in my application and what strategies can I use ...

Are multiline queries sql-injection safe?

This might be a stupid question. Or maybe my hacking skills are limited (I don't practice them at all). I have a query that looks like this: <?php $query =<<<eot SELECT table_x.field1, table_x.field2, table_y.*, table_z.field4 FROM ( SELECT ... ...

url.rewrite-once with Kohana and with urls

currently I have this setup in our simple-hosts.conf: url.rewrite-once = ( ".*.(js|ico|gif|jpg|png|css|php|htm)(?.*)?$" => "$0", "/slapi" => "/slapi/index.php" ) Works great, except the above fails when I have a dot in the query string: ?url=http://google.com My regexpy is not 1337 ...

Symfony: there is a "0" (zero) in a sfWidgetFormChoice

Hi, i want to show a select which options are the character '-' and a range of integers. I have this: $years = range(14,130); new sfWidgetFormChoice(array('choices' => array_merge(array('' => '-',array_combine($years,$years))); The problem: between the '-' and the range of integers there is a "0" (bold and italic). Any he...

Quick way to do data lookup in PHP

I have a data table with 600,000 records that is around 25 megabytes large. It is indexed by a 4 byte key. Is there a way to find a row in such dataset quickly with PHP without resorting to MySQL? The website in question is mostly static with minor PHP code and no database dependencies and therefore fast. I would like to add this data...

Checking for empty variable in PHPTAL condition

In PHPTAL tal:condition can check is variable empty? Something like that: < tag tal:condition="var" >Some text< /tag > but the value of variable is like that: <?php $variable = ''; $Tpl->var = $variable; ?> And it's a problem 'cause PHPTAL that value '' interpreting like not empty value and condition return true. Next problem is u...

How to remove the first & last slash from a url if it's exists?

Hi I use parse_url() to get the path of a url but i want to remove the first slash & the last if it's exists. Example: "/posts/funny-dog/" -> "posts/funny-dog" "/" -> "" // Because http://www.google.com/ path is a slash "/categories/politic" -> "categories/politics" Thanks ...

Auto attach file in php mail

I am wanting to send a pdf file in php mail. I know the name and location of the file (an invoice printed in cup-pdf) and would like to sent this automatically in php when i click a button in my website. How can this be done? Thanks ...

Sending variables in URLs in PHP with echo

Hi all, I can't really find good guidelines through google searches of the proper way to escape variables in URLs. Basically I am printing out a bunch of results from a mysql query in a table and I want one of the entries in each row to be a link to that result's page. I think this is easy, that I'm just missing a apostrophe or backslas...

money_format() options

I am looking at the money_format function in php and confused on how to get it to format the way I want. I do not want USD in front of my string, I want a comma every 3 digits and 2 decimal points so 12345.67 will be formated to $12,345.67 Thanks. ...

PHP: Prevent a function from returning value?

Hi everybody, How could I make sure that the startProcess(); function is being called, but without halting the execution for myFunction(). I'll guess that there's a way to call a function and prevent it from returning it's value to thereby accomplishing this? Pseudo-code: function myFunction() { startProcess(); return $someth...

PHP curl timing mismatch

I am running a php script that: queries a local database to retrieve an amount executes a curl statement to update an external database with the above amount + x queries the local database again to insert a new row reflecting that the curl statement has been executed. One of the problems that I am having is that the curl statement ta...

What is the Mac download site for the PLUG-IN version of Eclipse PHP Development Tools (PDT)?

What is the Mac download site for the PLUG-IN version of Eclipse PHP Development Tools (PDT)? I have Adobe CS5 Flash Builder on Eclipse and would like to use the Galileo php as a plug-in. Thank you! ...

Get the WPMU default blog domain

I have a network of blogs that link to each other. The problem is when I want to get the primary blog's domain. I need it for things like the the target of the logo when clicked. I can't seem to find a function in WPMU the retrieves this. I can see the value I want in the wp_site table. I could easily get it with $wpdb, but its a bit ov...

date / time convert to time since php

Hello in my database date / time are in this format 2010-06-01T18:20:25+0000 I'd like to echo that out to time passed since that date / time e.g. 4 days 3 hours 36 minutes and 4 seconds is this possible? ...

In PHP how do I take a base64 encoded png and output that png as an image?

I tried header('Content-Type: image/png'); echo base64_decode($data);` But it doesn't work. ...

accessing parent class inherited variable in subclass in PHP

I have made a class in php which is goind to be inherited by another class in the other folder. when i put echo $this->protectedvariableofclass; //in subclass function it gives no value remember my base class is stored \class\user.php sublass is stored as \model\model_user.php Please help me out Thanks in advance Base Class in \class\...

How to change quicksort to output elements in descending order?

Hi, I wrote a quicksort algorithm however, I would like to make a change somewhere so that this quicksort would output elements in descending order. I searched and found that I can change the comparison operator (<) in partition() to other way around (like below). //This is snippet from partition() function while($array[...