Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_set_cookie_params(0);
- session_start();
- #####################################################
- require_once "includes/config.php";
- require_once "includes/functions.php";
- #####################################################
- if ($_POST)
- {
- $name = mysql_real_escape_string($_POST['username']);
- $password = mysql_real_escape_string($_POST['password']);
- $euser = mysql_fetch_array(mysql_query("SELECT ID from users where name='$name'"));
- $euser = $euser[0];
- $parola = mysql_fetch_array(mysql_query("SELECT password from users where name='$name'"));
- $parola = $parola[0];
- if (!$euser[0])
- {
- $eroare = "user";
- }
- else if ($parola!==$password)
- {
- $eroare = "parola";
- }
- else
- {
- $user_db = mysql_fetch_array(mysql_query("SELECT name from users where ID='$euser'"));
- $user_db = $user_db[0];
- setcookie ("user",$user_db);
- setcookie ("pass",$password);
- header("Location: index.php");
- }
- }
- #####################################################
- echo "<!DOCTYPE html>\n";
- echo "<html class=\"bg-black\">\n";
- echo " <head>\n";
- echo " <meta charset=\"UTF-8\">\n";
- echo " <title>UNNIC.RO - Control Panel</title>\n";
- echo " <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>\n";
- echo " <!-- bootstrap 3.0.2 -->\n";
- echo " <link href=\"css/bootstrap.min.css\" rel=\"stylesheet\" type=\"text/css\" />\n";
- echo " <!-- font Awesome -->\n";
- echo " <link href=\"css/font-awesome.min.css\" rel=\"stylesheet\" type=\"text/css\" />\n";
- echo " <!-- Theme style -->\n";
- echo " <link href=\"css/AdminLTE.css\" rel=\"stylesheet\" type=\"text/css\" />\n";
- echo "\n";
- echo " <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->\n";
- echo " <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->\n";
- echo " <!--[if lt IE 9]>\n";
- echo " <script src=\"https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js\"></script>\n";
- echo " <script src=\"https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js\"></script>\n";
- echo " <![endif]-->\n";
- echo " </head>\n";
- echo " <body class=\"bg-black\">\n";
- echo "\n";
- echo " <div class=\"form-box\" id=\"login-box\">\n";
- echo " <div class=\"header\">Sign In</div>\n";
- echo " <form action=\"login.php\" method=\"POST\">\n";
- echo " <div class=\"body bg-gray\">\n";
- if (!$eroare)
- {
- echo " <div class=\"form-group\">\n";
- echo " <input type=\"text\" name=\"username\" class=\"form-control\" placeholder=\"Username\"/>\n";
- echo " </div>\n";
- echo " <div class=\"form-group\">\n";
- echo " <input type=\"password\" name=\"password\" class=\"form-control\" placeholder=\"Password\"/>\n";
- echo " </div> \n";
- echo " </div>\n";
- }
- else if ($eroare=="user")
- {
- echo " <div class=\"form-group\">\n";
- echo " <input type=\"text\" name=\"username\" class=\"form-control\" placeholder=\"Username (Incorrect)\"/>\n";
- echo " </div>\n";
- echo " <div class=\"form-group\">\n";
- echo " <input type=\"password\" name=\"password\" class=\"form-control\" placeholder=\"Password\"/>\n";
- echo " </div> \n";
- echo " </div>\n";
- }
- else if ($eroare=="parola")
- {
- echo " <div class=\"form-group\">\n";
- echo " <input type=\"text\" name=\"username\" class=\"form-control\" placeholder=\"Username\"/>\n";
- echo " </div>\n";
- echo " <div class=\"form-group\">\n";
- echo " <input type=\"password\" name=\"password\" class=\"form-control\" placeholder=\"Password (Incorrect)\"/>\n";
- echo " </div> \n";
- echo " </div>\n";
- }
- echo " <div class=\"footer\"> \n";
- echo " <button type=\"submit\" class=\"btn bg-light-blue btn-block\">Sign in</button> \n";
- echo " \n";
- echo " </div>\n";
- echo " </form>\n";
- echo "\n";
- echo " </div>\n";
- echo "\n";
- echo "\n";
- echo " <!-- jQuery 2.0.2 -->\n";
- echo " <script src=\"http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js\"></script>\n";
- echo " <!-- Bootstrap -->\n";
- echo " <script src=\"js/bootstrap.min.js\" type=\"text/javascript\"></script> \n";
- echo "\n";
- echo " </body>\n";
- echo "</html>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement