Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- //Informatie database
- $host = "localhost";
- $username = "linh7219_kennes";
- $password = "BagHera2";
- $db_name = "linh7219_test";
- $tbl_name = "members";
- //connect to database
- mysql_connect($host, $username, $password) or die ("can't connect");
- mysql_select_db($db_name) or die ("can't select database");
- //login
- $myusername = mysql_real_escape_string($_POST['myusername']);
- $mypassword = mysql_real_escape_string($_POST['mypassword']);
- $sql = "SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword' LIMIT 1";
- $result = mysql_query($sql);
- $count = mysql_num_rows($result);
- if($count==1) {
- session_start();
- $_SESSION['myusername'] = $myusername;
- $_SESSION['mypassword'] = $mypassword;
- header("Location: login_succes.php"); // Should this be success not succes?
- exit();
- }
- else {
- echo "Wrong Username or Password" or die ("cant connect");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement