Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host="localhost";
- $username="root";
- $password="alexi";
- $db_name="users";
- $tbl_name="accounts";
- mysql_connect("$host", "$username", "$password")or die("cannot connect");
- mysql_select_db("db_name")or die("cannot select DB");
- $username=$_POST['username'];
- $password=$_POST['password'];
- $sql="SELECT * FROM $tbl_name WHERE username='$username' and password='$password'";
- $result=mysql_query($sql);
- $count=mysql_num_rows($result);
- if($count==1){
- session_register("username");
- session_register("password");
- header("location.login_sucess.php");
- }
- else {
- echo "Wrong!";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement