Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- #####################################################
- require_once "includes/configurare.php";
- require_once "includes/functii.php";
- #####################################################
- if ($_POST)
- {
- $username = mysql_real_escape_string($_POST['username']);
- $password = mysql_real_escape_string($_POST['password']);
- $password = strtoupper(hash("whirlpool","$password"));
- $euser = mysql_fetch_array(mysql_query("SELECT id from players where Name='$username'"));
- $euser = $euser[0];
- $parola = mysql_fetch_array(mysql_query("SELECT Password from players where Name='$username'"));
- $parola = $parola[0];
- if (!$euser[0])
- {
- $eroare = "user";
- }
- else if ($parola!==$password)
- {
- $eroare = "parola";
- }
- else if (empty($_SESSION['captcha']) || strtolower(trim($_REQUEST['captcha'])) != $_SESSION['captcha'])
- {
- $eroare = "captcha";
- }
- else
- {
- $user_db = mysql_fetch_array(mysql_query("SELECT Name from players where id='$euser'"));
- $user_db = $user_db[0];
- setcookie ("user",$user_db,time()+3600*24*60);
- setcookie ("pass",$password,time()+3600*24*60);
- header("Location: $adresa/index.php");
- }
- unset($_SESSION['captcha']);
- }
- #####################################################
- echo "<html>\n";
- echo "<head>\n";
- echo "<title>Login zone @ $titlu_site</title>\n";
- echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
- echo "<link rel=\"shortcut icon\" href=\"stylesheet/img/devil-icon.png\">\n";
- echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"mos-css/mos-style.css\">\n";
- echo "</head>\n";
- echo "<body>\n";
- echo "<div id=\"header\">\n";
- echo "<div class=\"inHeaderLogin\"></div>\n";
- echo "</div>\n";
- echo "<div id=\"loginForm\">\n";
- echo "<div class=\"headLoginForm\">\n";
- echo "Login Player\n";
- echo "</div>\n";
- echo "<div class=\"fieldLogin\">\n";
- echo "<form method=\"POST\" action=\"login.php\">\n";
- if (!$eroare)
- {
- echo "<label>Username</label>\n";
- echo "<input type=\"text\" class=\"login\" name=\"username\"><br>\n";
- echo "<label>Parola</label><br>\n";
- echo "<input type=\"password\" class=\"login\" name=\"password\"><br>\n";
- echo "<label>Cod securitate</label><br>\n";
- echo "<img src=\"includes/captcha.php?$data\" alt=\"cod securitare\"><br>\n";
- echo "<input type=\"text\" name=\"captcha\" value=\"\"><br><br>\n";
- }
- else if ($eroare=="user")
- {
- echo "<label>Username <font color=\"red\">( incorect )</font></label>\n";
- echo "<input type=\"text\" class=\"login\" name=\"username\"><br>\n";
- echo "<label>Parola</label><br>\n";
- echo "<input type=\"password\" class=\"login\" name=\"password\"><br>\n";
- echo "<label>Cod securitate</label><br>\n";
- echo "<img src=\"includes/captcha.php?$data\" alt=\"cod securitare\"><br>\n";
- echo "<input type=\"text\" name=\"captcha\" value=\"\"><br><br>\n";
- }
- else if ($eroare=="parola")
- {
- echo "<label>Username</label>\n";
- echo "<input type=\"text\" class=\"login\" name=\"username\"><br>\n";
- echo "<label>Parola <font color=\"red\">( incorect )</font></label><br>\n";
- echo "<input type=\"password\" class=\"login\" name=\"password\"><br>\n";
- echo "<label>Cod securitate</label><br>\n";
- echo "<img src=\"includes/captcha.php?$data\" alt=\"cod securitare\"><br>\n";
- echo "<input type=\"text\" name=\"captcha\" value=\"\"><br><br>\n";
- }
- echo "<input type=\"submit\" class=\"button\" value=\"Login\">\n";
- echo "<a href=\"$adresa/recover.php\"><input type=\"button\" class=\"button\" value=\"Recuperare parola\"></a>\n";
- echo "</form>\n";
- echo "</div>\n";
- echo "</div>\n";
- echo "</body>\n";
- echo "</html>\n";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement