okay i just set up a php5 compliant login script, now i want each diffirent member to be redirected to a page to upload pictures to, i have the upload script, i just need a member recognition script.
members goto login page; done
login; done
after successful login get redirected to another page containing their photos; still in need
have ability to upload new photos, or delete old photos; done
logout; done
just something simple and quick, not fancy.
this is what i have to login.
- Code: Select all
/ Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// Define $myusername and $mypassword
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
// Register $myusername, $mypassword and redirect to file "login_success.php"
session_register("myusername");
session_register("mypassword");
header("location:login_success.php");
}
else {
echo "Wrong Username or Password";
}
ob_end_flush();
And this is to verify their logged in.
- Code: Select all
session_start();
if(!session_is_registered(myusername)){
header("location:photo_login.php");
}