Hej
Jeg har lavet følgende login script
login.php:
<html>
<head>
<title>Admin login - Only access for autorized users</title>
</head>
<body>
<center></center>
<h1>Admin login</h1>
<h2>Only access for known users, if you are not a known user then please return to <a href="/index.php">
Piraten.dk</a></h2><br><br>
<h2>Kun adgang for kendte brugere, hvis du ikke er en administrator, gå da venligst tilbage til <a href="
/index.php">Piraten.dk</a></h2><br><br>
<form action="login-test.php" action="post">
Username: <input type="text" name="username" class="input"><br>
Password: <input type="password" name="password" class="input"><br>
<input type="submit" name="submit" value="submit" class="input"><br>
</form>
<br>
<br>
<i>© Nichlas Larsson - <a href="mailto:strandvangsvej@pc.dk">Mail</a> - www.piraten.dk</i>
</center>
</body>
</html>
login-test.php:
<?
// Login test
include ("config.php") ;
$submit = $_POST['submit'];
if (!isset($submit)) {
header("Location: /system/login.php");
exit;
} else {
$username = $_POST['username'];
$password = $_POST['password'];
$conn = mysql_connect($host, $user, $pass);
mysql_select_db($db);
$query = mysql_query("SELECT Id FROM system-login WHERE username='$username' AND password='$password'");
if (!isset($query)) {
echo "No matching user, please try again<br>";
echo "<a href='/system/login.php'>Log in</a><br>";
exit;
}
$number = mysql_num_rows($query);
if ($number == 1) {
echo "Du er nu logget ind og kan fortsætte videre med administrator rettigheder<br>";
echo "<a href='system.php'>Control Panel</a><br>";
$_SESSION['login'] = 1;
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;
$ip = $_SERVER['REMOTE_ADDR'];
// Smider info i en log-database
$insert = mysql_query("INSERT INTO system-ip WHERE ip='$ip', username='$username', password='$password', date=now()");
mysql_close($conn);
} else {
echo "Du er ikke logget ind, prøv venligst igen<br>";
echo "No matching user, please try again<br>";
echo "<a href='/system/login.php'>Log in</a><br>";
}
?>
Jeg får følgende fejl:
Parse error: parse error, unexpected $ in e:\\website\\system\\login-test.php on line 51
Linie 51 i scriptet ser sådan her ud:
?>
Hvordan kan det være ? Der er jo ikke nogen variabel i linie 51 !!!
mvh
Nichlas