Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include "inc/config.php";
- $error = "";
- if(isset($_POST["submit"]))
- {
- if(empty($_POST["username"]) || empty($_POST["password"]))
- {
- $error = "Abi lauki ir nepieciešami!";
- }else
- {
- $username=$_POST['username'];
- $password=$_POST['password'];
- $username = stripslashes($username);
- $password = stripslashes($password);
- $username = mysqli_real_escape_string($con, $username);
- $password = mysqli_real_escape_string($con, $password);
- $password = md5($password);
- $sql="SELECT id FROM users WHERE username='$username' and password='$password'";
- $result=mysqli_query($con,$sql);
- $row=mysqli_fetch_array($result,MYSQLI_ASSOC);
- if(mysqli_num_rows($result) == 1)
- {
- $_SESSION['username'] = $username;
- }
- }
- }
- if ((isset($_SESSION['username']) != ''))
- {
- header('Location: /dashboard');
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement