Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.78 KB | None | 0 0
  1. <form method="post" action="index.php" >
  2. <label for="nama">Username : </label><input type="text" name="username" /><br />
  3. <label for="pswd">Password : </label><input class="login" type="password" name="password" />
  4. <br /> <input class="button" type="submit" value="Login" /> <p class="signup"><small>don't have id yet <a href="signup.php"> sign up</a> here</small></p>
  5. </form>
  6. <?php if (isset($_POST['username'])) {
  7. if (!empty($_POST['username']) && !empty($_POST['password'])) {
  8. $uname=mysql_real_escape_string($_POST['username']);
  9. $pswd= mysql_real_escape_string($_POST['password']);
  10. $query = "SELECT username,flag,fullname FROM user WHERE username = '".$uname."' AND password = '".$pswd."'";
  11. $do= mysql_query($query);
  12.  
  13. if (0!=mysql_num_rows($do))
  14. {
  15. $_SESSION['user'] = mysql_fetch_assoc($do);
  16. header('Location: lihat.php');
  17. $sts =1;
  18. }
  19.  
  20. else {
  21. echo '<i>Username or Password Incorrect.</i>';
  22. }
  23. }
  24. else {
  25. echo '<i>Username and Password must be filled.</i>';
  26. }
  27. } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement