Hey
Jeg har et login system som jeg ikke kan få til at virke
jeg får ingen fejl. men problemet er at når jeg går ind på side.
http://www.sabetoflex.dk/sider/admin/index.php vil den have mig til at downloade filen.
Ved ik hvad fejlen er.
Min Kode
<?
/* Check User Script */
session_start(); // Start Session
include 'mysql.php';
// Conver to simple variables
$username = $_POST['username'];
$password = $_POST['password'];
if((!$username) || (!$password)){
echo "Please enter ALL of the information! <br />";
exit();
}
// Convert password to md5 hash
$password = md5($password);
// check if the user info validates the db
$sql = mysql_query("SELECT * FROM admin WHERE username='$username' AND password='$password'");
$login_check = mysql_num_rows($sql);
if($login_check > 0){
while($row = mysql_fetch_array($sql)){
foreach( $row AS $key => $val ){
$$key = stripslashes( $val );
}
// Register some session variables!
session_register('first_name');
$_SESSION['first_name'] = $first_name;
session_register('last_name');
$_SESSION['last_name'] = $last_name;
session_register('email_address');
$_SESSION['email_address'] = $email_address;
session_register('special_user');
$_SESSION['user_level'] = $user_level;
header("Location: demo_strationer.php");
}
} else {
echo "You could not be logged in! Either the username and password do not match or you have not validated your membership!<br />
Please try again!<br />";
}
?>
<h1 align="center">Login Tak! </h1>
<p> </p>
<table width="200" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><form action="<?php $_SERVER['PHP_SELF'] ?>" method="post">
<strong>Brugernavn:</strong> <input type="text" name="username"/><br />
<strong>Password:</strong> <input type="password" name="password" class="input" /><br />
<br />
<br />
<div align="center"><input type="submit" name="login" value="Login" />
</div>
<br />
</form></td>
</tr>
</table>
Håber der nogle som kan hjælpe
Indlæg senest redigeret d. 01.12.2006 00:46 af Bruger #8516