mysql - how can I set session id and verify on the next page in php -


i want set session id using pin column query result , check see whether session set value on next page, here code

<?php require_once('applogin_class.php'); $success=''; if(isset($_post['submit'])){ $pin=$_post['sidn']; $status=0; try{         require_once('connection.php');          $message='invalid application pin';         $sth=$db_conn->prepare("select * pins pin=? && status=?");         $sth->bindparam(1,$pin);         $sth->bindparam(2,$status);         $sth->execute();         $row=$sth->fetch();         if($sth->rowcount()==1){             $_session['id']=$row['pin'];;              echo '<meta http-equiv="refresh" content="=1;applicants/upload_pass.php?pin=$pin"/> ';         }else{             return $message;         }     }catch(pdoexception $e){         echo $e->getmessage();     } } ?> 

here next page verification code

<?php $pin=$_get['pin']; require_once('class_applicants.php'); if(!isset($_session['id'])){ echo '<meta http-equiv="refresh" content="=1;../apphome.php"/> '; }else{ //success page here }?> 

someone should me check while page loging me out because of session id

use session_start();

example:

<?php   session_start();   $pin=$_get['pin'];   require_once('class_applicants.php');    if(!isset($_session['id'])){   echo '<meta http-equiv="refresh" content="=1;../apphome.php"/> ';   }else{   //success page here     }?> 

and also

<?php   session_start(); require_once('applogin_class.php');  $success='';  if(isset($_post['submit'])){ $pin=$_post['sidn'];  $status=0;  try{     require_once('connection.php');      $message='invalid application pin';     $sth=$db_conn->prepare("select * pins pin=? && status=?");     $sth->bindparam(1,$pin);     $sth->bindparam(2,$status);     $sth->execute();     $row=$sth->fetch();     if($sth->rowcount()==1){         $_session['id']=$row['pin'];;          echo '<meta http-equiv="refresh" content="=1;applicants/upload_pass.php?pin=$pin"/> ';     }else{         return $message;     } }catch(pdoexception $e){     echo $e->getmessage(); } }?> 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -