1234567891011121314151617181920212223242526 |
- <?php
- include("connectionDb.php");
- session_start();
-
-
- $username = $_POST["uname"];
- $password = $_POST["password"];
- $sql = "SELECT * FROM user WHERE password='$password' AND name='$username' ";
- $ret = $db->query($sql);
- while($row = $ret->fetchArray() ){
- print_r($row);
- $uname=$row["name"];
- $pwd=$row['password'];
-
- }
- if ($pwd==$_POST["password"] && $uname==$_POST["uname"]){
- $_SESSION["login"]=$uname;
- header('Location: main.php');
- }
- else{
- $_SESSION['errors'] = array("Your username or password was incorrect.");
- header("Location:index.php");
- }
- ?>
|