title: Forcing user to login when clicking on link
body: <p>i have this code which i am using to send an approval to a user email.
  what i need is : when the user clicks on the link; he should first login and then he can proceed the approval process.
  I tried the following code to check if the session is not registered,then to force the user to login (index.php):</p>
  
  <pre><code>global $user_ID;
  $user_ID = $_SESSION['empName'];
  if ($user_ID == '') { 
  header('Location: index.php'); exit(); 
  } 
  echo "&lt;INPUT type='hidden' name='Code' size = '6' value ='hr1.php' /&gt;";
  if(isset($_POST['Code'])){$Code = $_POST['Code'];}
  mysql_close($con);
  </code></pre>
  
  <p>now i need a method to redirect user to the previous page (link)</p>
  
  <p>any ideas???</p>