Author Topic: how to read username password combos from a database to verify?  (Read 220 times)

Jamesbarner

  • Guest




Hi,

my goal is to be able to create a web based interface for someone who has no programming skills or interest to be able to maintain a list of usernames and passwords for protecting a page of links on a website.

so, I've created a page that can write to a database, and I can see that it is working, I can read entries, etc.

now, I need to know how to make a script that will check against that database for valid UN/PW combinations.

what is the best method for this?



this is the script for writing to the database. 







<?include("dbinfo.inc.php");
mysql_connect($servname,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM $newdbname WHERE id='$id'";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();

$i=0;
while ($i < $num) {
$username=mysql_result($result,$i,"username");
$password=mysql_result($result,$i,"password");
$real_name=mysql_result($result,$i,"real_name");

?>

<form action="updated.php">
<input type="hidden" name="ud_id" value="<? echo "$id"; ?>">
Real Name: <input type="text" name="ud_first" value="<? echo "$real_name"?>"><br>
Username: <input type="text" name="ud_last" value="<? echo "$username"?>"><br>
Password: <input type="text" name="ud_phone" value="<? echo "$password"?>"><br>

<input type="Submit" value="Update">
</form>

<?
++$i;
}

?>