Advertisement
Guest User

Untitled

a guest
May 13th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. <?php
  2. session_start();
  3. ob_start();
  4.  
  5. include 'dbc.php';
  6.  
  7. $user_name = mysql_real_escape_string($_POST['username']);
  8.  
  9. if ($_POST['Submit']=='Login')
  10. {
  11. $pass = $_POST['pwd'];
  12. $sql = "SELECT id,user_name FROM users WHERE
  13. user_name = '$user_name' AND
  14. user_pwd = '$pass' AND user_activated='1'";
  15.  
  16. $result = mysql_query($sql) or die (mysql_error());
  17. $num = mysql_num_rows($result);
  18.  
  19. if ( $num != 0 ) {
  20.  
  21. // A matching row was found - the user is authenticated.
  22. list($user_id,$user_email) = mysql_fetch_row($result);
  23. // this sets variables in the session
  24. $_SESSION['ibr']= $user_name;
  25.  
  26.  
  27. if (isset($_GET['ret']) && !empty($_GET['ret']))
  28. {
  29. header("Location: $_GET[ret]");
  30. } else
  31. {
  32. header("Location: account.php");
  33.  
  34. }
  35. //echo "Logged in...";
  36. exit();
  37. }
  38. header("Location: login.php?msg=Invalid Login");
  39. //echo "Error:";
  40. exit();
  41. }
  42.  
  43. ?>
  44.  
  45. <link href="styles.css" rel="stylesheet" type="text/css">
  46.  
  47. <?php if (isset($_GET['msg'])) { echo "<div class=\"msg\"> $_GET[msg] </div>"; } ?>
  48.  
  49.  
  50. <style type="text/css">
  51. <!--
  52. .logintxt {font-size: 12px}
  53. -->
  54. </style>
  55. <div id="login"><form name="form1" method="post" action="">
  56. <p align="center"><span class="logintxt">Username:</span>
  57. <input name="username" type="text" id="username">
  58. </p>
  59. <p align="center"> <span class="logintxt">Password: </span>
  60. <input name="pwd" type="password" id="pwd">
  61. </p>
  62. <p align="center">
  63. <input type="submit" name="Submit" value="Login">
  64. </p>
  65. </form>
  66. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement