php

PHP and SwfUpload

Hi, I'm trying to implement SwfUpload in my web page, and I'm using php to save files on server. As is the first time I use this component, I choose to run the algoritm is suggested from the SwfUpload team (http://swfupload.org/forum/generaldiscussion/214): I've put it in a file and I've said the control to use it as code file. It did...

PHP a href union

Hello. So i have this script: <?php $query = mysql_query(" SELECT meetup AS text, id AS theID, dato FROM member_meetups WHERE username = '$pusername' UNION SELECT navn AS text, id AS theID, dato FROM member_film WHERE username = '$pusername' UNION SELECT title AS text, id AS theID, dato FROM member_tutorials WHERE username = '$puserna...

Ebay API: How do I get "buy it now" items only?

There is much mentioned on ebay site. Maybe there's someone on SO who ever worked with ebay api. Could you please help me? ...

PHP: tmpfs vs memcached

Hello, I want to store information (sessions and a lot of strings) in RAM and I don't know if I should use a tmpfs or a memcached server. Someone did some benchmark and knows which one is faster? It's needed for some ajax scripts that requests informations every 1-5 seconds per user who is logged in, like a webchat in PHP. So PHP has to ...

Multi page redirect

I'm using CodeIgniter with codeigniter sessions that are stored in a MySQL database. I need to do a multi page redirect as shown below: some_form.php -> processing.php -> another_form_based_on_processing.php Everything's okay going from some_form.php -> processing.php But when I redirect the page from processing.php -> another_form_...

different databases for handling sessions...am I doing the right thing?

I'm looking for some advice on whether or not I should use a separate database to handle my sessions. We are writing a web app for multiple users to login and check/update their account specific information. We didn't want to use the file storage method on the webserver for storing session information, so we decided to use a database...

How to analyze HTML Page using PHP?

Hi I want to analyze HTML page by following example. I can put url page to textfield then press enter. I get some text from HTML page such as title, h1, div id="do" or so on. How I can do it by using PHP? Thanks! ...

Zend_Date and setting timezone on instation

I have a ZF app and am saving times as UTC in MySQL db. When I retrieve, them I'd like to tell Zend_Ddate that they are UTC rather than the timezone set in php.ini of 'America/Los Angeles'. Currently, I'm instantiating like this: $date=new Zend_Date($item['created_on_utc'],Zend_Date::ISO_8601,'en_US'); but feel like there should be a...

Limit counter value after first loop cycle

How can I write this in such a way that $counter value is 1 on its first iteration and 0 on each following cycle? $counter =1; foreach($result): $number = $result['value'] + $counter; db->update($result['value'] => $number); $counter--; endforeach; Essentially my goal is to get $number to be $number+1 on the first loop and the...

Determine browser language(s) in Zend Framework?

I am dissolving a rather big old library with various PHP helper functions that have amassed over time. I'm looking for Zend Framework based replacements for as many of these functions as possible. My first candidate is a function that returns the users's most preferred browser language from the huge list that can be http_accept_languag...

Should I use pure PHP/MySQL for developing web applications?

I have been dabbling in programming/scripting languages since I was a kid. I started off with HTML and CSS, then went on to PHP (which I got quite good at) and then to Python, Perl, and C(++). I've recently done a lot of work in PHP (along with MySQL). After spending so much time learning these languages, I now want to do something with...

help with regex pattern

could someone help me with the regex pattern that i could use to match the text "Cats" within the link element? <A HREF="http://www.catingale2?subject=10023"&gt;Cats&lt;/A&gt; forum Thanks in advance! ...

Is iteration necessary in the following piece of code?

Here's a piece of code from the xss_clean method of the Input_Core class of the Kohana framework: do { // Remove really unwanted tags $old_data = $data; $data = preg_replace('#</*(?:applet|b(?:ase|gsound|link)|embed|frame(?:set)?|i(?:frame|layer)|l(?:ayer|ink)|meta|object|s(?:cript|tyle)|title|xml)[^>]*+>#i', '', $data); } while ($ol...

PHP regex to match Windows product key

I am attempting (and failing) to write a PHP regex that will match a Windows product key in the form XXXXX-XXXXX-XXXXX-XXXXX-XXXXX (where X is an uppercase letter or a number). I have come up with the following, but it is not doing quite what I expect (provided it actually can do what I expect!). I consider myself pretty well versed in ...

Is it a good idea to use CodeIgniters Active Record library to manipulate MySQL databases or should I just use SQL?

I'm starting to get to grips with CodeIgniter and came across it's support for the Active Record pattern. I like the fact that it generates the SQL code for you so essentially you can retrieve, update and insert data in to a database without tying your application to a specific database engine. It makes simple queries very simple but ...

PHP Fatal error: Call to undefined method after uploading on the web

I have some pages, which work fine locally(using WAMP and error_reporting E_ALL in php.ini), but once I upload them, I get the following error: Fatal error: Call to undefined method DB::exists() The method is there, and I don't know why it can't be seen. Do you have an idea what went wrong? ...

Cookies disappear after I close the tab...

if(isset($_POST['remember'])) { if(!isset($_COOKIE['tracker_id'])) { setcookie('tracker_id', $_SESSION['id'], time()+2592000); setcookie('tracker_username', $_SESSION['username'], time()+2592000); setcookie('tracker_rsn', $_SESSION['rsn'], time()+2592000); } } I know the code works, because I check to se...

Apache is "Unable to initialize module" because of module's and PHP's API don't match

php -v gives this PHP Warning: PHP Startup: memcache: Unable to initialize module Module compiled with module API=20060613 PHP compiled with module API=20090626 These options need to match in Unknown on line 0 PHP Warning: PHP Startup: memcache: Unable to initialize module Module compiled with module API=20060613 PHP compiled wi...

Auto deployment of PHP applications

My team currently has a development web/database server and a live deployment web server and a live database server. We use SVN with the repository stored on the development server but the problem is our deployment process. Currently when we need to deploy an update to the live application we simply use SFTP to transfer from the reposi...

Pear Crypt/HMAC.php failed to open stream

Hello, I am on a MediaTemple Dedicated Virtual server and have enabled Pear using the instructions found at: http://kb.mediatemple.net/questions/514/Enabling+PEAR+by+setting+your+open_basedir+and+include_path Here's the problem... In my PHP script, I have this: require_once 'Crypt/HMAC.php'; When I execute the script, I get this me...