Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- login.php:
- <?php
- $homepage = file_get_contents('http://www.browse-easy.cf/header.php');
- echo $homepage;
- ?>
- <?php
- session_start();
- // connect to database
- $db = new mysqli('mysql.hostinger.ph', 'u978812116_data', 'miguel039', 'u978812116_data');
- if (isset($_POST['login_btn'])) {
- $username = mysql_real_escape_string($_POST['username']);
- $password = mysql_real_escape_string($_POST['password']);
- $password = md5($password); // remember we hashed password before storing last time
- $sql = "SELECT * FROM users WHERE username='$username' AND password='$password'";
- $result = mysqli_query($db, $sql);
- if (mysqli_num_rows($result) == 1) {
- $_SESSION['message'] = "You are now logged in";
- $_SESSION['username'] = $username;
- header("location: home.php"); //redirect to home page
- }else{
- $_SESSION['message'] = "Username/password combination incorrect";
- }
- }
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Browse Easy - Home</title>
- <meta name="google-site-verification" content="zYqmL1Vu_SYx-_pZzqrRpOsSRHiuI6rcKt1P47XEHJY" />
- <link rel="stylesheet" type="text/css" href="style.css" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
- <meta name="google-site-verification" content="zYqmL1Vu_SYx-_pZzqrRpOsSRHiuI6rcKt1P47XEHJY" />
- </head>
- <body>
- <div class="modal-dialog">
- <div class="loginmodal-container">
- <h1>Login to Your Account</h1><br>
- <form>
- <input type="text" name="usename" placeholder="Username">
- <input type="password" name="password" placeholder="Password">
- <input type="submit" name="login_btn" class="login loginmodal-submit" value="Login">
- </form>
- <div class="login-help">
- <a href="#">Register</a> - <a href="#">Forgot Password</a>
- </div>
- </div>
- </div>
- <style>
- @import url(http://fonts.googleapis.com/css?family=Roboto);
- /****** LOGIN MODAL ******/
- .loginmodal-container {
- padding: 30px;
- max-width: 350px;
- width: 100% !important;
- background-color: #F7F7F7;
- margin: 0 auto;
- border-radius: 2px;
- box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
- overflow: hidden;
- font-family: roboto;
- }
- .loginmodal-container h1 {
- text-align: center;
- font-size: 1.8em;
- font-family: roboto;
- }
- .loginmodal-container input[type=submit] {
- width: 100%;
- display: block;
- margin-bottom: 10px;
- position: relative;
- }
- .loginmodal-container input[type=text], input[type=password] {
- height: 44px;
- font-size: 16px;
- width: 100%;
- margin-bottom: 10px;
- -webkit-appearance: none;
- background: #fff;
- border: 1px solid #d9d9d9;
- border-top: 1px solid #c0c0c0;
- /* border-radius: 2px; */
- padding: 0 8px;
- box-sizing: border-box;
- -moz-box-sizing: border-box;
- }
- .loginmodal-container input[type=text]:hover, input[type=password]:hover {
- border: 1px solid #b9b9b9;
- border-top: 1px solid #a0a0a0;
- -moz-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
- -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
- box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
- }
- .loginmodal {
- text-align: center;
- font-size: 14px;
- font-family: 'Arial', sans-serif;
- font-weight: 700;
- height: 36px;
- padding: 0 8px;
- /* border-radius: 3px; */
- /* -webkit-user-select: none;
- user-select: none; */
- }
- .loginmodal-submit {
- /* border: 1px solid #3079ed; */
- border: 0px;
- color: #fff;
- text-shadow: 0 1px rgba(0,0,0,0.1);
- background-color: #4d90fe;
- padding: 17px 0px;
- font-family: roboto;
- font-size: 14px;
- /* background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#4d90fe), to(#4787ed)); */
- }
- .loginmodal-submit:hover {
- /* border: 1px solid #2f5bb7; */
- border: 0px;
- text-shadow: 0 1px rgba(0,0,0,0.3);
- background-color: #357ae8;
- /* background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#4d90fe), to(#357ae8)); */
- }
- .loginmodal-container a {
- text-decoration: none;
- color: #666;
- font-weight: 400;
- text-align: center;
- display: inline-block;
- opacity: 0.6;
- transition: opacity ease 0.5s;
- }
- .login-help{
- font-size: 12px;
- }
- </style>
- </body>
- </html>
- register.php:
- <?php
- session_start();
- //Connect To Database
- $db = new mysqli('mysql.hostinger.ph', 'u978812116_data', 'miguel039', 'u978812116_data');
- $homepage = file_get_contents('http://www.browse-easy.cf/header2.php');
- echo $homepage;
- if (isset($_POST['register_btn'])) {
- $username = mysql_real_escape_string($_POST['usermame']);
- $email = mysql_real_escape_string($_POST['email']);
- $password = mysql_real_escape_string($_POST['password']);
- $password2 = mysql_real_escape_string($_POST['password2']);
- if ($password == $password2) {
- // create user
- $password = md5($password);
- $sql = "INSERT INTO users(username, email, password) VALUES('$username', '$email', '$password')";
- mysqli_query($db, $sql);
- $_SESSION = "You are now logged in";
- $_SESSION = $username;
- header("location: home.php");
- }else{
- $_SESSION['The two passwords do not match'];
- }
- }
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Browse Easy - Home</title>
- <meta name="google-site-verification" content="zYqmL1Vu_SYx-_pZzqrRpOsSRHiuI6rcKt1P47XEHJY" />
- <link rel="stylesheet" type="text/css" href="style.css" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
- <meta name="google-site-verification" content="zYqmL1Vu_SYx-_pZzqrRpOsSRHiuI6rcKt1P47XEHJY" />
- </head>
- <body>
- <div class="modal-dialog">
- <div class="loginmodal-container">
- <h1>Register</h1><br>
- <form method="post" action="signup.php">
- <input type="text" name="username" placeholder="Username">
- <input type="email" name="email" placeholder="Email">
- <input type="password" name="password" placeholder="Password">
- <input type="password" name="password2" placeholder="Repeat Password">
- <input type="submit" name="register_btn" class="login loginmodal-submit" value="Register">
- </form>
- <div class="login-help">
- <a href="#">Login</a>
- </div>
- </div>
- </div>
- <style>
- @import url(http://fonts.googleapis.com/css?family=Roboto);
- /****** LOGIN MODAL ******/
- .loginmodal-container {
- padding: 30px;
- max-width: 350px;
- width: 100% !important;
- background-color: #F7F7F7;
- margin: 0 auto;
- border-radius: 2px;
- box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
- overflow: hidden;
- font-family: roboto;
- }
- .loginmodal-container h1 {
- text-align: center;
- font-size: 1.8em;
- font-family: roboto;
- }
- .loginmodal-container input[type=submit] {
- width: 100%;
- display: block;
- margin-bottom: 10px;
- position: relative;
- }
- .loginmodal-container input[type=text], input[type=password], input[type=email] {
- height: 44px;
- font-size: 16px;
- width: 100%;
- margin-bottom: 10px;
- -webkit-appearance: none;
- background: #fff;
- border: 1px solid #d9d9d9;
- border-top: 1px solid #c0c0c0;
- /* border-radius: 2px; */
- padding: 0 8px;
- box-sizing: border-box;
- -moz-box-sizing: border-box;
- }
- .loginmodal-container input[type=text]:hover, input[type=password]:hover {
- border: 1px solid #b9b9b9;
- border-top: 1px solid #a0a0a0;
- -moz-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
- -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
- box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
- }
- .loginmodal {
- text-align: center;
- font-size: 14px;
- font-family: 'Arial', sans-serif;
- font-weight: 700;
- height: 36px;
- padding: 0 8px;
- /* border-radius: 3px; */
- /* -webkit-user-select: none;
- user-select: none; */
- }
- .loginmodal-submit {
- /* border: 1px solid #3079ed; */
- border: 0px;
- color: #fff;
- text-shadow: 0 1px rgba(0,0,0,0.1);
- background-color: #4d90fe;
- padding: 17px 0px;
- font-family: roboto;
- font-size: 14px;
- /* background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#4d90fe), to(#4787ed)); */
- }
- .loginmodal-submit:hover {
- /* border: 1px solid #2f5bb7; */
- border: 0px;
- text-shadow: 0 1px rgba(0,0,0,0.3);
- background-color: #357ae8;
- /* background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#4d90fe), to(#357ae8)); */
- }
- .loginmodal-container a {
- text-decoration: none;
- color: #666;
- font-weight: 400;
- text-align: center;
- display: inline-block;
- opacity: 0.6;
- transition: opacity ease 0.5s;
- }
- .login-help{
- font-size: 12px;
- }
- </style>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement