session variables - how to go to the same page after login in php page -


i have search page in wich pop bob open , after pop login want redirect same url means url not changed .so how can redairect....

this search page pop code .

<div id="light">     <form action="tutors_login1.php" method="post" name="form">      <center>     <table>         <tr><td>             please login         </td></tr>         <tr><td>             user email <input type="text" name="email" />         </td></tr>         </tr><td>             password <input type="password" name="password" />         </td></tr>         <tr><td>         <input type="submit" name="submitbut" value="login" />         </td></tr>                        </table>     </center>      </form> </div>  <div id="fade" onclick="lightbox_close();"></div>  

this login page code in redairect page

if($flagl=='lgin'){         header('location: my_account.php'); }  $tabl = 'tutor';  if($_post['submitbut'] == 'login') {     $stateid=$_request['country'];     $cityid=$_request['state'];     $areaid=$_request['city'];      $email = mysql_real_escape_string($_post['email']);      $password = mysql_real_escape_string($_post['password']);      $sql = "select * $tabl email='$email' , password='$password' , app='1'";      $exec = mysql_query($sql);      $num = mysql_num_rows($exec);      if($num == 1) {         $fetch = mysql_fetch_assoc($exec);         $_session['login'] = $fetch['uniq'];         $_session['email'] = $fetch['email'];          $email = $_session['email'];          $_session['type'] = 'tutor';          header("location: latest_tuition_jobs.php");      }         if($sql1 = "select * $tabl email='$email' , password='$password' , app='0'")         {             $exec1 = mysql_query($sql1);              $flag_r1 = 'r'; } else {         $flag_r = 'r';     } } 

you have use

$_server['http_referer'];  

as per php docs states :

the address of page (if any) referred user agent current page. set user agent. not user agents set this, , provide ability modify http_referer feature. in short, cannot trusted.

which interpreted if try access page log in only, need log in. once log in login take referring or last page , can go business.

also please stop using mysql_ depretiated , should not used new code. (or old code matter). please refactor code pdo or might fall victim inject attacks. if need setting pdo please let me know , assist :)


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -