luvz2drv Posted January 4, 2007 Share Posted January 4, 2007 [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 rowif($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.. Quote Link to comment https://forums.phpfreaks.com/topic/32909-help-with-displaying-a-_session_register/ Share on other sites More sharing options...
ToonMariner Posted January 4, 2007 Share Posted January 4, 2007 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 registerjust use thisif($count==1){// Register $myusername, $mypassword and redirect to file "index.php"$_SESSION['myusername'] = $myusername;$_SESSION['mypassword'] = $mypassword;header("location:index.php"); Quote Link to comment https://forums.phpfreaks.com/topic/32909-help-with-displaying-a-_session_register/#findComment-153192 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.