Guest User

Untitled

a guest
Oct 14th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. <?php
  2. session_start();
  3. require("config.php");
  4. require("functions.php");
  5. $db = mysql_connect($dbhost, $dbuser, $dbpassword);
  6. mysql_select_db($dbdatabase, $db);
  7. $db = mysql_connect($dbhost, $dbuser, $dbpassword);
  8. mysql_select_db($dbdatabase, $db);
  9.  
  10. if($_POST['submit']) {
  11. $sql = "SELECT * FROM users WHERE username = '"
  12. . $_POST['username'] . "' AND password = '"
  13. . $_POST['password'] . "';";
  14. $result = mysql_query($sql);
  15. $numrows = mysql_num_rows($result);
  16. $result = mysql_query($sql);
  17. $numrows = mysql_num_rows($result);
  18.  
  19. if($numrows == 1) {
  20. $row = mysql_fetch_assoc($result);
  21.  
  22. if($row['active'] == 1) {
  23. session_register("USERNAME");
  24. session_register("USERID");
  25. $_SESSION['USERNAME'] = $row['username'];
  26. $_SESSION['USERID'] = $row['id'];
  27.  
  28. switch($_GET['ref']) {
  29. case "newpost":
  30.  
  31. if(isset($_GET['id']) == FALSE) {
  32. header("Location: " . $config_basedir .
  33. "/newtopic.php");
  34. }
  35.  
  36. else {
  37. header("Location: " . $config_basedir .
  38. "/newtopic.php?id=" . $_GET['id']);
  39. }
  40.  
  41. break;
  42. case "reply":
  43. if(isset($_GET['id']) == FALSE) {
  44. header("Location: " . $config_basedir .
  45. "/newtopic.php");
  46. }
  47.  
  48. else {
  49. header("Location: " . $config_basedir .
  50. "/newtopic.php?id=" . $_GET['id']);
  51. }
  52.  
  53. break;
  54. default:
  55. header("Location: " . $config_basedir);
  56. break;
  57. }
  58.  
  59.  
  60. else {
  61. require("header.php");
  62. echo "This account is not verified yet. You were emailed a link
  63. to verify the account. Please click on the link in the email to
  64. continue.";
  65. }
  66. }
  67. }
  68.  
  69. echo "This account is not verified yet. You were emailed a link
  70. to verify the account. Please click on the link in the email to
  71. continue.";
  72. }
  73.  
  74. else {
  75. header("Location: " . $config_basedir . "/login.php?error=1");
  76. }
  77.  
  78. else {
  79. require("header.php");
  80.  
  81. if($_GET['error']) {
  82. echo "Incorrect login, please try again!"; //had to remove a "/" in very front on this line
  83. }
  84. ?>
  85. <form action="<?php echo pf_script_with_get($SCRIPT_NAME); ?>"
  86. method="post">
  87. <table>
  88. <tr>
  89. <td>Username</td>
  90. <td><input type="text" name="username"></td>
  91. </tr>
  92. <tr>
  93. <td>Password</td>
  94. <td><input type="password" name="password"></td>
  95. </tr>
  96. <tr>
  97. <td></td>
  98. <td><input type="submit" name="submit" value="Login!"></td>
  99. </tr>
  100. </table>
  101. </form>
  102. Don't have an account? Go and <a href="register.php">Register</a>!
  103. <?php
  104. }
  105. require("footer.php");
  106. ?>
Add Comment
Please, Sign In to add comment