php

How can I have a function perform after a set amount of time?

I'm creating a site where users can bid on items in a silent auction. I want to be able to somehow start a timer and then let users bid on the items. Once the timer reaches a certain number, I want to be able to remove the bid feature on the auction items. Does anyone know the best approach for me to do this and what functions or plugin...

using implode to combine multiple select

Hi, I have a php page like this : <html> <body> <form method="post" action="catch_combo.php"> <select name="selr[]" multiple> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select>...

regex to wrap img tag with href containg the src

[Edited - Sorry Bart] I've looked at other answers but struggling to match this. I want to wrap an image tag where the src is the second attribute (after title) with a specific anchor tag that contains a link to the image found in the src from the image tag. Example of img tag in string. This has been entered via tinymce wysiwyg and al...

What PHP editor should I use ?

What PHP editor should I use? I now have NetBeans 6.8 (the PHP version) but it´s always freezing for a long time. I previously used version 6.7.1, but the auto scan feature rendered the editor useless for too long, like 10 min on each restart. I used Eclipse as well but had the same experience as in Netbeans. Always freezing for a lon...

php regex form questions

Is it possible to just use this code alone to do two different regex matches? One reg-ex match for X digits and the other for a given string "CAT" only, or do I need to create two different forms, one for each: X digits and one for the string "CAT"? Furthermore is there a better php method for this or I am headed in the right directi...

How long the time funtion works in php

Is php date() and time() function works between the years 1901-2038. What function will I use for my long based projects. or I am wrong? ...

Detecting early failure in php fwrite

Earlier today I noticed some calls to php fwrite failing as the destination socket was in a mixed state. There were numerous connections stuck in SYN_SENT and were seemingly not coming back as failures. What is the best way to detect this and simply time out the connection if x bits haven't bit transmitted over the wire? ...

Set default values in Select option in Symfony?

I am using the widget sfWidgetFormChoice(array ( 'choices' => CountryPeer::getAllCountry(), )) and validator as sfValidatorChoice(array ( 'choices' => array_keys(CountryPeer::getAllCountry()), )) I get a select element as <select id="country" name="reg_form[country]"> <option value="1">India</option> <option value="2">S...

APN Error in Server Script (php)

Hi All, I am getting this error in my php script , while sending payload data. Warning: stream_socket_client() [function.stream-socket-client]: Unable to set private key file `/Applications/XAMPP/xamppfiles/htdocs/test/apn/apns-dev.pem' in /Applications/XAMPP/xamppfiles/htdocs/test/apn/push.php on line 42 Warning: stream_socket_client...

How to sort XML feed using PHP

Hi, I am new this parsing xml feeds; so I have a piece of code that I have been working on that extracts the data from the xml file. Now I want be able to sort the array by the publish date pubdate. I have not found any examples that can anyone help me. I used sort() which puts it in some random order. $xml_headline_key = "*ARRAY*CATC...

how can access data from a webserver using a windows application.

Hi, I would like to create a touch screen application.It will be a windows application, so using that how can i get data from a web server? ...

How do I dynamically change a controller in Zend Framework?

I'm halfway through a CMS where the URL is an SEO friendly name based on a page title. There is a need for one section to use a specific controller. So for example: test.com/page1 (uses index controller) test.com/page2 (uses index controller) test.com/page3 (uses different controller) test.com/page4 (uses index controller) I could add ...

How do I find the difference between a datetime type and the current date/time in php?

I have a DATETIME for an entry in my database that is upcoming. I want to know the difference in time between the the DATETIME and the current date/time in Days, Hours, Minutes, and Seconds. I thought I might be able to use the date function to do this, but perhaps I am wrong. This was my approach: $now = mktime(0, 0, 0, date("m"), dat...

Zend Framework - layout best practices for 'includes'

I'm pretty new to Zend.. I'm just wondering how to model my site's layout/structure. My site will have an user profile section, admin section, and the generic the default view of the site. For the admin and profile, I'll have custom elements in the headers and footers, otherwise I want to default to a generic header/footer. I want the...

PHP: Is there a function that converts a date string in a human readable format?

Hi I want to convert a date string like "19.11.2009 14:00" into the age of it now like "for 2 minutes" or "for 1 week" or "for 2 days" Is there some code around? ...

Detecting the browser language of choice with PHP

Hello guys, I'm trying to implement this code to have different files to load for german, spanish or english browser languages of choice. The case is that with my spanish IE I still get the english file. <?php if (is_home()) { if (preg_match('/de-DE/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'])) { include(TEMPLATEPATH . '/german-navbar.p...

Php: Check if a variable is an object

Every time I get a variable through $_GET I want to verify that it is indeed an object of the User class. So: if (isUser($_GET['valid_user'])) { ... } is there a built in function to use instead of this so called "isUser"? Thanks a lot! ...

unable to connect to database on AWS

hi all actually I have my website build with Joomla hosted on hostmonster but all Joomla website need a database support to run this database is on AWS configuration files need to be updated for that I have to change host address I put the IP (of AWS host) in host but it displayed "unable to connect to database MySQL" can u help me ...

Weird PHP segfault

I discovered a way to make php segfault, and I'm a bit curious about what's happening. Maybe someone can explain this for me? joern@xps:..com/trunk5/tools/nestedset> cat > while.php <?php while(1){ die('dd'); } ?> ^C 0 joern@xps:..com/trunk5/tools/nestedset> php -f while.php ddzsh: segmentation fault php -f while.php 0 joern...

passing arrays as url parameter

hi, what is the best way that i can pass an array as a url parameter? i was thinking if this is possible: $aValues = array(); $url = 'http://www.example.com?aParam='.$aValues; or how about this: $url = 'http://www.example.com?aParam[]='.$aValues; Ive read examples, but i find it messy: $url = 'http://www.example.com?aParam[]=va...