Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- error_reporting(0);
- session_start();
- include("database.php");
- if(isset($_POST['login_button']))
- {
- $userName = mysqli_real_escape_string($con, $_POST['username']);
- $userPass = mysqli_real_escape_string($con, $_POST['password']);
- $hashedPass = hash('whirlpool', $userPass);
- $query = mysqli_query($con, "SELECT Ime, Lozinka, Confirmed FROM `Igraci` WHERE `Ime` = '$userName' AND `Lozinka` = '$hashedPass' AND `Confirmed` = '1'") or die(mysqli_error());
- $row = mysqli_num_rows($query);
- if($row > 0)
- {
- $_SESSION["ime_usera"] = $userName;
- setcookie("username", $_POST['username'], time()+3600*24);
- setcookie("authorization","ok");
- header( "Location:welcome.php");
- exit();
- }
- else
- {
- echo '
- </br><div class="flash_error">Podatci koje ste uneli nisu ispravni, ili vas racun nije aktiviran.</div>
- ';
- }
- }
- if(isset($_GET['logout']))
- {
- setcookie("username", "", time()-60);
- setcookie("authorization","");
- unset($_SESSION["ime_usera"]);
- header( "Location:index.php");
- exit(); # stop executing here
- }
- if($_SESSION["ime_usera"])
- {
- header ("Location:welcome.php");
- exit();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement