Advertisement
Guest User

Login panel

a guest
Aug 29th, 2016
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.53 KB | None | 0 0
  1. <?php
  2. session_start();
  3. #####################################################
  4. require_once "includes/configurare.php";
  5. require_once "includes/functii.php";
  6. #####################################################
  7. if ($_POST)
  8. {
  9. $username = mysql_real_escape_string($_POST['username']);
  10. $password = mysql_real_escape_string($_POST['password']);
  11. $password = strtoupper(hash("whirlpool","$password"));
  12. $euser = mysql_fetch_array(mysql_query("SELECT id from players where Name='$username'"));
  13. $euser = $euser[0];
  14. $parola = mysql_fetch_array(mysql_query("SELECT Password from players where Name='$username'"));
  15. $parola = $parola[0];
  16. if (!$euser[0])
  17. {
  18. $eroare = "user";
  19. }
  20. else if ($parola!==$password)
  21. {
  22. $eroare = "parola";
  23. }
  24. else if (empty($_SESSION['captcha']) || strtolower(trim($_REQUEST['captcha'])) != $_SESSION['captcha'])
  25. {
  26. $eroare = "captcha";
  27. }
  28. else
  29. {
  30. $user_db = mysql_fetch_array(mysql_query("SELECT Name from players where id='$euser'"));
  31. $user_db = $user_db[0];
  32. setcookie ("user",$user_db,time()+3600*24*60);
  33. setcookie ("pass",$password,time()+3600*24*60);
  34. header("Location: $adresa/index.php");
  35. }
  36. unset($_SESSION['captcha']);
  37. }
  38. #####################################################
  39. echo "<html>\n";
  40. echo "<head>\n";
  41. echo "<title>Login zone @ $titlu_site</title>\n";
  42. echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
  43. echo "<link rel=\"shortcut icon\" href=\"stylesheet/img/devil-icon.png\">\n";
  44. echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"mos-css/mos-style.css\">\n";
  45. echo "</head>\n";
  46. echo "<body>\n";
  47. echo "<div id=\"header\">\n";
  48. echo "<div class=\"inHeaderLogin\"></div>\n";
  49. echo "</div>\n";
  50. echo "<div id=\"loginForm\">\n";
  51. echo "<div class=\"headLoginForm\">\n";
  52. echo "Login Player\n";
  53. echo "</div>\n";
  54. echo "<div class=\"fieldLogin\">\n";
  55. echo "<form method=\"POST\" action=\"login.php\">\n";
  56. if (!$eroare)
  57. {
  58. echo "<label>Username</label>\n";
  59. echo "<input type=\"text\" class=\"login\" name=\"username\"><br>\n";
  60. echo "<label>Parola</label><br>\n";
  61. echo "<input type=\"password\" class=\"login\" name=\"password\"><br>\n";
  62. echo "<label>Cod securitate</label><br>\n";
  63. echo "<img src=\"includes/captcha.php?$data\" alt=\"cod securitare\"><br>\n";
  64. echo "<input type=\"text\" name=\"captcha\" value=\"\"><br><br>\n";
  65. }
  66. else if ($eroare=="user")
  67. {
  68. echo "<label>Username <font color=\"red\">( incorect )</font></label>\n";
  69. echo "<input type=\"text\" class=\"login\" name=\"username\"><br>\n";
  70. echo "<label>Parola</label><br>\n";
  71. echo "<input type=\"password\" class=\"login\" name=\"password\"><br>\n";
  72. echo "<label>Cod securitate</label><br>\n";
  73. echo "<img src=\"includes/captcha.php?$data\" alt=\"cod securitare\"><br>\n";
  74. echo "<input type=\"text\" name=\"captcha\" value=\"\"><br><br>\n";
  75. }
  76. else if ($eroare=="parola")
  77. {
  78. echo "<label>Username</label>\n";
  79. echo "<input type=\"text\" class=\"login\" name=\"username\"><br>\n";
  80. echo "<label>Parola <font color=\"red\">( incorect )</font></label><br>\n";
  81. echo "<input type=\"password\" class=\"login\" name=\"password\"><br>\n";
  82. echo "<label>Cod securitate</label><br>\n";
  83. echo "<img src=\"includes/captcha.php?$data\" alt=\"cod securitare\"><br>\n";
  84. echo "<input type=\"text\" name=\"captcha\" value=\"\"><br><br>\n";
  85. }
  86. echo "<input type=\"submit\" class=\"button\" value=\"Login\">\n";
  87. echo "<a href=\"$adresa/recover.php\"><input type=\"button\" class=\"button\" value=\"Recuperare parola\"></a>\n";
  88. echo "</form>\n";
  89. echo "</div>\n";
  90. echo "</div>\n";
  91. echo "</body>\n";
  92. echo "</html>\n";
  93. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement