Hi,
I get a parse error at line 118:
But I can't see the probPHP Code:<?php
include('config.php');
// connect to the mysql database server.
mysql_connect ($dbhost, $dbusername, $dbuserpass);
mysql_select_db($dbname) or die('Cannot select database');
if (isset($_COOKIE['BSComputersU']) && isset($_COOKIE['BSComputersP'])) {
header("Location: main.php");
}else{
if ($_POST['username']) {
//did they supply a password and username
$username=$_POST['username'];
$password=$_POST['password'];
if ($password==NULL) {
echo "<center>Du har ikke indtastet et kodeord!</center><br>
<center>
<h1>Login</h1>
<form action='check.php' method='POST'>
<table style='border:1px solid #000000;'>
<tr>
<td align='right'>
Brugernavn: <input type='text' size='15' maxlength='25' name='username'>
</td>
</tr>
<tr>
<td align='right'>
Kodeord: <input type='password' size='15' maxlength='25' name='password'>
</td>
</tr>
<tr>
<td align='center'>
<input type='submit' value='Login'>
</td>
</tr>
<tr>
<td align='center'>
<a href='register.php'>Opret bruger her</a>
</td>
</tr>
</table>
</form></center>
";
}else{
$query = mysql_query("SELECT username,password FROM users WHERE username = '$username'") or die(mysql_error());
$data = mysql_fetch_array($query);
if($data['password'] != md5($password)) {
echo "<center>Du har indtastet forkert brugernavn eller kodeord! Prøv igen<br><center>
<h1>Login</h1>
<form action='check.php' method='POST'>
<table style='border:1px solid #000000;'>
<tr>
<td align='right'>
Brugernavn: <input type='text' size='15' maxlength='25' name='username'>
</td>
</tr>
<tr>
<td align='right'>
Kodeord: <input type='password' size='15' maxlength='25' name='password'>
</td>
</tr>
<tr>
<td align='center'>
<input type='submit' value='Login'>
</td>
</tr>
<tr>
<td align='center'>
<a href='register.php'>Opret bruger her</a>
</td>
</tr>
</table>
</form></center>
</center>";
}else{
if (isset($_POST['husklogin'])){
setcookie('BSComputersU', $username, time() + 3600 * 24 * 365);
setcookie('BSComputersP', $password, time() + 3600 * 24 * 365);
$query = mysql_query("SELECT username,password FROM users WHERE username = '$username'") or die(mysql_error());
$row = mysql_fetch_array($query);
$_SESSION["s_username"] = $row['username'];
header("Location: index.php");
}
}
}
?>
<script language="javascript" type="text/javascript">
function createRequestObject()
{
var request_o; //declare the variable to hold the object.
var browser = navigator.appName; //find the browser name
if(browser == "Microsoft Internet Explorer"){
/* Create the object using MSIE's method */
request_o = new ActiveXObject("Microsoft.XMLHTTP");
}else{
/* Create the object using other browser's method */
request_o = new XMLHttpRequest();
}
return request_o; //return the object
}
var http = createRequestObject();
function destorySession()
{
try
{
http.open('get', 'destroy.php');
http.send(null);
}
catch(Exception)
{
http = createRequestObject();
destorySession();
}
}
window.onunload = destorySession();
</script>![]()




Reply With Quote