![]() |
|
|
|
| ||||||
|
Welcome to the The ProgrammersTalk Community forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| Tags: how to, php, retrieve data, sql |
![]() |
![]() | | LinkBack | Thread Tools | Display Modes | ![]() |
| |
| |||
| Do not pull down the values and compare, let the SQL do the compare for you. For instance: $sql = "SELECT UserID FROM User WHERE Username = ".mysql_real_escape_string($username)." AND Password = ".mysql_real_escape_string($password); This would pull back all records that matched if Database Username = the Supplied Username and Database Password = Supplied Password. Then if you have 0 records... it did not validate, but if you have more than 0 records (if you have 1 record rather), then they successfully validated ![]() __________________ Day Cares | Golf Courses | Disc Golf Courses | Campgrounds | Ice Rinks | Paintball Fields | Dentists | Plastic Surgeons | Aging Jokes Catholic Churches | Lutheran Churches | Methodist Churches | Episcopal Churches | Clean Jokes |
| ||||
| Is it possible to have more than 1 record? That's only possible if there are double username and everything on my database right..? |
| The Following User Says Thank You to HelloWorld For This Useful Post: | ||
TeraTask (06-28-2007) | ||
| ||||
| It is possible only if there are 2 records that have the same username and password. But I think what you are trying to do is user registeration application right? so two same usernames are not allowed ![]() From siLenTz search search... |
| The Following User Says Thank You to siLenTz For This Useful Post: | ||
TeraTask (06-28-2007) | ||
| ||||
| The username field should be either unique or the primary key. That will enforce integrity rules on a system. Generally speaking the whole point of a username is to have a unique identifier. ccoonen: You should check out my article on MySQL injection protection at TUTORIAL: MySQL Injection Attack Prevention in PHP . You're using mysql_real_escape_string which has a few limitations (noted on the php.net site too). |
| The Following User Says Thank You to TeraTask For This Useful Post: | ||
ccoonen (06-28-2007) | ||
![]() |
| Thread Tools | |
| Display Modes | |
| |