Guest User

Untitled

a guest
May 18th, 2017
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. <?
  2. ob_start();
  3. include ("config.php");
  4. ?>
  5.  
  6. <html>
  7. <head>
  8. <title>Shitter ~ Share your shitty thoughts!</title>
  9. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  10. <link href="style.css" rel="stylesheet" type="text/css"/>
  11. </head>
  12. <body>
  13. <div id="content" align="center">
  14. <center><img src="shitter.png" /></center><br>
  15. <?php
  16. if (! $logged[name]) {
  17. if ($_GET["action"] == "login") {
  18. $username = $_POST['username'];
  19. $password = sha1($_POST['password']);
  20. $info = mysql_query("SELECT * FROM users WHERE name = '$username'") or die(mysql_error());
  21. $data = mysql_fetch_array($info);
  22. if ($data[password] != $password) {
  23. echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php?invalid=true\">";
  24. } else {
  25. $user = $data;
  26. setcookie("name", $user[name], time() + (11000), "/", "");
  27. setcookie("pass", $user[password], time() + (11000), "/", "");
  28. setcookie("id", $user[id], time() + (11000), "/", "");
  29. echo "<meta http-equiv=\"Refresh\" content=\"0; URL=dashboard.php\" />";
  30. }
  31. exit();
  32. } else {
  33. ?>
  34.  
  35. <form method="post" action="?action=login" align="center">
  36. <b>Username:</b>
  37. <input type="text" value="" name="username"/><br>
  38. <b>Password:</b>
  39. <input type="password" value="" name="password"/>
  40. <div align="right"><input type="submit" onClick="javascript:submitForm()" value="Enter" name="submit"/></div>
  41. </form>
  42. <? if ($_GET[invalid] == "true"){ ?>
  43. <center>
  44. <font color="#ff0000"><strong>Warning:</strong> The userame and/or password you entered was incorrect</font><br>
  45. </center>
  46. <?php
  47. }
  48. if ($_GET[invalid] == "true"){
  49. echo ('
  50. <center><br>Forgotten your password? Contact site admins! <br /><br></center>
  51. ');
  52. }
  53. echo ('
  54. <center><b>Don\'t have an account?</b> <a href="register.php">Register here!</a></center>');
  55. if ($_GET[safelogout] == "true"){
  56. echo("<center><br><b>You have been successfully logged out!</b></center>");
  57. }
  58. }
  59. } else {
  60. header("Location: dashboard.php");
  61. }
  62. ?>
  63. </div>
  64. </body>
  65. </html>
Add Comment
Please, Sign In to add comment