Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // INDEX.PHP
- <?php
- session_start();
- if(isset($_SESSION['user'])){
- header('Location: panel.php');
- }
- ?>
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8"/>
- <title>ALPHAMMO</title>
- <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,800' rel='stylesheet' type='text/css'>
- <link href="css/Loginbootstrap.min.css" rel="stylesheet">
- <style type="text/css">
- body {
- color: #5e6d81;
- background: #eaedf1;
- }
- input[type="text"], input[type="password"] {
- font-family: 'Open Sans', sans-serif;
- font-size: 18px;
- padding: 16px 0 16px 10px;
- background: #fff;
- border: 0;
- box-shadow: none;
- width: 77%;
- outline: none;
- }
- input[type="submit"] {
- font-family: 'Open Sans', sans-serif;
- font-size: 20px;
- margin: 10px 0 0 0;
- padding: 16px 0;
- width: 100%;
- color: #fff;
- background: #ff3333;
- border: 0;
- border-radius: 4px;
- }
- input[type="submit"]:hover {
- background: #ff4433;
- }
- input[type="text"]::-webkit-input-placeholder, input[type="password"]::-webkit-input-placeholder {
- color: #dbe1e8;
- }
- input[type="text"]:-moz-placeholder, input[type="password"]:-moz-placeholder {
- color: #dbe1e8;
- }
- input[type="text"]::-moz-placeholder, input[type="password"]::-moz-placeholder {
- color: #dbe1e8;
- }
- .login {
- width: 300px;
- margin: 100px auto;
- }
- .input-prepend {
- width: 100%;
- margin: 0 0 10px 0;
- }
- .input-prepend .add-on {
- color: #5e6d81;
- font-size: 18px;
- font-weight: bold;
- width: 20%;
- padding: 16px 0;
- background: #9ea7b3;
- border: 0;
- }
- </style>
- </head>
- <body>
- <div class="login">
- <?php
- if($error == 1){
- echo '<p class="alert alert-danger">ACESSO NEGADO!</p>';
- }else if($error == 2){
- echo '<p class="alert alert-danger">ÁREA RESTRITA</p>';
- }else if($error == 3){
- echo '<p class="alert alert-warning">DESLOGADO!</p>';
- }
- ?>
- <form method="post" action="processLogin.php">
- <div class="input-prepend">
- <span class="add-on"><img src="img/user.png" /></span>
- <input class="" id="prependedUsername" type="text" placeholder="E-Mail" name="user">
- </div>
- <div class="input-prepend">
- <span class="add-on"><img src="img/lock.png" /></span>
- <input class="" id="prependedPassword" type="password" placeholder="Senha" name="pass">
- </div>
- <div class="controls">
- <input type="submit" value="Entrar" />
- </div>
- </form>
- </div>
- </body>
- </html>
- // PROCESS LOGIN.PHP
- <?php
- //Inclusão das classes.
- require_once('class/init.php');
- session_start();
- //Conexão com base de dados.
- $pdo = openConnection();
- $user = $_POST['user'];
- $pass = $_POST['pass'];
- $pass = md5('g5sc4gs1fz0h'.$pass);
- //Autentica o usuário
- $auth = new Authentication($pdo);
- if($auth->authUser($user, $pass)){
- header('Location: panel.php');
- }else{
- header('Location: index.php?error=1');
- };
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement