General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 28th, 2004, 02:26 AM
Alicia Alicia is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 117 Alicia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 29 sec
Reputation Power: 6
matching prob

hi guys,

i used this code to validate whether username and password are valid or not before allow the visitors to access members' area,,, but the problem is now it seems like only check the password and not username... even i simply put a username but with a valid password, i am allow to access the section as well.. did i miss something in my code ??? why it doesn't match the username and password ??

my code:
$sql = mysql_query("SELECT * FROM `info` WHERE `username`='$username' AND `password`='$password'") or die(mysql_error());
//$login_check = mysql_num_rows($sql);

if(mysql_num_rows($sql)>0){


please advise..

Reply With Quote
  #2  
Old January 28th, 2004, 07:45 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
Print out your query and run it manually to see if you get the same results.

Reply With Quote
  #3  
Old January 28th, 2004, 07:53 AM
aboyousif aboyousif is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Tanta, Egypt
Posts: 21 aboyousif User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 29 m 23 sec
Reputation Power: 0
Send a message via AIM to aboyousif Send a message via MSN to aboyousif Send a message via Yahoo to aboyousif
PHP Code:
<?
if ($_POST['action']=="submitted") {
$username=$_POST['user1'];
$password=$_POST['passwd1'];
$link mysql_connect(hostrootdbpwd) or die("Could not connect: " mysql_error());
mysql_select_db(dbasename) or die("could not get database: " mysql_error() );
$authorsql="select * from authors where user = '$username' "   ;
$result mysql_query($authorsql) or die ("Bad Query :"mysql_error() );
$row mysql_fetch_assoc($result);
if (
mysql_num_rows($result) > ){
echo 
"Welcome:" $row["user"]."<br>";
if (
md5($password)== $row["passwd"] ){
echo 
"Your Password is correct<br>";
echo 
"going to the member area...";
$true=md5("true");
echo 
"<meta http-equiv=\"Refresh\" content=\"1;URL=admin.php?s=$true\">";

}
else
{
echo 
"Error .. Cannot Enter the members area";
}
}
else {
echo 
"Error .. Cannot Enter the members area ";
}
mysql_free_result($result);
    
mysql_close($link);
    }
?>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > matching prob


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT