Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- extract($_POST);
- $mysqli = new mysqli('localhost','root','', 'mobile-kart');
- if($mysqli->connect_errno > 0) {
- die('Unable to Connect to Database [' . $db->connect_errno . ']');
- }
- $query = "SELECT * FROM users WHERE username='$username' AND password='$password'";
- $result = $mysqli->query($query);
- $success = false;
- while($row = mysqli_fetch_array($result)) {
- $success = true;
- }
- setcookie ("login",$_POST["username"],time()+ (10 * 365 * 24 * 60 * 60));
- setcookie ("password",$_POST["password"],time()+ (10 * 365 * 24 * 60 * 60));
- session_start();
- $_SESSION["id"] = $username;
- if($success == true) {
- header("location:home1.php");
- }
- else {
- header("location:login2.php");
- }
- ?>
Add Comment
Please, Sign In to add comment