: HELP! my login session is returning the users password instead of their username! I have my code set up to display the username in the nav bar however its displaying their password? nav.php
I have my code set up to display the username in the nav bar however its displaying their password?
nav.php
<li>
<a href class="userName"><?php echo $_SESSION['userName'];?></a>
</li>
connectivity.php
function SignIn()
{
session_start(); //starting the session for user profile page
if(!empty($_POST['user'])) //checking the 'user' name which is from Sign-In.html, is it empty or have some text
{
$user = $_POST[user];
$pass = $_POST[pass];
$query = "SELECT * FROM UserName where userName = '$user' AND pass = '$pass'";
$query = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($query) or die(mysql_error());
if(!empty($row['userName']) AND !empty($row['pass']))
{
$_SESSION['userName'] = $row['pass'];
header("location: ../PHP/Cart.php");
} else {
echo "SORRY... YOU ENTERD WRONG ID AND PASSWORD... PLEASE RETRY...";
}
}
}
if(isset($_POST['submit']))
{
SignIn();
}
in the nav.php you can see its echoing the $_SESSION['userName'] however its displaying their password?
More posts by @Cofer257
1 Comments
Sorted by latest first Latest Oldest Best
This must be a clue:
$_SESSION['userName'] = $row['pass'];
You should also enable full error_reporting whilst developing. (It will throw up some other warnings.)
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.