php

XSPF Web Music Player and restarting music in surfing

I asked a question in this link; Streaming music background function music(){ $txt = '<object type="application/x-shockwave-flash" data="http://***.com/slim.swf?&amp;autoplay=true&amp;repeat=true&amp;shuffle=true&amp;song_url=http: //***.com/music.mp3&" width="200" height="20"> <param name="movie" value="http://***.com/sl...

PHP callback function not being called

Hi everyone, I've got the following code: function failureCallback($host, $port) { print "memcache '$host:$port' failed"; } $this->memcache = new Memcache; ## bool Memcache::addServer ( string $host [, int $port = 11211 [, bool $persistent [, int $weight [, int $timeout [, int $retry_interval [, bool $status [, ca...

MySQL Locks: order of unblocked threads

I have a MySQL ISAM table being accessed my multiple php instances. Right now I'm using a WRITE lock to serialize access to this table. My question is how do I ensure that the PHP instances get served on a First-Come-First-Serve basis? Or is this the default behaviour? The official MySQL documentation doesn't mention anything about the...

Is There a More Efficient Way to Write Nested While Loops?

The code below shows nested while loops, but it's not the very efficient. Suppose I wanted to extend the code to include 100 nested while loops. Is there a better way to accomplish this task? <?php $count = 1; $num = 1; $options=3; while ( $num <=$options ) { echo "(".$num . ") "; $num1 = 1; $options1=3; whil...

Sending and treating text by get method

Guys, could you help me with treating text sent with GET method. How to detect and treat line foldings in text? The text is sent from textarea through AJAX using GET method. How to detect line foldings in text when it is sent in GET method? And I want to replace all line foldings with special character for example like "|" before sendin...

Help with MySQL date operation

Hello i have two columns: duration (int) and dateCol (date) in a table. How should i proceed if i want to know when CURDATE() - dateCol will iqual to duration. ie: CURDATE() - dateCol (2010-05-08) = duration (14 days), and then send an e-amil? ...

PHP Link to session_destroy

Hello, I need to make a link that when clicked will run this in php: session_destroy(); I know how to make a link in html, but I don't know how to make it interact with php. Thanks for any help. ...

PHP date function not accepting timezone change

Hello, I've set up a quick little test to understand and debug timezones between mySQL and PHP. Here's the page: http://dev.feedingo.com/test_dates.php The dates are being created in mySQL using NOW() in a datetime field. The initial problem I was trying to figure out is what timezone mySQL is using and how to sync it up with PHP. B...

How can i encrypt a function or its contents in a php class?

How can i encrypt a function or its contents in a php class ? e.g. Take a look at below class, i would like to encrypt the function test1() so the code inside will never be revealed but executes as normal class test { var $x; var $y; function test1() { return $this->x; } function test2() { return $this->y; } } Than...

What does the PHP configuration option "--prefix=PREFIX" do?

I have heard that setting the --prefix=PREFIX option when compiling PHP on linux will allow you to have more than one install of PHP at a time without them clashing. (I think the default if this isn't set is /usr/local). However, I'm not sure what exactly it does or what a good setting to use is. Furthermore, I've also heard that setting...

regexp to find image path file in an image tag

Hi I'm looking for a regexp that find all images path in an image tag (src) and transform all images path by cid:filename <img src="../images/text.jpg" alt="test" /> to <img src="cid:test" alt="test" /> Thanks for your help Chris ...

Modifying MySQL Where Statement Based on Array

Using an array like this: $data = array ( 'host' => 1, 'country' => 'fr', ) I would like to create a MySQL query that uses the values of the array to form its WHERE clause like: SELECT * FROM table WHERE host = 1 and country = 'fr' How can I generate this query string to use with MySQL? ...

Continue Drupal processing after page send.

I need to do some additional processing after a Drupal page has been sent. I know I could fire a background shell command, but I need the current Drupal execution context to be maintained. I've spent a lot of time looking, but I can't find any documentation in this regard. This is surprising because it must surely be a common requireme...

Multiple items in a PHP shopping cart

I'm in the progress of making a shopping cart in PHP. To check if a user has selected multiple products, I put everything in an array ($contents). When I output it, I get something like "14,14,14,11,10". I'd like to have something like "3 x 14, 1 x 11, 1 x 10". What is the easiest way to do that? I really have no clue how to do it. This...

Doctrine (on Ubuntu): What command generate models from database without delete existing models?(I add new tables soo i want update models)

Hi, Doctrine (on Ubuntu): What command generate models from database without delete existing models?(I add new tables soo i want update models) Thanks ...

MySQL locking problem

I have a simple setup of a set of writers and a set of readers working with a MySQL ISAM table. The writers are only inserting rows while the readers are only checking for new rows. OK, so I know that I don't need a lock in this situation, since I'm not modifying existing rows. However my Writers are accessing one more table that does n...

Complicated MySQL query?

I have two tables as follows: I have a RatingsTable that contains a ratingname and a bit whether it is a positive or negative rating: RatingsTable ---------------------- ratingname ispositive ---------------------- Good 1 Bad 0 Fun 1 Boring 0 And I have a FeedbackTable that contains feedback on things: t...

how to make PHP lists all Linux Users?

Hello I want to build a php based site that (automate) some commands on my Ubuntu Server first thing I did was going to the file (sudoers) and add the user www-data so I can execute php commands with root privileges! # running the web apps with root power!!! www-data ALL=(ALL) NOPASSWD: ALL then my PHP code was <?php $command...

Should conditional expressions go inside or outside of classes?

It seems that often I will want to execute some methods from a Class when I call it and choosing which function will depend on some condition. This leads me to write classes like in Case 1 because it allows me to rapidly include their functionality. The alternative would be Case 2 which can take a lot of time if there is a lot of code an...

Merging two arrays in PHP

Hi everyone, I am trying to create a new array from two current arrays. Tried array_merge, but it will not give me what I want. $array1 is a list of keys that I pass to a function. $array2 holds the results from that function, but doesn't contain any non-available resuls for keys. So, I want to make sure that all requested keys comes ou...