Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host="localhost";
- $username="root";
- $pass="";
- $db_name="makanmulu";
- $tbl_name="user";
- //connect to server and select database
- mysql_connect("$host","$username","$pass")or die("cannot connect");
- mysql_select_db("$db_name")or die("cannot select DB");
- //username,password dan email sent from form
- $email=$_POST['email'];
- $password=$_POST['password'];
- $sql="SELECT * FROM $tbl_name WHERE email='$email' and password='$password'";
- $result=mysql_query($sql);
- $count=mysql_num_rows($result);
- if($count==1)
- {
- setcookie('data', json_encode(mysql_fetch_assoc($result)) );
- header("location:home.php");
- }
- else
- {
- echo "Wrong Email or Password";
- }
- ?>
Add Comment
Please, Sign In to add comment