Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // MySQL settings
- $host = "localhost";
- $username = "root";
- $password = "";
- $database_name = "php-cms";
- $table_name = "members";
- // Connect to mysql server
- mysql_connect($host, $username, $password)
- or die(mysql_error());
- mysql_select_db("database_name")
- or die(mysql_error());
- // Username and Password form
- $username = mysql_real_escape_string($_POST['username']);
- $password = mysql_real_escape_string($_POST['password']);
- // Query
- $result = mysql_query("SELECT * FROM ".$table_name." WHERE `username`='".$username."' AND `password`='".$password."'") or die(mysql_error());
- $count = mysql_num_rows($result);
- if($count == 1)
- {
- seesion_start("username");
- seesion_start"password");
- header("Location: success.php");
- }
- else
- {
- echo "wrong username or password";
- }
- ?>
Add Comment
Please, Sign In to add comment