Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if(isset($_POST['username']) && isset($_POST['password'])){
- $dbc_form = mysqli_connect("localhost","root","","register");
- $username = $_POST['username'];
- $password = $_POST['password'];
- $query = "SELECT * FROM register WHERE username='$username' AND password='$password'";
- $result = mysqli_query($dbc_form,$query);
- if(mysqli_num_rows($result) == 1){
- $row = mysqli_fetch_array($result);
- $_SESSION['name'] = $row['name'];
- $_SESSION['login'] = "LOGGED IN";
- header("Location: index.php");
- }
- else{
- $_SESSION['error_msg'] = "Wrong uppgifter!";
- $_SESSION['login'] = "LOGGED OUT";
- header("Location: index.php");
- }
- }
- else{
- $_SESSION['error_msg'] = "Wrong information";
- header("Location: index.php");
- }
- ?>
Add Comment
Please, Sign In to add comment