Advertisement
Guest User

Code

a guest
Jan 21st, 2017
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.45 KB | None | 0 0
  1. login.php:
  2. <?php
  3. $homepage = file_get_contents('http://www.browse-easy.cf/header.php');
  4. echo $homepage;
  5. ?>
  6. <?php
  7. session_start();
  8. // connect to database
  9. $db = new mysqli('mysql.hostinger.ph', 'u978812116_data', 'miguel039', 'u978812116_data');
  10. if (isset($_POST['login_btn'])) {
  11. $username = mysql_real_escape_string($_POST['username']);
  12. $password = mysql_real_escape_string($_POST['password']);
  13. $password = md5($password); // remember we hashed password before storing last time
  14. $sql = "SELECT * FROM users WHERE username='$username' AND password='$password'";
  15. $result = mysqli_query($db, $sql);
  16. if (mysqli_num_rows($result) == 1) {
  17. $_SESSION['message'] = "You are now logged in";
  18. $_SESSION['username'] = $username;
  19. header("location: home.php"); //redirect to home page
  20. }else{
  21. $_SESSION['message'] = "Username/password combination incorrect";
  22. }
  23. }
  24. ?>
  25. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  26. <html xmlns="http://www.w3.org/1999/xhtml">
  27. <head>
  28. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  29. <title>Browse Easy - Home</title>
  30. <meta name="google-site-verification" content="zYqmL1Vu_SYx-_pZzqrRpOsSRHiuI6rcKt1P47XEHJY" />
  31. <link rel="stylesheet" type="text/css" href="style.css" />
  32. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  33. <meta charset="utf-8">
  34. <meta name="viewport" content="width=device-width, initial-scale=1">
  35. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  36. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  37. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  38. <meta name="google-site-verification" content="zYqmL1Vu_SYx-_pZzqrRpOsSRHiuI6rcKt1P47XEHJY" />
  39. </head>
  40. <body>
  41. <div class="modal-dialog">
  42. <div class="loginmodal-container">
  43. <h1>Login to Your Account</h1><br>
  44. <form>
  45. <input type="text" name="usename" placeholder="Username">
  46. <input type="password" name="password" placeholder="Password">
  47. <input type="submit" name="login_btn" class="login loginmodal-submit" value="Login">
  48. </form>
  49.  
  50. <div class="login-help">
  51. <a href="#">Register</a> - <a href="#">Forgot Password</a>
  52. </div>
  53. </div>
  54. </div>
  55. <style>
  56. @import url(http://fonts.googleapis.com/css?family=Roboto);
  57.  
  58. /****** LOGIN MODAL ******/
  59. .loginmodal-container {
  60. padding: 30px;
  61. max-width: 350px;
  62. width: 100% !important;
  63. background-color: #F7F7F7;
  64. margin: 0 auto;
  65. border-radius: 2px;
  66. box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
  67. overflow: hidden;
  68. font-family: roboto;
  69. }
  70.  
  71. .loginmodal-container h1 {
  72. text-align: center;
  73. font-size: 1.8em;
  74. font-family: roboto;
  75. }
  76.  
  77. .loginmodal-container input[type=submit] {
  78. width: 100%;
  79. display: block;
  80. margin-bottom: 10px;
  81. position: relative;
  82. }
  83.  
  84. .loginmodal-container input[type=text], input[type=password] {
  85. height: 44px;
  86. font-size: 16px;
  87. width: 100%;
  88. margin-bottom: 10px;
  89. -webkit-appearance: none;
  90. background: #fff;
  91. border: 1px solid #d9d9d9;
  92. border-top: 1px solid #c0c0c0;
  93. /* border-radius: 2px; */
  94. padding: 0 8px;
  95. box-sizing: border-box;
  96. -moz-box-sizing: border-box;
  97. }
  98.  
  99. .loginmodal-container input[type=text]:hover, input[type=password]:hover {
  100. border: 1px solid #b9b9b9;
  101. border-top: 1px solid #a0a0a0;
  102. -moz-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
  103. -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
  104. box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
  105. }
  106.  
  107. .loginmodal {
  108. text-align: center;
  109. font-size: 14px;
  110. font-family: 'Arial', sans-serif;
  111. font-weight: 700;
  112. height: 36px;
  113. padding: 0 8px;
  114. /* border-radius: 3px; */
  115. /* -webkit-user-select: none;
  116. user-select: none; */
  117. }
  118.  
  119. .loginmodal-submit {
  120. /* border: 1px solid #3079ed; */
  121. border: 0px;
  122. color: #fff;
  123. text-shadow: 0 1px rgba(0,0,0,0.1);
  124. background-color: #4d90fe;
  125. padding: 17px 0px;
  126. font-family: roboto;
  127. font-size: 14px;
  128. /* background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#4d90fe), to(#4787ed)); */
  129. }
  130.  
  131. .loginmodal-submit:hover {
  132. /* border: 1px solid #2f5bb7; */
  133. border: 0px;
  134. text-shadow: 0 1px rgba(0,0,0,0.3);
  135. background-color: #357ae8;
  136. /* background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#4d90fe), to(#357ae8)); */
  137. }
  138.  
  139. .loginmodal-container a {
  140. text-decoration: none;
  141. color: #666;
  142. font-weight: 400;
  143. text-align: center;
  144. display: inline-block;
  145. opacity: 0.6;
  146. transition: opacity ease 0.5s;
  147. }
  148.  
  149. .login-help{
  150. font-size: 12px;
  151. }
  152. </style>
  153. </body>
  154. </html>
  155. register.php:
  156.  
  157.  
  158. <?php
  159. session_start();
  160.  
  161. //Connect To Database
  162. $db = new mysqli('mysql.hostinger.ph', 'u978812116_data', 'miguel039', 'u978812116_data');
  163. $homepage = file_get_contents('http://www.browse-easy.cf/header2.php');
  164. echo $homepage;
  165. if (isset($_POST['register_btn'])) {
  166. $username = mysql_real_escape_string($_POST['usermame']);
  167. $email = mysql_real_escape_string($_POST['email']);
  168. $password = mysql_real_escape_string($_POST['password']);
  169. $password2 = mysql_real_escape_string($_POST['password2']);
  170.  
  171. if ($password == $password2) {
  172. // create user
  173. $password = md5($password);
  174. $sql = "INSERT INTO users(username, email, password) VALUES('$username', '$email', '$password')";
  175. mysqli_query($db, $sql);
  176. $_SESSION = "You are now logged in";
  177. $_SESSION = $username;
  178. header("location: home.php");
  179. }else{
  180. $_SESSION['The two passwords do not match'];
  181. }
  182. }
  183. ?>
  184. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  185. <html xmlns="http://www.w3.org/1999/xhtml">
  186. <head>
  187. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  188. <title>Browse Easy - Home</title>
  189. <meta name="google-site-verification" content="zYqmL1Vu_SYx-_pZzqrRpOsSRHiuI6rcKt1P47XEHJY" />
  190. <link rel="stylesheet" type="text/css" href="style.css" />
  191. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  192. <meta charset="utf-8">
  193. <meta name="viewport" content="width=device-width, initial-scale=1">
  194. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  195. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  196. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  197. <meta name="google-site-verification" content="zYqmL1Vu_SYx-_pZzqrRpOsSRHiuI6rcKt1P47XEHJY" />
  198. </head>
  199. <body>
  200. <div class="modal-dialog">
  201. <div class="loginmodal-container">
  202. <h1>Register</h1><br>
  203. <form method="post" action="signup.php">
  204. <input type="text" name="username" placeholder="Username">
  205. <input type="email" name="email" placeholder="Email">
  206. <input type="password" name="password" placeholder="Password">
  207. <input type="password" name="password2" placeholder="Repeat Password">
  208. <input type="submit" name="register_btn" class="login loginmodal-submit" value="Register">
  209. </form>
  210.  
  211. <div class="login-help">
  212. <a href="#">Login</a>
  213. </div>
  214. </div>
  215. </div>
  216. <style>
  217. @import url(http://fonts.googleapis.com/css?family=Roboto);
  218.  
  219. /****** LOGIN MODAL ******/
  220. .loginmodal-container {
  221. padding: 30px;
  222. max-width: 350px;
  223. width: 100% !important;
  224. background-color: #F7F7F7;
  225. margin: 0 auto;
  226. border-radius: 2px;
  227. box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
  228. overflow: hidden;
  229. font-family: roboto;
  230. }
  231.  
  232. .loginmodal-container h1 {
  233. text-align: center;
  234. font-size: 1.8em;
  235. font-family: roboto;
  236. }
  237.  
  238. .loginmodal-container input[type=submit] {
  239. width: 100%;
  240. display: block;
  241. margin-bottom: 10px;
  242. position: relative;
  243. }
  244.  
  245. .loginmodal-container input[type=text], input[type=password], input[type=email] {
  246. height: 44px;
  247. font-size: 16px;
  248. width: 100%;
  249. margin-bottom: 10px;
  250. -webkit-appearance: none;
  251. background: #fff;
  252. border: 1px solid #d9d9d9;
  253. border-top: 1px solid #c0c0c0;
  254. /* border-radius: 2px; */
  255. padding: 0 8px;
  256. box-sizing: border-box;
  257. -moz-box-sizing: border-box;
  258. }
  259.  
  260. .loginmodal-container input[type=text]:hover, input[type=password]:hover {
  261. border: 1px solid #b9b9b9;
  262. border-top: 1px solid #a0a0a0;
  263. -moz-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
  264. -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
  265. box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
  266. }
  267.  
  268. .loginmodal {
  269. text-align: center;
  270. font-size: 14px;
  271. font-family: 'Arial', sans-serif;
  272. font-weight: 700;
  273. height: 36px;
  274. padding: 0 8px;
  275. /* border-radius: 3px; */
  276. /* -webkit-user-select: none;
  277. user-select: none; */
  278. }
  279.  
  280. .loginmodal-submit {
  281. /* border: 1px solid #3079ed; */
  282. border: 0px;
  283. color: #fff;
  284. text-shadow: 0 1px rgba(0,0,0,0.1);
  285. background-color: #4d90fe;
  286. padding: 17px 0px;
  287. font-family: roboto;
  288. font-size: 14px;
  289. /* background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#4d90fe), to(#4787ed)); */
  290. }
  291.  
  292. .loginmodal-submit:hover {
  293. /* border: 1px solid #2f5bb7; */
  294. border: 0px;
  295. text-shadow: 0 1px rgba(0,0,0,0.3);
  296. background-color: #357ae8;
  297. /* background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#4d90fe), to(#357ae8)); */
  298. }
  299.  
  300. .loginmodal-container a {
  301. text-decoration: none;
  302. color: #666;
  303. font-weight: 400;
  304. text-align: center;
  305. display: inline-block;
  306. opacity: 0.6;
  307. transition: opacity ease 0.5s;
  308. }
  309.  
  310. .login-help{
  311. font-size: 12px;
  312. }
  313. </style>
  314. </body>
  315. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement