Advertisement
syari

session.php

May 1st, 2015
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.43 KB | None | 0 0
  1. <?php
  2.  session_start();
  3. //Check whether the session variable SESS_MEMBER_ID is present or not
  4. if (!isset($_SESSION['id']) || (trim($_SESSION['id']) == '')) { ?>
  5. <script>
  6. window.location = "index.php";
  7. </script>
  8. <?php
  9. }
  10. $session_id=$_SESSION['id'];
  11.  
  12. $user_query = $conn->query("select * from users where user_id = '$session_id'")or die(mysql_error());
  13. $user_row = $user_query->fetch();
  14. $user_username = $user_row['username'];
  15. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement