Jump to content

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");
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.