tet3828 Posted November 10, 2006 Share Posted November 10, 2006 I have this small script here. It has me pretty confused. I have a mysql table 'users'. I've stored these values for one user:userPass (password)userName (user login ID)userFirst(users first name)along with some other valuse that have no bearing on my question...any way I am using a flash projector that is using $_GET to pass the userName and userPass over to the following script.[code]if (! isset($_SESSION['name'])) { if(isset($_GET['userName'])) { $userName = $_GET['userName']; $userPass = $_GET['userPass']; mysql_connect("mysql213.secureserver.net","*****","*****"); mysql_select_db("shell3828"); $query = "SELECT nameFirst FROM users WHERE userName='$userName' AND userPass='$userPass'"; $result = mysql_query($query); if (mysql_numrows($result) == 1) { $_SESSION['name'] = mysql_result($result,0,"nameFirst"); $_SESSION['username'] = mysql_result($result,0,"userName"); echo "You're logged in."; } } else { echo "You must enter a password/username before accessing this page. Please launch LOGIN.EXE from your desktop."; }} else { $userName = $_SESSION['name']; echo "Welcome back $Username";}[/code]The problem is when I log on with the correct password and user name I get this warning....[code]Warning: mysql_result(): userName not found in MySQL result index 2 in /home/content/t/e/t/tetunity/html/shell/data/index.php on line 19You're logged in. \\\but it does log the user in.[/code]to make this more confusing... when I log in with the incorrect login information it goes to my "welcome back" echo.however when I attempt to login with no information it does display the "You must enter a password/username before accessing ...." echo message.any suggestions on how I can get this script properly? Where did I go wrong here? Link to comment https://forums.phpfreaks.com/topic/26883-sessions-thru-mysql-bumped/ Share on other sites More sharing options...
tet3828 Posted November 11, 2006 Author Share Posted November 11, 2006 *bump* help if you can. thanks Link to comment https://forums.phpfreaks.com/topic/26883-sessions-thru-mysql-bumped/#findComment-122950 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.