Advertisement
Guest User

Untitled

a guest
Nov 16th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.12 KB | None | 0 0
  1. session_start();
  2. if(isset($_POST['username']) || isset($_POST['password'])) {
  3. $username = $_POST['username'];
  4. $password = $_POST['password'];
  5. $_SESSION['username'] = $username;
  6. $_SESSION['password'] = $password;
  7. }
  8.  
  9. if(isset($_SESSION['username']) || isset($_SESSION['password'])){
  10. $navbar = "1";
  11. $logindisplay = "0";
  12. $username = $_SESSION['username'];
  13. $password = $_SESSION['password'];
  14. } else {
  15. header('Location:http://website.com/fail.php');
  16. }
  17.  
  18. $authed = auth($username, $password);
  19. if( $authed == "0" ){
  20. header('Location:http://website.com/fail.php');
  21. }
  22.  
  23. session_start();
  24. if( isset($_POST['username']) && isset($_POST['password']) )
  25. {
  26. if( auth($_POST['username'], $_POST['password']) )
  27. {
  28. // auth okay, setup session
  29. $_SESSION['user'] = $_POST['username'];
  30. // redirect to required page
  31. header( "Location: index.php" );
  32. } else {
  33. // didn't auth go back to loginform
  34. header( "Location: loginform.html" );
  35. }
  36. } else {
  37. // username and password not given so go back to login
  38. header( "Location: loginform.html" );
  39. }
  40.  
  41. session_start();
  42. session_regenerate_id();
  43. if(!isset($_SESSION['user'])) // if there is no valid session
  44. {
  45. header("Location: loginform.html");
  46. }
  47.  
  48. session_start();
  49. unset($_SESSION['user']);
  50. session_destroy();
  51. header("Location: loginform.html");
  52.  
  53. <?php
  54.  
  55. session_start();
  56.  
  57. if (isset($_POST['username']) && isset($_POST['password'])) {
  58. $username = $_POST['username'];
  59. $password = $_POST['password'];
  60. $authed = auth($username, $password);
  61.  
  62. if (! $authed) {
  63. header('Location: http://website.com/fail.php');
  64. } else {
  65. $_SESSION['username'] = $username;
  66. }
  67. }
  68.  
  69. if (isset($_SESSION['username'])) {
  70. $navbar = 1;
  71. $logindisplay = 0;
  72. } else {
  73. header ('Location: http://website.com/fail.php');
  74. }
  75.  
  76. if (isset($_POST['username'] && isset($_POST['password'])) {
  77. if (auth($_POST['username'], $_POST['password'])) {
  78. $_SESSION['user'] = /* userid or name or token or something */;
  79. header(/* to next page */);
  80. } else {
  81. // display "User credentials incorrect", stay on login form
  82. }
  83. } else {
  84. // optionally: display "please fill out all fields"
  85. }
  86.  
  87. if ($bAuthed)
  88. {
  89. header("location: login.php");
  90. }
  91.  
  92. // error case
  93. header("location: error-login.php");
  94.  
  95. session_start();
  96. if(isset($_POST['username']) || isset($_POST['password'])){
  97. $username = $_POST['username'];
  98. $password = $_POST['password'];
  99. $_SESSION['username'] = $username;
  100. $_SESSION['password'] = $password;
  101. }
  102.  
  103. if(isset($_SESSION['username']) || isset($_SESSION['password'])){
  104. $navbar = "1";
  105. $logindisplay = "0";
  106. $username = $_SESSION['username'];
  107. $password = $_SESSION['password'];
  108. $authed = auth($username, $password);
  109. if( $authed == "0" ){
  110. header('Location:http://website.com/fail.php');
  111. }
  112. } else {
  113. header('Location:http://website.com/fail.php');
  114. }
  115.  
  116. $password = $_POST['password'];
  117.  
  118. $_SESSION['username'] = $username;
  119.  
  120. $_SESSION['password'] = $password;
  121.  
  122. $logindisplay = "0";
  123.  
  124. $username = $_SESSION['username'];
  125.  
  126. $password = $_SESSION['password'];
  127.  
  128. header('Location:http://website.com/fail.php');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement