Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: Authentication breaks down only on some


Message #1 by Jefferis Peterson <jefferis@p...> on Fri, 13 Dec 2002 09:28:03 -0500
Hi, 
I'm having trouble with a password access system that is allowing some
usrname/passwords to work but others not,  and I can't see anything in the
code that would create this problem. I thought it might be line length, but
some longer ones seem to work while others don't.

> <?  require("/path to/.connect/connect1.php");
>  ?>
>  <?  
>       $db = mysql_select_db($g_databasename,$con);
> 
>       $sql=sprintf("select userid from users where username=\"%s\" and
> pwrd=\"%s\"  
> and active=1",$uid,$pwd);
>       $res=mysql_query($sql,$con);
> 
>       if ((mysql_num_rows($res)!=0)&&($uid!=""))
>   {  
> 
>       $row=mysql_fetch_row($res);
> 
> 
>       //cleanup  
>       $sql=sprintf("delete from sessions where
> ipaddress=\"%s\"",$REMOTE_ADDR);
>       mysql_query($sql,$con);
> 
>       //make a new session
>       $sql=sprintf("insert into sessions (userid, ipaddress) values
> (%s,\"%s\")",$row
> [0],$REMOTE_ADDR);
> 
>       mysql_query($sql,$con);

My connect script is :
> <?
> $hostname = "db15.pair.com";
> $user = "username";
> $password = "password";
> $database = "jefferis_servant";
> $g_databasename = "jefferis_servant";
> mysql_connect($hostname, $user, $password);
> $con = mysql_connect($hostname,$user,$password);
> mysql_select_db($database);
> $g_uservalidator_email="passwords@p..." ;
> $remail= "repassword@p...";
> ?>

Any ideas? 

My user database seems to store and input the names correctly and assign
user names and passwords okay....

Thanks a lot,
Jeff

~~~~~~~~~~~~
Jefferis Peterson, Pres.
Web Design and Marketing
http://www.PetersonSales.com
Tel .  xxx-xxx-xxxx
ICQ 19112253

"One man gives freely, yet grows all the richer; another withholds what he
should give, and only suffers lack." -  Proverbs 11:24 


  Return to Index