php5

How to convert a String to a unique INTEGER in php

how can i convert a string(i.e. email address) to unique integers, to use them as an ID. ...

phpunit runs test twice - gets two answers. Why?

This is my phpunit test file <?php // DemoTest - test to prove the point function __autoload($className) { // pick file up from current directory $f = $className.'.php'; require_once $f; } class DemoTest extends PHPUnit_Framework_TestCase { // call same test twice - det different results function test01() { ...

Allow users to download files outside webroot

Hello I am using PHP to allow users to upload files and I have them sitting in a folder outside webroot (/var/www) folder for security reasons. It is in the folder /var/uploads. A user uploads files for specific records. Once the the uploaded files are moved to the uploads folder, the address of the attachment is stored in the database. ...

"Can't use function return value in write context" error in PHP

Fatal error: Can't use function return value in write context in line 3, In which cases such errors get triggered? My program: //QUERY VARIABLE $query="select * form user where user_name='$user_name' and user_password='sha($user_password)'"; //ESTABLISHING CONNECTION $result=mysqli_query($dbc,$query)or die('Error Query...

Store Open/Close Times and DST Changes

I've been stuck on this for two days and have gotten no where. I tend to think future and the future problems that will come around. My server's time is set to UTC and linux box is fully updated with the timezones as well as the data is in my database. I'll explain my system for the best answer. This site sells "items" but can only s...

Creating Thumbnails with GridFS + MongoDB + PHP

I'm creating a site where a client who will be selling his photography which he sells a lot of it and will probably get quite a bit of traffic. Probably around 2k-5k uniques a day. I'm using MongoDB with PHP and I read i should use GridFS to store these large files. Upwards of 2MB-5MB photos, but obviously BW will be extremely spendy (im...

How to find the time is fall between two times?

I am having two times in database. Starting Time 07:00 and Ending Time 07:25 and If your chooses the starting time from my application 07:10 and End time is 07:35 I need to inform the time is not available for booking. How can I check this 07:10 and 07:35 fall between 07:00 and 07:25 using PHP?Thanks in advance? Update: They May Give ...

How Do I Create a JSON Feed from a MongoDB Collection

I'm creating a CMS for my client to work with his photographs and to sell them on his site. For the CMS end as well as the front end, which both will be all AJAX, it'd be nice to get a JSON feed setup so that I can just use the same feed to generate new "pages" and "views" with JS. So this example feed would have like {[name:'A Photo',d...

how to initalize my ldap connection like a doctrine connection in the bootstrap.php file in zend-framework

i want to use my ldap server as a DB. then i will create persistence classes in the models directory that will extend to Zend_Ldap so that i won't have to write all the CRUD operations but how can i initialize the ldap connection in the bootstrap.php file for e.g. a database connection using doctrine can be initialized like this, i want ...

Exceptions/errors handling library for PHP

Is there any PHP library for handling exceptions/errors(including fatal) in PHP? It should be very configurable, support log to file, send Emails, and have integration with different browsers console. ...

PHP remote procedure calling

I have two servers on PHP that need to communicate, calling remote methods of each other. XML-RPC for PHP is not very good solution because it's very slow, and I can't call multiple methods in one request. ...

Creating a new attribute does not update product flat data

Hi there, I'm writing an import module to import configurable products into magento, which works quite fine. I've tweaked the import so that it can create all necessary attribute sets, attributes and attribute options needed for creating the configurable products. So far everything works ... quite everything. When the import creates a n...

when all fields are empty, echo and exit - by newbie

Please tell me what needs to be done, to avoid the message: Parse error: syntax error, unexpected $end in /xxxx/xxxxxxx/public_html/contact- it/feedback.php on line xxx (the last line of feedback.php = ?>) Thanks to all for any hint. if(empty($data_start)) { if(empty($data_end)) { if(empty($comment)) { # all...

While redirecting to secure server(ssl) in case data is huge , session is lost

In my application I need to use ssl. While redirecting from http//mydomain.com to https//mydomain.com session data is lost in case data is huge. I have tried removing https to http, but still no use. My server is on a linux machine. Please help me out. ...

Multi-thread/parallel requests in PHP

How can I make multi-thread (parallel) GET requests in PHP? I know that there is a CURL multi-thread support, but there is no limit of active requests number and actual callbacks configuration for every success request completion. ...

PHP - Why class declared constants needs to be retrived staticly ?

class foo { const bar; } and to access it we have to do: self:bar; and not, $this->bar; Is this correct? If so, why? Thanks a lot, MEM ...

Unable to download files- PHP

This is the code I am using. As suggested I have added the headers for content type and disposition. <?php header('Content-Disposition: attachment'); header('Content-Type: application/octet-stream'); $con = mysql_connect("localhost","root","admin"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("acl_...

question in html_checkboxes loop index in smarty template

hello ,, i want know how to get the index of html_checkboxes loop index with smarty for each checkbox ?? http://www.smarty.net/manual/en/language.function.html.checkboxes.php ...

MySQL error with SQL AS

Hi there, I'm receiving the following error with this page while trying to retrieve information from my database; You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM catalog_product_entity cpe inner join catalog_product_entity_varchar c...

Need to rebuild memcache module with same build number as php

I'm running OSX 10.6 with php 5.2.13 and memcache 2.2.6. Build numbers as shown below. How do I get them to match though? Here's the error I get when php tries to load the memcache module: $ php -m PHP Warning: PHP Startup: memcache: Unable to initialize module Module compiled with module API=20090626, debug=0, thread-safe...