php

Is there a free, open-source live chat support application that uses PHP and jQuery?

Most of the applications that I'm finding, inncluding LiveHelp and PHP Live Chat! feature terrible, un-commented, non-cross-browser compatible Javascript. I'm looking for chat software that uses a Javascript framework to avoid some persistent and common bugs related to the DOM. ...

How do I reuse code in Zend Framework

I am working on a web application which requires the user to login before they see or do anything. No part of this app should be accessible without being logged in. (Except of course, the login controller) Currently I am using sessions to handle the authentication and I have put code in each controller in the init() function to check i...

Requesting NAME OF FORM by php

I want to retrieve NAME OF FORM from php when i am submitting a form. Can i find the NAME OF FORM by PHP? ...

About unit testing a function in the zend framework and unit testing in general

Hello people, I am diving into the world of unit testing. And i am sort of lost. I learned today that unit testing is testing if a function works. I wanted to test the following function: public function getEventById($id) { return $this->getResource('Event')->getEventById($id); } So i wanted to test this function as follows: p...

Facebook graph api photo upload to a fan page album

Hi guys, I have gotten the photo upload function to work with this code, <?php include_once 'facebook-php-sdk/src/facebook.php'; include_once 'config.php';//this file contains the secret key and app id etc... $facebook = new Facebook(array( 'appId' => FACEBOOK_APP_ID, 'secret' => FACEBOOK_SECRET_KEY, 'cookie' => true, ...

Questions regarding PHPUnit mock feature

Can someone provide me a reference to a good PHPUnit mock guide? The one in the official documentation doesn't seem to be detailed enough. I am trying to study PHPUnit by reading the source code, but I am not familiar with the term matcher, invocation mocker, stub return, etc. I need to know about the following: 1) How to expect multi...

How to import php with javascript?

I know JavaScript is client side and PHP is server-side. I also know this is an odd question. However, the CMS editor I'm using will not allow php to be stored to the database (it's the same editor used by Dupral). I can store JavaScript though. Can I import a php file with JavaScript. Or rather read the php file, store the content in a...

Requesting NAME OF FORM by php

Possible Duplicate: Requesting NAME OF FORM by php I have a form with no captcha and this is submitting by POST method.I am fearing for Spamming. User can spam my database by ajax. How will i protect it by Spammers.ANy idea.. thanks in advance. ...

How do I add a custom table to a form in another module in Drupal?

I am trying to make a module to add a table to a form in another module. I found I can add the new data in a module_form_alter hook but how to I get it to run through a theme hook? The module I am trying to modify has a theme hook for the page I want to modify. I don't want to change the original form I just want to add a table with n...

Fixtures in groups of timestamp

The following code brings up all the fixtures from the database. while ($row = mysql_fetch_assoc($result)) { echo $row['date']; echo $row['home_user']; echo $row['home_team']; echo $row['away_user']; echo $row['away_team']; } The problem I have is all the fixtures are just listed. T...

How do I prevent sql injection with php and mysql

I have a form into which the visitor can enter data, and I want to store this data in a mysql database via the $_POST variable. What do I need to prevent sql injection? ...

get value from MySQL database with PHP

$from = $_POST['from']; $to = $_POST['to']; $message = $_POST['message']; $query = "SELECT * FROM Users WHERE `user_name` = '$from' LIMIT 1"; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $fromID = $row['user_id']; } I'm trying to have $formID be the user_id for a user in my database. Eac...

While loop problems

I have put together the following code, the problem is that each while loop is only returning one set of data. $result = mysql_query("SELECT date FROM ".TBL_FIXTURES." WHERE compname = '$comp_name' GROUP BY date"); $i = 1; echo "<table cellspacing=\"10\" style='border: 1px dotted' width=\"300\" bgcolor=\"#eeeeee\">"; while ...

Need help debugging a huge chunk of JSON data...

I have a huge chunk, so large that I can't manually edit the file and need to read it in and do regex operations to see what's wrong. Basically - my server is PHP 5.1.6 and I can't update it. This features an older json_decode which is less featured than the 5.2/5.3 versions. json_decode returns NULL and json_last_error is being invoke...

PHP OpenID doesn't work with Google/Yahoo and 'hacks' fix it... are they safe?

I've been experimenting with OpenID, and have set up a sample web page to access using my OpenID account. I'm using the Php OpenID Library by Janrain and it wasn't working with my Google Account. A little research led me to this question, which suggests the problem is that Google uses https and... ... it's likely the setup for making...

get $_SERVER['HTTP_X_REQUESTED_WITH'] with iframe

I'm working with Colorbox and if I specify to use an iframe with it then the $_SERVER['HTTP_X_REQUESTED_WITH'] variable is no longer available to me. I need that in order to detect if ajax has loaded so then I can include a header/footer or not. Anyway to get this variable or is there another variable that I can get when I use iframe? ...

How to save massive numbers in php...

I want Pi to like 100,000,000 decimals/digits... And variables (well for me) say they have a limit of 67,000,000 bytes... Is there any way around this? can you save the first 10,000 characters/digits into one? can you save it into an array 10,000 in each? Is there a way? If so how? Thanks alot... ...

Passing javascript form variables into jQuery function not working

I am trying to pass some JavaScript variables that I have assigned to form variables into a query string used by a jQuery plug in called fancybox. If I hard code in the string that I want lightbox works great, however I need it to pass some form values in there to make it work as desire. <script type="text/javascript"> $(document)....

Duplicate a image varible GD library

What is the easiest way to duplicate an image variable in PHP. Normally you can simply do $varnew = $varold. But with a GD library variable if I did the above and then edited $varnew then $varold would be effected too. Obviously one way would be to reopen the file or to make a new image and copy it into it. Is there an easier way? ...

For each result in MySQL query, push to array (complicated)

Okay, here's what I'm trying to do. I am running a MySQL query for the most recent posts. For each of the returned rows, I need to push the ID of the row to an array, then within that ID in the array, I need to add more data from the rows. A multi-dimensional array. Here's my code thus far. $query = "SELECT * FROM posts ORDER BY id DES...