function newplayer()
{
    global $s_message;
    global $otherplayer;
    //	$userid		=	'*****@*****.**';
    $userid = $_POST['userid'];
    $otherplayer = $_POST['secondplayer'];
    $count_players = $_POST['count'];
    mysql_query("DELETE FROM g1_players WHERE playerid = '{$userid}'");
    mysql_query("INSERT INTO g1_players(playerid,status,gameid,wordstyped,wordstime,sessionscore,lastaccessedtime) VALUES ('{$userid}','WAITING','','','','0',current_timestamp())") or die(mysql_error());
    mysql_query("UPDATE peoplenodes SET invite = 'PROCESSING' where id ='{$userid}'");
    $s_message = 'WAITING';
    sendMessage();
    //IamtheAgent('*****@*****.**');
    //IamtheAgent($userid);		// connection agent
    if ($count_players == 1) {
        error_log("The i am the connecting agent");
        IamtheConnectingAgent($userid);
    } else {
        error_log("the IamtheAgent is");
        IamtheAgent($userid);
    }
    //IamtheAgent($userid);
    //sendMessage();
}
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL CONSORTIUM BOARD COLLAGE Group BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
?>


<?php 
include "conntube.php";
IamtheAgent("*****@*****.**");
function IamtheAgent($user)
{
    $arrayotherusers = array();
    $usercount = '0';
    $query = "SELECT id,lastaccessed FROM peoplenodes where  id !='{$user}'";
    $result = mysql_query($query);
    echo $query;
    echo '</br>';
    $otherloggedinusers = array();
    while ($row = mysql_fetch_array($result)) {
        $timequery = "SELECT UNIX_TIMESTAMP('{$row['1']}') from peoplenodes";
        //this is providing lastaccess time for $row[1]
        echo $timequery;
        $timeresult = mysql_query($timequery);
        $timerow = mysql_fetch_array($timeresult);