Guest User

Untitled

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