Advertisement
Guest User

Untitled

a guest
Oct 19th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. <?php session_start();
  2.  
  3. //connection to database and other stuff
  4.  
  5. if ($user == $dbuser && $pass == $dbpass) {
  6.  
  7. $_SESSION['user'] = $user;
  8. $_SESSION['authenticated'] = "yes";
  9. $suser = $_SESSION['user']; //just to test if session works
  10.  
  11. }
  12.  
  13. ?>
  14.  
  15. <?php session_start(); ?>
  16.  
  17. //small amount of html here
  18.  
  19. <?php
  20. $suser = $_SESSION['user'];
  21. $sauth = $_SESSION['authenticated'];
  22.  
  23. if ($sauth != 'yes') { //not completed yet (needs user name check)
  24. echo "<a href='./'>Log in</a> first!";
  25. require ('./login.php');
  26. die;
  27. } else {
  28. //not so important code here
  29. }
  30. ?>
  31.  
  32. //rest of html here
  33.  
  34. <?php session_start();
  35. ob_start();
  36. //connection to database and other stuff
  37.  
  38. if ($user == $dbuser && $pass == $dbpass) {
  39.  
  40. $_SESSION['user'] = $user;
  41. $_SESSION['authenticated'] = "yes";
  42. $suser = $_SESSION['user']; //just to test if session works
  43.  
  44. }
  45.  
  46. ?>
  47.  
  48. <?php session_start();
  49. ob_start();?>
  50.  
  51. //small amount of html here
  52. <?php session_start(); ob_start();
  53. $suser = $_SESSION['user'];
  54. $sauth = $_SESSION['authenticated'];
  55.  
  56. if ($sauth != 'yes') { //not completed yet (needs user name check)
  57. echo "<a href='./'>Log in</a> first!";
  58. require ('./login.php');
  59. die;
  60. } else {
  61. //not so important code here
  62. }
  63. ?>
  64.  
  65. //rest of html here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement