Jump to content

help with displaying a $_session_register


luvz2drv

Recommended Posts

[code] // Define $myusername and $mypassword
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];

$sql="SELECT * FROM members 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 "index.php"

session_register("myusername") or die('session register myusername didnt work');
session_register("mypassword") or die('session register mypassword didnt work');
header("location:index.php");

}
else {
echo "Wrong Username or Password <META HTTP-EQUIV=\"refresh\" content=\"2; URL=index.php\"> ";
}

ob_end_flush();
?>[/code]

What I want to do -- is display the username that is verfied  -- any help with that

thanks..
Link to comment
https://forums.phpfreaks.com/topic/32909-help-with-displaying-a-_session_register/
Share on other sites

echo "Wrong Username or Password <META HTTP-EQUIV=\"refresh\" content=\"2; URL=index.php\"> ";

remember meta tags shoudl go in the head section of your site.

as for register

just use this

if($count==1){
// Register $myusername, $mypassword and redirect to file "index.php"

$_SESSION['myusername'] = $myusername;
$_SESSION['mypassword'] = $mypassword;
header("location:index.php");

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.