Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html >
- <head>
- <meta charset="UTF-8">
- <title>SheetPal Login</title>
- <link rel="stylesheet" href="css/style.css">
- </head>
- <body>
- <?php
- // Get values from html Form
- $username = $_POST["login-name"];
- $passwrod = $_POST["login-pass"];
- // to prevent mysql injection
- $username = stripcslashes($username);
- $password = stripcslashes($password);
- $username = mysql_real_escape_string($username);
- $password = mysql_real_escape_string($password);
- // connect to the server
- mysql_connect("54.194.99.165","ec2-user","pass");
- mysql_select_db("SheetPal");
- // Query
- $result = mysql_query("select * from users where username = '$username' and password = '$password')or die('Failed to query database '.mysql_error());
- $row = mysql_fetch_array($result);
- if($row[username] == $username && $row[password] == $password){
- echo 'Login success!! Welcome '.$row[username];
- }
- else {
- echo('Failed to login');
- }
- ?>
- <div class="login">
- <div class="login-screen">
- <div class="app-title">
- <h1>Login</h1>
- </div>
- <div class="login-form">
- <div class="control-group">
- <input type="text" class="login-field" value="" placeholder="username" id="login-name">
- <label class="login-field-icon fui-user" for="login-name"></label>
- </div>
- <div class="control-group">
- <input type="password" class="login-field" value="" placeholder="password" id="login-pass">
- <label class="login-field-icon fui-lock" for="login-pass"></label>
- </div>
- <a class="btn btn-primary btn-large btn-block" href="#">login</a>
- <a class="login-link" href="#">Lost your password?</a>
- </div>
- </div>
- </div>
- </body>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement