Guest User

Untitled

a guest
Jun 19th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include 'config.php';
  4.  
  5. if(isset($_POST['login']))
  6. {
  7.  
  8. $username = trim(addslashes($_POST['username']));
  9. $password = md5(trim($_POST['password']));
  10.  
  11. $query = mysql_query("SELECT * FROM Users WHERE user = '$username' AND Passwd = '$password' LIMIT 1") or die(mysql_error());
  12.  
  13. $row = mysql_fetch_array($query);
  14.  
  15. // now we check if they are activated
  16.  
  17. if(mysql_num_rows($query) > 0)
  18. {
  19.  
  20. if($row['Activated'] > 0)
  21. {
  22.  
  23. $_SESSION['s_logged_n'] = 'true';
  24. $_SESSION['s_username'] = $username;
  25. $_SESSION['s_name'] = $row['Name'];
  26.  
  27. header("Location: index.php");
  28. }
  29. ?>
  30.  
  31. the login page<br>
  32.  
  33. <p>You must login to view this page. Enter your username and password below and hit submit:</p>
  34. <form method="post" action="<?= $_SERVER['PHP_SELF'] ?>">
  35. <p>Username:<br>
  36. <input name="username" type="text" Cid="username">
  37.  
  38. <p>Password:<br>
  39. <input name="password" type="password" id="password">
  40. </p>
  41. <p>
  42. <input name="login" type="submit" id="login" value="Submit">
  43. </p>
  44. </form>
  45. <p>Inte registrerad? <a href="register.php">Klicka här!</a> för att bli medlem helt gratis!</p>
Add Comment
Please, Sign In to add comment