php

Is there a way to execute PHP as an older version than the one installed?

I need to support some legacy code on a server where I need to be on the latest stable PHP version at all times. I can't possibly update the code base every time I upgrade so I'm wondering if there is a way to run this specific site with an older version of PHP than the one installed. Example: I'm running PHP 5.3.3 and my code for an ol...

CakePHP, Email Model and Email Component. I've done somthing stupid.

Hi. I've been silly. I have a model called Emails, which I have build alot of functionality for, however now I have come to actually send emails in the emails controller and have hit a wall. The email component clashes with the model, they are both referenced with $this->Email. My question is how can I rename the component (going bac...

How to create a sitemap using PHP & MySQL.

I was wondering how can I create a sitemap using PHP & MySQL and is there any sitemap design examples you know of? ...

Parsing XML response in PHP (and/or Zend Framework)

I am using the Zend Framework and using Zend_Http_Client to make a POST request to a third party API. $client = new Zend_Http_Client('http://api.com'); $client->setParameterPost(array( 'param1' => 'value' )); $response = $client->request('POST'); echo $response->getBody(); This API returns an XML document as its response. <?xml...

Are multiple sql querys a significant performance hit?

I am using MySql (and PHP). It's best if I give an example: I am making a query, say SELECT * FROM a_table WHERE type='visible' then returning the count. Then later I query again but WHERE type='hidden', etc. I may query again to get the full contents. All queries are unique, but are from the same table. I also query multiple other tabl...

PHP array_merge problem

Hello $a = array('matches' => array( '5' => array('weight' => 6), '15' => array('weight' => 6), ) ); $b = array('matches' => array( '25' => array('weight' => 6), '35' => array('weight' => 6), ) ); $merge = array_merge($a, $b); print_...

Advice on google/twitter search from iphone using php/json

<?php header('Content-type: application/json'); $json = file_get_contents("http://twitter.com/status/user_timeline/lindsaylohan.json?count=1"); $temp = json_decode($json); $array = Array(); $array[] = $temp; echo json_encode($array); ?> I have a JSON parser in my iphone app. I'm using the above PHP code to try and search Twitter. Can a...

Open Source PHP Encoder?

After looking into both IonCube and Zend Guard I realized that I can not afford these products right now. So my question is are there any widely excepted stable open source PHP Encoders? Either google has failed me, they don't exist, or I'm searching for the wrong things. ...

Mysql default timezone

My server is in US, and I'm in istanbul. Problem is I want to ask mysql about current time. Is there a function to adjust it's time accourding to mine? select * from xyz where dateTimeField<now(); dateTimeField will available after 10 hours that it shoud be! ...

New Client needs help securing his website after getting hacked.. and I found this...

Soo, what is this? I haven't really experienced too much as far as "hacking" goes. I've dealt and solved most problems with PHP applications and I understand about 70% of this code. but here is what I found, a Web Shell.. by Boff? http://pastebin.com/kZeGHAHC ...

PHP Json_Encode strange characters?

I am using JSON_ENCODE in PHP to output data. When it gets to this word: Æther it outputs \u00c6ther. Anyone know of a way to make json output that character or am I going to have to change the text to not have that character in it? ...

Dirt-simple PHP templates, continued

Background So, last time I inquired about PHP templates, I got a lot of responses like: it isn't needed; PHP is a good enough templating language on its own. it's hard to develop a templating language that is both powerful and easy for designers to work with (or around). it's already been done, use templating framework X. you're st...

PHP preg_replace to turn **xyz** to <b>xyz</b>

I decided to, for fun, make something similar to markdown. With my small experiences with Regular Expressions in the past, I know how extremely powerful they are, so they will be what I need. So, if I have this string: Hello **bold** world How can I use preg_replace to convert that to: Hello <b>bold</b> world I assume some...

Simple query not working

The simple query below is not returning any results. I can't see any errors in it. Any idea why it's not working? $sqlStr3 = "SELECT loginid, username, created FROM login ORDER BY created DESC LIMIT 200"; $result = mysql_query($sqlStr3); $count...

PHP :: I am trying to print an 8x8 grid

I am trying to print an 8x8 grid on php can anyone check this code is I am doing something wrong $row = 0; $col = 0; print "<form>"; while ($row <= 8){ print "<tr>"; $row++; while ($col <= 8){ print "<td>"; print "<input type="checkbox" name="battle" value="ships">"; print "</td>"; $col++; ...

performing mysql transactions with master and slave setup?

how do you deal with transactions when you have master and slave db setup? typically i do all the reads from slaves and writes from master but when performing transactions, it seems i need to do reads from master (the one which is performing the transactions) and so i can't have all my transactions all in one place ... im also using ze...

tcp message incomplete

hi, I'm using html5 websockets, dev.w3.org/html5/websockets/, and php socket functions, php.net/manual/en/ref.sockets.php. My problem is that messages sent from the client using websockets to the server are being truncated to a maximum of 1449 bytes. When I set net.ipv4.tcp_timestamps to 0, a couple extra bytes are received. I am using ...

Process mathematical equations in php

A user is allowed to enter any mathematical equation they like (with one variable): x + 5 1 - x/2 (x/3) * (56/13) These are stored as strings in the database. When they are retrieved I need to substitute 'x' for a number and check the value of the equation. How could I do this? I was considering writing a parser to deconstruct the...

Free/cheap Whois Api

Is there a free API where I can pull whois data and server location data? (similar to who.is) ...

How to hack an image height standard with jQuery?

I need a jQuery function to measure the height of an image, and add margin to the IMG element, so it will always result with a regular number that divides by 17 (which is my line-height). Any help would be appreciated. Thanks. UPDATE: I changed the title of the question and replaced PHP with jQuery. Coming to think about it, I need the...