mysql - PHP returning output of other user request -
i'm facing problem php response. used ajax 3 seconds delay check user's logs. when user account used simultaneously 2 users, 1 must kicked. used track log id in db if equal session. problem users getting kicked there no other user using his/her account. tried print_r
query statements , returning different values. might response other users.
i'm using iis server , fastcgi php response.
can tell me how possible , give me ideas solve issue? thanks.
here of codes :
checking logs in db using ajax:
public function checklogstatus( $name, $email, $sess_code ) { $qry = "select log $this->tablename name='$name' , email='$email'"; //when print statement returns different values of $name , $email $result = mysql_query( $qry ) or die(mysql_error()); if( !$selresult = mysql_fetch_array($result) ) { return false; } if(!isset($_session)) { session_start(); } if( !isset( $selresult['log'] ) && $selresult['log'] != '' ) { if( $selresult['log'] != $sess_code ) { //$_session['logs'] = 'used'; return false; } } return true; }
<?php session_start(); $_session['log'] = $log; setcookie("log",$log,time()*24*60*60); //expires after 24hrs ?>
the function checklogstatus same mentioned above,
<?php public function checklogstatus( $name, $email, $sess_code ){ $qry = "select log $this->tablename name='$name' , email='$email'"; $result = mysql_query( $qry ) or die(mysql_error()); if( !$selresult = mysql_fetch_array($result) ){ return false; } if(!isset($_session)){ session_start(); } if( !isset( $selresult['log'] ) && $selresult['log'] != '' ){ if( $selresult['log'] != $sess_code ) { return false; } } return true; } ?>
but while passing,
<?php checklogstatus( "myname", "contact@email.com", $_cookie['log'] ); ?>
Comments
Post a Comment