Hey,
I have made a little script to check if the username and password exist in the database, but it does not seems to work. Is there anyone who can tell me what I'm doing wrong? Please by gentle in you respons I'm a newbie 🙂
NB. The password in the databasen is also encrypted.
Log-in Script--------------------------------------------------------------
<?php
include '../db.php';
if (isset($log_in)){
$dbCheck = mysql_query("SELECT user_name, user_password FROM users") or die(mysql_error());
$row_users = mysql_fetch_array($dbCheck);
for ($i=0; $i<count($row_users); $i++){
if ($indtastet_user_name==$row_users[user_name][$i] AND md5($indtastet_user_password)==$row_users[user_password][$i]){
$info = "You have now access!";
}
}
echo $info;
}
?>
<?php if (!$log_in){?>
<html>
<body>
<form method=post action=<?php echo $PHP_SELF;?>>
<input type="text" name="indtastet_user_name">
<input type="password" name="indtastet_user_password">
<button type="submit" name="log_in">Log In</button>
</form>
</body>
</html>
<?php }?>