php

PHP or Python?

How to go about to get started learning php. Which one is best to learn php programming or python. I just want to know which one of these is leading. ...

mysql: can't set max_allowed_package to anything grater than 16MB

I'm not sure if this is the right place to post these kind of questions, if it's not so, please (politely) let me know... :-) I need to save files greater than 16MB on a mysql database from a php site... I've already changed the c:\xampp\mysql\bin\my.cnf and set max_allowed_packet to 16 MB, and everything worked fine then I set it to...

Programming Language Choice - Longevity and Community

I work for a start up that is currently researching what programming language they will adopt. The following criteria have been identified by management. The language will be used to develop web based applications. Having a system that allows for easy generation of business reports would be a bonus (iReport, Crystal Reports) Longevity...

How to embed YouTube videos in PHP ?

Can anyone give me an idea, how can we show or embed a YouTube video if we just have the URL or the Embed code. Thanks for the help ...

Split a number by decimal point in php

How do I split a number by the decimal point in php? I've got $num = 15/4; which turns $num into 3.75. I would like to split out the 3 and the 75 parts, so $int = 3 and $dec = 75. My non-working code is: $num = 15/4; // or $num = 3.75; list($int, $dec) = split('.', $num); but that results in empty $int and $dec. Thanks in advance. ...

Mail body parsing - open source mail client (PHP or ASP.NET)

Hi all. I have one interesting problem. I must parse mail body (regular expression), get some data from mail body, put this data to mail subject and forward this mail to another address. This must be done immediately when mail is received. Is any free WEBMAIL client that allow writing custom filter, or I must make application for thi...

Write location data in Drupal

I have some code that creates a new node in Drupal, but I want to write some data to a Location field. How do I go about this? Is it possible to use the $node object? ...

Mix two strings into one longer string PHP

I have two strings and I would like to mix the characters from each string into one bigger string, how can I do this in PHP? I can swap chars over but I want something more complicated since it could be guessed. And please don't say md5() is enough and irreversible. :) $string1 = '9cb5jplgvsiedji9mi9o6a8qq1';//session_id() $string2 = '...

Zend Framework problem with URL mapping.

I'm trying to map an action to the base URL and default controller. Swear this should be straight forward or even an 'out the box' feature but how do you map actions in your default controller to the base url using the Zend Framework? I'm fairly new to the Framework so I'm hoping I'm just missing something obvious. Trying to map: doma...

Where do you put validation logic when using Zend Framework?

I'm seeking some examples of how people implement validation logic in the Zend Framework. My ideal implementation would keep the validation outside the controller and allow validating "Confirm password" fields and file uploads. ...

Configuring IIS7 for PHP on multiple sites

I have PHP5.2.8 installed on IIS7, and it works fine for my default site (at C:\Inetpub\wwwroot). Now, I need to run local copies of my company's sites on my machine, and each of those are directores in wwwroot. I have set each up on a separate port so I can just go to http://localhost:[portnum] to get to each. If I try accessing a fi...

Are these PHP conditionals the same or does one have an advantage

Is there any advantage to writing a PHP conditional like this: if ($variable != NULL) { versus if (!empty($variable)) { versus if ($variable) { Aren't they all same thing? It seems like the last is always the simplest if you are just trying to tell whether the variable exists or not. Thanks for helping me understand the differen...

Weak typing in PHP: why use isset at all?

It seems like my code works to check for null if I do if ($tx) or if (isset($tx)) why would I do the second one when it's harder to write? ...

Actively maintained PHP libraries for user authentication?

I'm aware of the risks of rolling your own user authentication scripts, but I'm also wary of using packages that don't seem to be actively maintained: the current version of PEAR LiveUser is almost a year old. Please recommend (and argue the case for) an actively-maintained user-authentication library which can be integrated into an exi...

Php on IIS6

I'm getting 401.1 errors when trying to run a .php file on windows 2003/IIS6 I've been all over the web, given Everyone Full perms on the folder containing the file as well as the file... Nothing. What am I missing? ...

php shell_exec() through cygwin

I wrote a script that compiles LaTeX code through pdftex. The trouble is that pdftex only runs on linux. I am accomplishing this task with the use of shell_exec(). I don’t really have the ability to set up a linux box as a web server. I have my client computer, but it is behind a firewall that I do not control. I do have control of my ...

Apply Diff in PHP

I'm working with the Text_Diff PEAR package to diff to short text documents, where the Text_Diff object is created with a space-delimited list of the words in each document. I was hoping to store the diff in a database, and then apply it when the file is loaded again. Is there an easy way to apply this diff, or do I need to write a fun...

Avoid Race Conditions in PHP on Submit: Please do not click submit more than once!

A while back, online apps used to say, "do not click submit more than once." That's gone now, right? How do you guard against that in, say, PHP? One solution I'm using involves putting a variable in the Session, so you cannot submit to a page more than once every 10 seconds. That way the database work will have completed so the normal c...

Sorting an array of an array of objects in PHP by key value

Basically I have a setup like the following: Array ( [0] => Array ( [0] => stdClass Object ( [nid] => 1 [title] => title1 [uid] => 1 [parent] => 0 [weight] => -15 [name] => name1 [value] => 0 ) [1] => stdClass Object ( [nid] => 2 [title] => title2 [uid] => 1 [parent] => 0 [weight] => -7 [name] => name2 [value] => 100 ) ...

How do I fix a fatal error: cannot redeclare class that's only on Macintosh?

I get this fatal error only when I run on a Macintosh, but not on a windows browser, which doesn't make sense since, other than checking for the Browser condition, the conditional loops run the same code: Can someone help me understand how to stop this error in php? The error occurs on the FIRST instance of QEnterKeyEvent...and NOT the ...