Advertisement
Guest User

Trobleshoot post and get

a guest
Jan 7th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.84 KB | None | 0 0
  1. <?php
  2.  //Start a session
  3.   session_start();
  4.   //unset and reset any existing session
  5.   session_unset();
  6.   ?>
  7. <!DOCTYPE html>
  8. <html>
  9. <head>
  10. <script type="text/javascript">
  11. function delayedRedirect()
  12. {
  13. window.location = "url to page you want to go after login"
  14. }
  15. </script>
  16. </head>
  17. <body onLoad="setTimeout('delayedRedirect()', 8000)" style="background-color:#fff;">
  18.  
  19. <?php
  20. //this is a link to my connection string. you can type it here as well
  21. include 'tconslocal.php';
  22. //eg:  $con = mysqli_connect('server','username','password','database') or die('Unable To connect');
  23.  
  24. //assign variable here either through post or get
  25.  
  26. //for post use this
  27. $username=mysqli_real_escape_string($con,$_POST['username']);
  28.  $password=mysqli_real_escape_string($con,$_POST['password']);
  29.  
  30. //for GET use this
  31.  $username=mysqli_real_escape_string($con,$_GET['username']);
  32.  $password=mysqli_real_escape_string($con,$_GET['password']);
  33.  
  34. echo "this is username: ".$username;
  35. echo "|| This is password: ".$password;
  36.  
  37. //$mysql_query="SELECT * FROM tablename where username= '$username' AND password= '$password'";
  38. //$result = mysqli_query($con,$mysql_query);
  39. //$count= mysqli_num_rows($result);
  40. // If result matched username and password, table row must be 1 row
  41. //if($count>0)
  42. //{
  43. //use this if you will be using the table information in the row returned
  44. //while($row = $result->fetch_assoc())
  45. //{
  46. //here iam assigning the id from the table row into a session variable so i can use it later
  47. //$_SESSION['SESS_userID'] = $row['userid'];
  48. //close the session write process when done
  49. //session_write_close();
  50. //}
  51. //echo "User Has Been Logged In Successfully. You will be redirected to the dashbooard in 5 seconds";
  52. //exit;
  53. //}
  54. //else
  55. //{
  56. //echo "User Not Found. You will be redirected to the dashbooard in 5 seconds";
  57. //exit;
  58. //}
  59. ?>
  60. </body>
  61. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement