Advertisement
Guest User

Untitled

a guest
Jul 26th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.81 KB | None | 0 0
  1. <?php
  2. session_set_cookie_params(0);
  3.  
  4. session_start();
  5.  
  6.  
  7.  
  8. #####################################################
  9.  
  10.  
  11.  
  12. require_once "includes/config.php";
  13.  
  14. require_once "includes/functions.php";
  15.  
  16.  
  17.  
  18. #####################################################
  19.  
  20.  
  21. if ($_POST)
  22.  
  23.  
  24.  
  25. {
  26.  
  27.  
  28.  
  29. $name = mysql_real_escape_string($_POST['username']);
  30.  
  31. $password = mysql_real_escape_string($_POST['password']);
  32.  
  33. $euser = mysql_fetch_array(mysql_query("SELECT ID from users where name='$name'"));
  34.  
  35. $euser = $euser[0];
  36.  
  37. $parola = mysql_fetch_array(mysql_query("SELECT password from users where name='$name'"));
  38.  
  39. $parola = $parola[0];
  40.  
  41. if (!$euser[0])
  42.  
  43.  
  44.  
  45. {
  46.  
  47. $eroare = "user";
  48.  
  49. }
  50.  
  51.  
  52.  
  53. else if ($parola!==$password)
  54.  
  55.  
  56.  
  57. {
  58.  
  59. $eroare = "parola";
  60.  
  61. }
  62.  
  63.  
  64.  
  65. else
  66.  
  67.  
  68.  
  69. {
  70.  
  71. $user_db = mysql_fetch_array(mysql_query("SELECT name from users where ID='$euser'"));
  72. $user_db = $user_db[0];
  73.  
  74. setcookie ("user",$user_db);
  75.  
  76. setcookie ("pass",$password);
  77.  
  78. header("Location: index.php");
  79.  
  80.  
  81.  
  82. }
  83.  
  84. }
  85.  
  86.  
  87.  
  88. #####################################################
  89.  
  90.  
  91. echo "<!DOCTYPE html>\n";
  92. echo "<html class=\"bg-black\">\n";
  93. echo " <head>\n";
  94. echo " <meta charset=\"UTF-8\">\n";
  95. echo " <title>UNNIC.RO - Control Panel</title>\n";
  96. echo " <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>\n";
  97. echo " <!-- bootstrap 3.0.2 -->\n";
  98. echo " <link href=\"css/bootstrap.min.css\" rel=\"stylesheet\" type=\"text/css\" />\n";
  99. echo " <!-- font Awesome -->\n";
  100. echo " <link href=\"css/font-awesome.min.css\" rel=\"stylesheet\" type=\"text/css\" />\n";
  101. echo " <!-- Theme style -->\n";
  102. echo " <link href=\"css/AdminLTE.css\" rel=\"stylesheet\" type=\"text/css\" />\n";
  103. echo "\n";
  104. echo " <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->\n";
  105. echo " <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->\n";
  106. echo " <!--[if lt IE 9]>\n";
  107. echo " <script src=\"https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js\"></script>\n";
  108. echo " <script src=\"https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js\"></script>\n";
  109. echo " <![endif]-->\n";
  110. echo " </head>\n";
  111. echo " <body class=\"bg-black\">\n";
  112. echo "\n";
  113. echo " <div class=\"form-box\" id=\"login-box\">\n";
  114. echo " <div class=\"header\">Sign In</div>\n";
  115. echo " <form action=\"login.php\" method=\"POST\">\n";
  116. echo " <div class=\"body bg-gray\">\n";
  117. if (!$eroare)
  118. {
  119. echo " <div class=\"form-group\">\n";
  120. echo " <input type=\"text\" name=\"username\" class=\"form-control\" placeholder=\"Username\"/>\n";
  121. echo " </div>\n";
  122. echo " <div class=\"form-group\">\n";
  123. echo " <input type=\"password\" name=\"password\" class=\"form-control\" placeholder=\"Password\"/>\n";
  124. echo " </div> \n";
  125. echo " </div>\n";
  126. }
  127.  
  128. else if ($eroare=="user")
  129. {
  130. echo " <div class=\"form-group\">\n";
  131. echo " <input type=\"text\" name=\"username\" class=\"form-control\" placeholder=\"Username (Incorrect)\"/>\n";
  132. echo " </div>\n";
  133. echo " <div class=\"form-group\">\n";
  134. echo " <input type=\"password\" name=\"password\" class=\"form-control\" placeholder=\"Password\"/>\n";
  135. echo " </div> \n";
  136. echo " </div>\n";
  137. }
  138.  
  139. else if ($eroare=="parola")
  140. {
  141. echo " <div class=\"form-group\">\n";
  142. echo " <input type=\"text\" name=\"username\" class=\"form-control\" placeholder=\"Username\"/>\n";
  143. echo " </div>\n";
  144. echo " <div class=\"form-group\">\n";
  145. echo " <input type=\"password\" name=\"password\" class=\"form-control\" placeholder=\"Password (Incorrect)\"/>\n";
  146. echo " </div> \n";
  147. echo " </div>\n";
  148. }
  149.  
  150. echo " <div class=\"footer\"> \n";
  151. echo " <button type=\"submit\" class=\"btn bg-light-blue btn-block\">Sign in</button> \n";
  152. echo " \n";
  153.  
  154. echo " </div>\n";
  155. echo " </form>\n";
  156. echo "\n";
  157.  
  158. echo " </div>\n";
  159. echo "\n";
  160. echo "\n";
  161. echo " <!-- jQuery 2.0.2 -->\n";
  162. echo " <script src=\"http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js\"></script>\n";
  163. echo " <!-- Bootstrap -->\n";
  164. echo " <script src=\"js/bootstrap.min.js\" type=\"text/javascript\"></script> \n";
  165. echo "\n";
  166. echo " </body>\n";
  167. echo "</html>";
  168.  
  169. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement