Advertisement
Guest User

Untitled

a guest
Jul 14th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. <?php session_start()?>
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=Cp1253">
  6.  
  7. </head>
  8. <body>
  9. <?php
  10. //include_once 'sidebar.php';
  11. $link=mysqli_connect("localhost","root","");
  12. $database=mysqli_select_db($link,"webdevelop");
  13.  
  14. if(!isset($_SESSION["customerId"])){
  15.  
  16. if(isset($_POST["fsd"]))
  17. header("Location: /new/insertData.php");
  18.  
  19.  
  20. if(isset($_POST['username'])){
  21.  
  22. $email=$_POST['username'];
  23. $password=$_POST['password'];
  24. echo $email,' ',$password;
  25.  
  26. $authenticateQuery="select * from user where username='$email' and password='$password'";
  27. $authenticateResult=mysqli_query($link,$authenticateQuery);
  28. if(!$authenticateResult){
  29. echo "no login";
  30. }
  31. else{
  32. $customer=mysqli_fetch_array($authenticateResult);
  33. $_SESSION["customerId"]=$customer["id"];
  34. $_SESSION["customerName"]=$customer["name"];
  35. $_SESSION["lname"]=$customer["lastname"];
  36. }
  37.  
  38. $currentPage=$_SERVER['HTTP_REFERER'];
  39. header("Location:$currentPage ");
  40. exit(0);
  41. }
  42. }
  43.  
  44. else{
  45. echo "<div align='left'><form style='width:200px;margin-top:7px;' method='post'>",
  46. "<h3>welcome ", $_SESSION["customerName"] ," ",$_SESSION["lname"],
  47.  
  48. "</h3><br/><input style='margin-left:120px;width:80px;height:40px;' type='submit' value='Logout' name='logoutButton'/>
  49. </form></div>";
  50.  
  51.  
  52. if(isset($_POST["logoutButton"])){
  53. session_unset();
  54.  
  55. $currentPage=$_SERVER['HTTP_REFERER'];
  56. header("Location:/new/accessLayout.php ");
  57. exit(0);
  58. }
  59.  
  60. }
  61. mysqli_close($link);
  62.  
  63.  
  64. ?>
  65. </body>
  66.  
  67. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement