So I want the code to allow the user to login and then direct them to their page, I'm just not sure how I can do that. Here's the table and code I have, is there a way to make "header("location:/instacp.htm");" pull the location from the table in the database?
Table:
id username password location
1 12345 123456 /instacp.htm
<?php
$host="localhost";
$username="blaa";
$password="blaa";
$db_name="blaa_members";
$tbl_name="members";
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count==1){
session_register("myusername");
session_register("mypassword");
header("location:/instacp.htm");
}
else {
echo "Wrong Username or Password";
}
?>