Guest User

Untitled

a guest
Aug 2nd, 2018
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.38 KB | None | 0 0
  1. <?php require_once('Connections/conn.php'); ?>
  2. <?php
  3. session_start();
  4.  
  5. if(isset($_POST["s_username"]) && isset($_POST["s_password"])){
  6.  
  7. $s_username = $_POST["s_username"];
  8. $s_password = $_POST["s_password"];
  9.  
  10. echo "<script>window.alert('$s_username - $s_password');</script>";
  11.  
  12. $sql= mysql_query("SELECT * FROM student WHERE studentNo = $s_username AND studentPswd = $s_password LIMIT 1");
  13. $sql2= mysql_query("SELECT * FROM clockin WHERE studentNo = '$s_username' AND status=0 LIMIT 1");
  14.  
  15. $existCount = mysql_num_rows($sql);
  16.  
  17. $s_status = "1";
  18. if($existCount==1){
  19. while($row = mysql_fetch_array($sql)){
  20. $s_no=$row['studentNo'];
  21. $s_name=$row['studentName'];
  22.  
  23. }
  24. if($existCount2==1){
  25. while($row2 = mysql_fetch_array($sql2)){
  26. $s_status=$row2['status'];
  27. $s_clockid=$row2['clockID'];
  28. }}
  29.  
  30. $_SESSION["s_no"]=$s_no;
  31. $_SESSION["MM_Username"]=$s_username;
  32.  
  33. if($sql==true){
  34.  
  35. echo "<script>window.alert('Login Success');</script>";
  36. </script>";
  37.  
  38. if($s_status==1){
  39.  
  40. header("refresh:1 ,url=beginSession.php ");
  41. exit();
  42. }
  43.  
  44. else {
  45.  
  46. echo "<script>window.alert('Sesi Lepas Belum Ditamatkan.');</script>";
  47. header("refresh:1 ,url=startedSession2.php?clockid=$s_clockid");
  48. exit();
  49.  
  50. }
  51. }
  52. }
  53. else{
  54. echo "<script>window.alert('Login Failed.');</script>";
  55. header("refresh:1 ,url=login.php");
  56. exit();
  57. }
  58. }
  59.  
  60. ?>
  61. <body>
  62. <div class="wrapper-page">
  63. <div class="panel panel-color panel-primary panel-pages">
  64. <div class="panel-heading bg-img">
  65. <div class="bg-overlay"></div>
  66.  
  67. <h3 class="text-center m-t-10 text-white"><strong>Masuk ke</strong>
  68. <p><a href="#"><img src="img/logo2.png" alt="" title=""></a></p></h3>
  69. </div>
  70.  
  71.  
  72. <div class="panel-body">
  73. <form class="form-horizontal m-t-20" id="form1" method="post" action="login.php">
  74.  
  75. <div class="form-group">
  76. <div class="col-xs-12">
  77. <input name="s_username" class="form-control input-lg" type="text" required="" placeholder="Username">
  78. </div>
  79. </div>
  80.  
  81. <div class="form-group">
  82. <div class="col-xs-12">
  83. <input name="s_password" class="form-control input-lg" type="password" required="" placeholder="Password">
  84. </div>
  85. </div>
  86.  
  87. <div class="form-group text-center m-t-40">
  88. <div class="col-xs-12"><label>
  89. <button class="btn btn-primary btn-lg w-lg waves-effect waves-light" type="submit" value="Log in">Log In</button></label>
  90. <label><a href="reg2.php" class="btn btn-primary btn-lg w-lg waves-effect waves-light">Daftar Baru</a></label>
  91. </div>
  92. </div>
  93. </form>
  94. </div>
  95. </div>
  96. </div>
  97. </body>
Add Comment
Please, Sign In to add comment