php

Zend Framework - Set 'selected' value in select box dropdown list

I am adding a select element to a Zend_Form instance as follows: $user = $form->createElement('select','user')->setLabel('User: ')->setRequired(true); foreach($users as $u) { if($selected == $u->id) { $user->addMultiOption($u->id,$u->firstname.' '.$u->lastname); //*** some way of setting a selected opt...

php timestamp problem

Hello, i have a "simple" problem with the PHP timestamp (on a linux machine). I need to get the user birthdate in year-month-date (using 3 menus - html select). When the user is born on 1970-1-1 the timestamp is zero and the application logic gets everything wrong. How would you deal with this case? Regards, ...

php webservices and datatypes

Hi all, here's a problem I just stumbled into: I have an php based web service which returns statistical data about customers in the form of WSDL-complex types. The actual complex type consists of xsd:string xsd:int xsd:float Now, since my web service is sort of an adapter to an existing system I can't realy controll what values are...

is this ok? salting

Hey i would like do have your input on this I use this to generate unique salts to each of my users when they register (random letters and numbers). how big is the chance that salts will colide? uniqid(mt_rand()); I then use md5 to hash salt, password and email(in that order) together as password and rehash when they log-in. md5($sa...

cakephp habtm relationship (saving data)

Question related to HABTM has been posted in some good numbers on stackoverflow but I am still looking for a solution to my problem. I am creating an application that allows for creation of topics based on a particular subcategory. While adding a topic the user is asked for tags (on the same form). Now when the user has finished adding ...

Finding the minimum value's key in an associative array

Hi, In PHP, say that you have an associative array like this: $pets = array( "cats" => 1, "dogs" => 2, "fish" => 3 ); How would I find the key with the lowest value? Here, I'd be looking for cats. Is there some built in PHP function that I've missed which does this? It would also be great if there was a solution that acc...

php vs python. scalability

Why is PHP considered more scalable than python? I've heard may times that one of the reasons PHP is "better" than python is that PHP is more easily scalable, and that Yahoo proves that(assumig Yahoo still uses PHP). Whats the difference between PHP and Python when it comes to scalability? -- edit -- well, i have no evidence, the que...

I have the XCache jumpy Hits situation, don't know how to solve it

http://xcache.lighttpd.net/wiki/Faq#Iseejumpyhitsinadminpage (see section 1.10) The Xcache jumpy situation happens when different php instances don't share memory. I simply don't know how to solve it. I'm on dreamhost PS server. using the Xcache default installation. See server info below. I tried the following without success: Remov...

C# and utf8_decode

Is there a C# utf8_decode equivalent? ...

mysql adjusting datetime values in the dbase, not in search returns

This must be a ridiculously stupid question, because after numerous searches of the StackOverflow question archives (and elsewhere) I can't find an answer. I recently posted a question about managing date & time data here: http://stackoverflow.com/questions/1587116/mysql-date-storage-query-performance-with-php Following Mike B's advic...

get current date with PHP help

Hi.. Is there any script to check the current date in PHP? I want to use this function to display a date from mysql db, and if the date from the db is the same as todays date, then display "TODAY" instead... Thanks... ...

Is there a concise way to test GET parameter combinations in PHP?

The code below checks for GET params. There are two selects on the page which filter a list by type and age group. I'm looking for a way to refactor the conditional which test the type/age combinations. Is there a more clear/concise way to write it? if ( isset($_REQUEST['type']) || isset($_REQUEST['age']) ) { // we need to do somethi...

Keep shell open with PHP to allow multiple calls?

Hi, How can I allow the shell session to stay open until I close it with PHP? In my example I want to use NcFtp to publish some files through shell command. I want to leave PHP's built in FTP because it is much much slower and performance is an issue. It is easy to use ncftpput to publish a file or a directory. But if I want to loop t...

a little more help in this simple script about date() function in PHP

Hi. why wont this work? this is in a while loop: $postdate = date( "j F", strtotime( $row['insert_date'] ) ); if ($postdate == date("j F")) {$postdate = "today"}; $table .= bla bla bla "$postdate"; it gives an error on the 'if statement line' in my browser... $postdate is something like 14 october before the if statement! Thanks ...

Netbeans not copying source files to web folder

I'm using Netbeans to develop an HTML/PHP site and I have the Run Configuration set as follows: Project URL: http://localhost/JEB Project Folder: C:\Documents and Settings\John\My Documents\NetBeansProjects\JEB Source Folder: C:\Documents and Settings\John\My Documents\NetBeansProjects\JEB Web Root: The "Copy files from Sources Folder...

How to check if date() function minus one?

Hi. Is it possible to check if the date ("j-1 F-1")??? I'm a noob so some script would help! Postdate is in a format like: 14 October. if ($postdate == date("j F")) {$postdate = "today";} THIS WORKS... But I need to check the $postdate for the "yesterday" value as well! Q: How to check for yesterday? that is, date()-1 somehow. Tha...

How to close a pop-up window using PHP?

Is there a way to close a pop-up window using PHP like the javascript function window.close()? ...

php telnet no response from script

I'm running PHP5 on Windows XP Professional. I'm trying to write a telnet php script which simply connects, sends a text string and grabs the response buffer and outputs it. I'm using the telnet class file from here: http://cvs.adfinis.ch/cvs.php/phpStreamcast/telnet.class.php which i found in another thread. <?php error_reporti...

from camel case to underscore case conversion with php __autoload() function

Hey Guys, PHP manual suggests to autoload classes like function __autoload($class_name){ require_once("some_dir/".$class_name.".php"); } and this appoach works fine to load class FooClass saved in the file my_dir/FooClass.php like class FooClass{ //some implementation } here is my question: how can I make it possible to use _...

how to add image-border around an image?

Hi. Is there any simple way to add a image border around an image? Reason is I want to create a drop-shadow effect around the image. The images are loaded as thumbnails and are 110x75 px... Im thinking about creating a shadow border, but dont know how to add this to around the image, anybody know a way? PHP preferrably... ...