cvs: pear /HTML_Progress2/examples/ajax phpcb_server1.php

From: Date: Mon, 22 Jan 2007 18:04:51 +0000
Subject: cvs: pear /HTML_Progress2/examples/ajax phpcb_server1.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-44338@lists.php.net to get a copy of this message
farell Mon Jan 22 18:04:51 2007 UTC Added files: /pear/HTML_Progress2/examples/ajax phpcb_server1.php Log: HTML_AJAX usage : Simple server with PHP callback function, that will serve user task script responder http://cvs.php.net/viewvc.cgi/pear/HTML_Progress2/examples/ajax/phpcb_server1.php?view=markup&rev=1.1 Index: pear/HTML_Progress2/examples/ajax/phpcb_server1.php +++ pear/HTML_Progress2/examples/ajax/phpcb_server1.php <?php /** * Simple server with PHP callback function, that will serve user task script responder * * @version $Id: phpcb_server1.php,v 1.1 2007/01/22 18:04:51 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress2 * @subpackage Examples * @access public */ session_start(); function getPercentage() { $newVal = $_SESSION['progressPercentage'] + mt_rand(1, 25); $_SESSION['progressPercentage'] = min(100, $newVal); // should return at least an array with one key ('percentage') and its value $status = array('percentage' => $_SESSION['progressPercentage']); return $status; } require_once 'HTML/AJAX/Server.php'; // register normal function $callback = 'getPercentage'; $server = new HTML_AJAX_Server(); $server->registerPhpCallback($callback); $server->handleRequest(); ?>

« previous php.pear.cvs (#44338) next »