php

How to unserialize PHP Serialized array/variable/class and return sutable object in C#

The goal is to unserialize a PHP serialized string and get sutable object in C# Is there any way to make this possible in C#(.Net)? To be more specific: We need to make an application which comunicates (Via HTTP) to specific website which returns the needed information. Fortunately/unfortunately we dont have permission to website so th...

PHP/MySQL small-scale fuzzy search

I'm looking to implement fuzzy search for a small PHP/MySQL application. Specifically, I have a database with about 2400 records (records added at a rate of about 600 per year, so it's a small database). The three fields of interest are street address, last name and date. I want to be able to search by one of those fields, and essentiall...

Form POST into Curl

I have a form created with 2 fields and a submit button. But i want to do the same thing using Curl. i tried it by using following code: $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_POST,true); curl_setopt($ch,CURLOPT_POSTFIELDS,$fields); $result = curl_exec($ch); curl_close($ch); $fields included t...

Encrypting Querystring and Decrypting it in PHP

I have the following Encryption Classs in php define(ENCRYPTION_KEY,"abcdegef"); define(INITIALIZATION_VECTOR,mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_DES, MCRYPT_MODE_ECB), MCRYPT_RAND)); function EncryptString($input) { $encrypted_string = mcrypt_encrypt(MCRYPT_DES, ENCRYPTION_KEY, $input, MCRYPT_MODE_CBC, INITIALIZATION_VECTOR...

Php showing 97% of CPU usage

Hi, I have a game site developed using flash and php. The php code contains 4000 lines and it will run as a cron. Inside the code, there is one while loop which will run infinitely for checking any data is written in the socket and call different functions accordingly and will send the results back to the sockets. From flash, it will g...

Zend_Navigation: how to apply active state to all actions of controller?

Let's say, that we have: $pages = array( array( 'controller' => 'controller1', 'label' => 'Label1', ), array ( 'controller' => 'controller2', 'label' => 'Label2' ), ); $container = new Zend_Navigation($pages); When user clicks Label1, controller1/index action is rendered and La...

invalid arguments foreach in php in commandline

Hi, I wrote a script in php which reads two files and takes all the strings from one file and searches them in other file. This is working fine in web browser. But when I try to run it through command line, it says 'invalid arguments supplied for foreach() at line....' am I missing anything? <?php $filename = 'search_items.txt'; $fp ...

how i can get this numbers format in he php

the normal number is 10000 i want it 1,000 how i can do it thanks ...

Huge performance decline when accessing object in associative PHP array

I'm seeing a huge performance decline in a (command line) PHP script, caused by a simple assignment (runtime increase from 0.8 ~ 0.9 seconds to 29.x seconds). The script first fetches a lot of data from a MySQL database and creates objects of different custom classes. After this fetching (php now uses around 500 MB of RAM) I loop an arr...

Complete integration of vbulletin, help desk, knowledge base, sales database, gallery, etc

Hi, I operate a PHP-based website in which there are several disjointed parts: a vBulletin forum, a help desk ticket system, a knowledge base, a large sales database (with license keys), and a gallery. In the future I plan on integrating all of these into a single customer backend, where they can for instance view their license key, sub...

PHP / CodeIgniter - Iterating through 9000+ DB rows generates a download of blank page

I'm trying this: function send_sms() { $liveQuery = $this->db->get('liveList'); $counter = 0; foreach($liveQuery->result() as $row): $counter = $counter+1; echo("Not hatin', just iteratin'. Message " . $counter); endforeach; } When liveList has 8000 records it runs just fine, but when I try with 9000 rows it generates a downl...

Include product category in Magento order emails.

Hi, I'd like the ability to list the category name alongside the product in the New Order transactional email like shown in the screenshot below. Any help would be appreciated. Thanks. ...

using array_map to test values?

Is it possible to use array_map() to test values of an array? I want to make sure that all elements of an array are numeric. I've tried both $arrays = array( array(0,1,2,3 ) , array ( 0,1, "a", 5 ) ); foreach ( $arrays as $arr ) { if ( array_map("is_numeric", $arr) === FALSE ) { echo "FALSE\n...

Code snippet manager suggestions

I'm looking for a code snippet manager per the following: Usable on Windows stand-alone product desktop-based (not online) Free or paid Has PHP syntax highlighting I've found the following, but they don't seem to quite ring the bell (although they are good products): -- Snip-It Pro (not free) -- Has syntax highlighting, but seems "n...

PHP: Correct regular expression for making every letter left of the first colon lowercase

$value='x-Cem-Date:Wed, 16 Dec 2009 15:42:28 GMT'; Right now I have: $value = preg_replace('/(^.+)(?=:)/e', "strtolower('\\1')", $value); this outputs $value='x-cem-date:wed, 16 dec 2009 15:42:28 GMT'; it should output: $value='x-cem-date:Wed, 16 Dec 2009 15:42:28 GMT'; ...

Uploading to S3 using Curl

Hi All, I'm currently using cURL to upload a file from my server to S3 using AJAX to call the script. So I have the following: $fullfilepath = '/server/sitepath/files/' . $_POST['file']; $upload_url = 'https://'.$_POST['buckets'].'.s3.amazonaws.com/'; $params = array( 'key'=>$_POST['key'], 'AWSAccessKeyId'=...

PHP preg_replace: help me grok (?=:)

In another question, there are the following lines: $value='x-Cem-Date:Wed, 16 Dec 2009 15:42:28 GMT'; $value = preg_replace('/(^.+?)(?=:)/e', "strtolower('\\1')", $value); // yields 'x-cem-date:Wed, 16 Dec 2009 15:42:28 GMT' That (?=:) bit indicates a search for the colon, it has to. But, I don't understand that particular syntax, w...

All-in-one PHP bundle for Ubuntu

I need to deploy Zend Framework app on Ubuntu. I've downloaded Ubuntu desktop, installed using apt-get apache+php+mysql, but PHP turned out to be not the latest 5.3, but 5.2.1 and even mysql extension is missing. I understand I can get somewhere a fresh php installation, get dependent libs (like curl or libxml2) compile them one by one...

Apache comes back with nothing

Hello - I'm running Apache 2.046 with PHP 5.x and I am experiencing very odd behavior on a CodeIgniter app. The frustrating thing is that it is not consistent. Occasionally when I call up my app Apache returns nothing. I mean nada. But then I hit refresh and everything works as expected. Sometimes I have to hit "refreash" several ...

Doctrine (in symfony project) can not connect through socket

Hi guys ! I am trying to put a symfony project on a client server for production. The website worked fine on our company's server, but now i have this error : 500 | Internal Server Error | Doctrine_Connection_Exception PDO Connection Error: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql...