php

Personalised bulk email programmatically without timing out

I have a list of around 5,000 to 10,000 (individual user supplied) email addresses from people all over the world, each associated with their username and language codes. I also have a single message translated into the different languages of the users that I want to email. Now, I would like to send a single plain text email to each of t...

Migrating from POST forms to CSS

I've been tasked to migrate a web application to a more 'modern feeling' AJAX web 2.0 deal. The application as is currently uses PHP to pull data from the database, present the user with forms, and then update the database based on those form submissions. Frames are used to have a persistent main navigation menu, and a content area where...

PHP fopen fails in response

I am having a problem doing a get on googles search url from php. Here's the code I have: <?php $handle = fopen("http://www.google.com/complete/search?hl=en&amp;js=true&amp;qu=" . $_GET["qu"], "r"); while (!feof($handle)) { $text = fgets($handle); echo $text; } fclose($handle); ?> Here's the error I get...

In a Zend_Form, how to avoid Zend_Validate_Email from generating multiple errors?

I am building a ZendFramework application which as a login form asking for an email address and password - it seemed to make sense to validate the email address before hitting the database with the login attempt, as an invalid email would never lead to a valid hit. Zend_Validate_EmailAddress seemed like the right way to go, but I am havi...

How to print out an associative array item?

I would like to know how you can echo the ip-address of the user such that you can use it in your login cookie. My code <?php echo "$_SERVER['REMOTE_ADDR']"; ?> I run it and I get in Firefox Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /var/www/file7.ph...

Fire off nusoap from php, don't wait for results

I have a script that currently has a step where I trigger a voice broadcast after a customer signs up. It's a nusoap call to callfire. The latency there is rather high, and it's added about 2 seconds to my sub-second sign up process. As a result, I have people hitting the sign up button more than once. Is there a way to tell the app ...

Real Time Online Voting Without Leaving Page?

Possible Duplicate: Stack Overflow / reddit voting system in php How do voting systems, like the one here at SO, work? I would like to implement a voting system on my web page (coded in php), but dont want to have to force the user to post a form to vote and update the database. I would like it so when a user clicks a thumbs up,...

What is the standard of coding in PHP in the sense seperating css, phpfles and database

Give me the best standard way of coding in PHP. where to store my css, php, images etc. How to seperate my folders, How many folders and whats the name of that folder? ...

DB function reports no errors when adding new article in Joomla!

Possible Duplicate: 500 - An error has occurred! DB function reports no errors when adding new article in Joomla! I have an article that I want to publish on my Joomla! site. Every time I click apply or save. I get error 500 - An error has occurred! DB function reports no errors. I have no idea why this error comes up, al I can ...

how can I create a file with file_put_contents that has group write permissions?

I am using file_put_contents to create a file. My php process is running in a group with permissions to write to the directory. When file_put_contents is called, however, the resulting file does not have group write permissions (it creates just fine the first time). This means that if I try to overwrite the file it fails because of a lac...

Why does Zend_Date only take timezones into account when parsing?

I'm working with Zend 1.8. I've set the default timezone to Europe/Helsinki, and I'm parsing a string that looks like this: 2009-08-06 with a statement like this: new Zend_Date($dateStr, 'YYYY-MM-dd'); It produces a date like this: object(Zend_Date)#53 (8) { ["_locale:private"]=> string(5) "en_US" ["_fractional:private"]=> ...

Asynchronous HTTP requests in PHP

Is there any sane way to make a HTTP request asynchronously in PHP without throwing out the response? I.e., something similar to AJAX - the PHP script initiates the request, does it's own thing and later, when the response is received, a callback function/method or another script handles the response. One approach has crossed my mind - ...

while loop to update dates in DB only updates first row?

I have no idea why this won't work. function query($sql) { $this->result = @mysql_query($sql, $this->conn); return($this->result != false); } function convert() { $this->db->open(); $sql_update = ""; $this->db->query("SELECT * FROM ACCOUNTS "); $str = ''; while ($row = $this->db->fetchassoc()...

Reference a method of container object in PHP?

Given the following in PHP: <?php class foo { public $bar; function __construct() { "Foo Exists!"; } function magic_bullet($id) { switch($id) { case 1: echo "There is no spoon! "; case 2: echo "Or is there... "; break; } } } class bar { function __construct() { echo "Bar exists"; ...

PHP - Convert File system path to URL

I often find that I have files in my projects that need to be accessed from the file system as well as the users browser. One example is uploading photos. I need access to the files on the file system so that I can use GD to alter the images or move them around. But my users also need to be able to access the files from a URL like "site....

Linux file craziness - strange behaviour getting last line of log file (with video)

I am trying to get the last line of a file. The file, ff.log, is getting new data every second while ffmpeg is working. The log file looks like this: frame= 20 fps= 0 q=7.7 size= 40kB time=1.24 bitrate= 266.1kbits/s frame= 30 fps= 28 q=6.6 size= 51kB time=1.90 bitrate= 218.4kbits/s frame= 40 fps= 24 q=6.6 size= ...

Scaling a Container div with the contained divs height.

I am trying to get a div that resides in a container div to scale the container divs height when the div inside the container gets taller. When the height of the div inside the container gets taller than the container itself it just moves past the bottom of the container. I want the container to scale with the contained div. How do I ...

Generating Strong Unique User ID's w/PHP & MySQL

Ahoy Stack Overflow! This be mai first post... I'm attempting to identify users with a salted unique public key. Algorithm - Should I use uniqid(), sha256, sha512, something else? All hashes will be salted. NIST recommended SHA256, but I like recommendations from geeks/scientists like me. Generation - Does hash(SALT + AUTO_INCREME...

Sql Server 2008 and PHP - sqlsvr_escape_string?

I'm using php and sql server 2008 and the SQL Server Driver for PHP 1.0 does not have a similar escape string like mysql_real_escape_string. Do I just need to replace single quotations with something like function sqlsvr_escape_string($string) { $pattern = "'"; $replace = "''"; return(stripslashes(eregi_replace($pattern,$replace,...

MySQL data modeling: Multiple user types / Activity / Following

I have a project in which there is a site with multiple user types. And I am having trouble wrapping my head around the best practice for this. I want to be able to get activity from (nodes) you follow regardless of node type. Pretend the node types are: User: Organization: An organization will be an entity that can act as a user. ...