Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ob_start();
- session_start();
- require_once 'DATABASE.php';
- if ( isset($_SESSION['user'])!="" ) {
- header("Location: home");
- exit;
- }
- $error = false;
- if( isset($_POST['btn-login']) ) {
- $uname = trim($_POST['uname']);
- $uname = strip_tags($uname);
- $uname = htmlspecialchars($uname);
- $pass = trim($_POST['pass']);
- $pass = strip_tags($pass);
- $pass = htmlspecialchars($pass);
- if(empty($uname)){
- $error = true;
- $nameError = "Please enter your ingame name.";
- }
- if(empty($pass)){
- $error = true;
- $passError = "Please enter your password.";
- }
- if (!$error) {
- $password = hash("md5", $pass);
- $res=mysqli_query("SELECT Username, Passwort FROM USERDATA WHERE Username='$uname'");
- $row=mysqli_fetch_array($res);
- $count=mysqli_num_rows($res);
- if( $count == 1 && $row['userPass']==$password ) {
- $_SESSION['user'] = $row['Passwort'];
- header("Location: home");
- } else {
- $errMSG = "Incorrect Credentials, Try again...";
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement