php

php curl leave file in directory - How to clean up

I've got a php script that uses curl and everything is fine. It runs via a cron job. I come back later and each time it runs a new file with the output has been saved. How do I prevent these files from being created? ...

MySQL "Not IN" query suddenly stopped returning results

I'm doing some work for a site on a shared hosting environment that has a history of flipping settings on us. This week, an update script suddenly stopped working, and the underlying reason is that a NOT IN clause that used to return results is no longer doing so. The query, in its essence, is this: SELECT * FROM db1.entry where entr...

How can I structure a table so that the field remains atomic?

I have a shopping cart in which I have to keep track of stock, and this includes stock with attributes. For example: shirt -- blue, small = 50 -- blue, medium = 22 -- blue, large = 53 -- red, small = 15 etc... These fields are currently separated by commas in the database and the IDs would be as follows: 1,3 1,4 1,5 2,3 wh...

How do I attach a stream filter to echo?

Is there a way to attach a stream filter to echo so that any data that is echoed goes through the stream filter? My idea is to write an output escaping filter to protect against XSS. I found this bug report http://bugs.php.net/bug.php?id=30583 but it is from 2004 and I didn't know if this is now possible or not. class strtoupper_filter...

How to calculate percentile rank for point totals over different time spans?

On a PHP & CodeIgniter-based web site, users can earn reputation for various actions, not unlike Stack Overflow. Every time reputation is awarded, a new entry is created in a MySQL table with the user_id, action being rewarded, and value of that bunch of points (e.g. 10 reputation). At the same time, a field in a users table, reputation_...

phpeclipse: jump to function definition?

from zend's IDE i know that Ctrl+left click on a function name opens the corresponding source file and jumps to the functions definition is there anything similar in eclipse especially phpeclipse OR CDT? im not sure if its just a window->preferences setting i dont see OR some kind of source code indexing i may have disabled which also d...

Performance difference of caching PHP Objects on file

Is there difference between caching PHP objects on disk rather than not? If cached, objects would only be created once for ALL the site visitors, and if not, they will be created once for every visitor. Is there a performance difference for this or would I be wasting time doing this? Thank you :) ...

If I call a flash function at the same time as a href link will flash function always be executed?

Hi all, I have the following code in page1.php : <a href="page2.php" onClick="javascript:callFlash();">Go to page</a> This calls a function in a Flash movie on page1.php and opens page2.php. My question is this: Can I be sure that the flash function will always be called and finish executing before page2.php is called? (The flash f...

PHP MVC Framework for the enterprise.

I'm about to begin building a huge clinical healthcare application with PHP, and I'm looking for some advice on a framework. I need to be able to come up with a quick prototype, so it's important that the framework takes care of many mundane tasks; therefore, I've narrowed it down to CakePHP or Symfony. I'm hoping to get a few developer...

Problem With Pear DB In Many Hostings !

Hi , I Connent and Query My Db Using PEAR DB Like This : if(stristr($_SERVER['HTTP_HOST'] , 'localhost')){ $dsn = 'mysql://root:@localhost/xxx' ; }else{ $dsn = 'mysql://xxx:xxx@localhost/xxx' ; } $dbc =& DB::connect($dsn); $dbc->query("set names utf8" ); if (PEAR::isError($dbc , array('debug'=>3))) { die($dbc->getMessage()); } i...

PHPMotion - Do I need ffmpeg etc if I just upload in .flv?

My shared host won't let me install ffmpeg and some similar libraries, will it work if I just upload in flv? ...

sending information back and forth with AJAX

With $.post, you can send information to the server, but what when you need to receive information from the server? How does information change from being of a way that can be held by a php variable to being of a way that can be held by a javascript variable and vice-versa? ...

Retrieving the index of an inserted row

I'm trying to keep the database tables for a project I'm working on nice and normalized, but I've run into a problem. I'm trying to figure out how I can insert a row into a table and then find out what the value of the auto_incremented id column was set to so that I can insert additional data into another table. I know there are function...

How does one easily add posix support to PHP using yum?

I am running CentOS 5.2 and using yum to manage packages. I have had little luck installing php-posix but know with almost 100% certitude that it is a real and available package...somewhere. Has anyone had luck installing it? FWIW, I am using the following: sudo yum install -y php-posix Update: I've realized that this may be an issue ...

PHP Session Expire Redirect

Possible Duplicate: Automatically re-direct a user when session Times out or goes idle I have a Log In system and the session expires, but they need to refresh the page to be shown the login in screen again. Instead, my users enter data and hit submit to find out that they have been logged out. Is there any way to make the page...

Temporary permission to view photos and albums

I'm making a gallery website. Photos and albums should be hidden from the public by default, but the owner can share a public URL if he wants. I also want to use short URLs for this. I'm trying to figure out the best way to do this. At first I thought I could have a MySQL table with the short URL code (something like Zneg8rjK), and the...

Encrypt in JSP, Decrypt in PHP

Hi, I'm trying to implement a single-sign-on link from application written in JAVA, to another web app written in PHP. I'd like a way to encrypt the username in .JSP and then decrypt in PHP. I need to find functions matching functions that will allow this. ...

Create a new CSV file with template data in php

I am attempting to write a php script, that will take an existing csv file, and open it for edit using the values of that file. <?PHP $file_handle = fopen("test.csv", "r"); while (!feof($file_handle) ) { $line_of_text = fgetcsv($file_handle, 100000); echo "<textarea name=textarea id=textarea cols=40 rows=4>$line_of_text[0]</textarea>"; ...

Simple RegEx PHP

I have a string and I need to see if it contains the following "_archived". I was using the following: preg_match('(.*)_archived$',$string); but get: Warning: preg_match() [function.preg-match]: Unknown modifier '_' in /home/storrec/classes/class.main.php on line 70 I am new to Regular Expressions so this is probably very easy. O...

PHP RegExp certain chars

What would be a good way to get rid of all chars except, letters, numbers, double quotes and hyphens. This is what I got so far. $test = preg_replace('#[^a-zA-Z0-9"-]#',' ',$string); Any suggestions? Thanks ...