Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //index.html
- <?php>
- session_start();
- ?>
- <!DOCTYPE html>
- <html lang="en" dir="ltr">
- <head>
- <meta charset="utf-8">
- <title></title>
- </head>
- <body>
- <div id="wrapper">
- <h2>Dis a forum yeeeeet</h2>
- <p>you arent allowed</p>
- <?php
- if(!isset($_SESSION['uid'])){
- echo "<form action='login_parse.php' method='post'>
- Username: <input type='text' name='realname' />
- Password: <input type='password' name='password' />
- <input type='submit' name='submit' value='Log In'/>";
- }else {
- echo "<p>You are logged in as ".$_SESSION['realname']."• <a href='logout_parse.php'>Logout</a>";
- }
- ?>
- </div>
- </body>
- </html>
- //connect.php
- <?php
- $dbhost = "axc.zapto.org";
- $dbusername = "authme";
- $dbpassword = "AndreiPufi2000*";
- $dbname = "authme";
- $con = mysqli_connect($dbhost, $dbname, $dbpassword, $dbusername);
- ?>
- //login_parse.php
- <?php
- session_start();
- include_once("connect.php");
- $sql = "SELECT username, password FROM authme";
- $result = mysqli_query($con,$sql) or die(mysqli_error($con));
- print_r($result);
- if(mysqli_num_rows($result)>0){
- $row = mysqli_fetch_assoc($result);
- $_SESSION['uid'] = $row['id'];
- $_SESSION['username'] = $row['realname'];
- $token = substr($row['password'],5,16);
- $a = hash('sha256', hash('sha256', $row['password']).$token);
- $password = '$SHA$'.$token.'$'.$a;
- echo $password."<br>";
- echo $row['password'];
- }
- ?>
Add Comment
Please, Sign In to add comment