Hi, I am pretty new to php and have been having trouble with this issue for quite some time now. I have inserted a username login on my website but can’t figure out how to display the member’s name after they login into the member’s area. Please help to look over this code. Thanks so much in advance.
<?php // Connects to your Database mysql_connect("", "", "") or die(mysql_error()); mysql_select_db("") or die(mysql_error()); //checks cookies to make sure they are logged in if(isset($_COOKIE['ID_my_site'])) { $myusername = $_COOKIE['ID_my_site']; $mypassword = $_COOKIE['Key_my_site']; $check = mysql_query("SELECT * FROM members WHERE username = '$myusername'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { //if the cookie has the wrong password, they are taken to the login page if ($mypassword != $info['password']) { header("Location: login2.php"); } //otherwise they are shown the admin area else { echo "Admin Area"; print "Welcome, "$session_myusername"
"; echo "Logout"; } } } else //if the cookie does not exist, they are taken to the login screen { header("Location: login2.php"); } ?>