Login Script...

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Faith
Forum Newbie
Posts: 7
Joined: Sun Mar 14, 2004 10:30 pm

Login Script...

Post by Faith »

Ok, i'm having trouble with my login script... perhaps someone can help me out. Below is the script I currently have....

Code: Select all

<?php 
$dbh=mysql_connect ("localhost", "equestra_test", "password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("equestra_members"); 
$username = $HTTP_POST_VARS&#1111;'txtName'];
$password = $HTTP_POST_VARS&#1111;'txtPassword'];
$rs = mysql_query("SELECT * FROM myUsers WHERE Name = '$username' AND Password = '$password' ");//if the user exists if (mysql_num_rows($rs)>0)&#123;  //make a cookie for the user  setcookie("loginname",$username);&#125; ?>
If anyone can help me in any way that'd be very helpful :)
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

and waht doesn't work about it??
Faith
Forum Newbie
Posts: 7
Joined: Sun Mar 14, 2004 10:30 pm

ummm

Post by Faith »

When you type in the stuff it asks for you get an error message... or a blank screen lol...
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

what error message??
Faith
Forum Newbie
Posts: 7
Joined: Sun Mar 14, 2004 10:30 pm

this...

Post by Faith »

I'm getting this message:
Parse error: parse error in /home/equestra/public_html/game/phpstuff2/login.php on line 8
User avatar
bawla
Forum Contributor
Posts: 116
Joined: Fri Mar 19, 2004 9:15 am

Post by bawla »

wuts line 8 of ur script?
Faith
Forum Newbie
Posts: 7
Joined: Sun Mar 14, 2004 10:30 pm

hm..

Post by Faith »

Good question...
User avatar
bawla
Forum Contributor
Posts: 116
Joined: Fri Mar 19, 2004 9:15 am

Post by bawla »

if you open you .php file with notepad and go to edit and "Go To" and u choose your line it will take you to it or with any php editor it has the line numbers on the side
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

im guesing this second line is line 8, and it looks pretty shady!!

Code: Select all

$rs = mysql_query("SELECT * FROM myUsers WHERE Name = '$username' AND Password = '$password' ");//if the user exists if (mysql_num_rows($rs)>0){  //make a cookie for the user
you have that whole thing in comment. try this:

Code: Select all

$rs = mysql_query("SELECT * FROM myUsers WHERE Name = '$username' AND Password = '$password' ");//if the user exists
if (mysql_num_rows($rs)>0){  //make a cookie for the user
Post Reply