Login page...

Hi all, I need to have this:

I Have a login script but if anybody login, He needs to stay logged in, Can anybody help me with it? My login is:

[php]

Inloggen

<?php if ($paswoord_db === md5($password)) { session_start(); $_SESSION['username'] = $username; $_SESSION['password'] = $password; session_write_close(); if (isset($_SESSION['id']) setcookie("username", $_SESSION['username'] , time() + 2419200); setcookie("password", $_SESSION['password'] , time() + 2419200); } if(isset($_SESSION['id'])){ ?>
Je bent al ingelogd!

<?php

}else{

if(isset($_POST[‘submit’])){

$uQuery = mysql_query(“SELECT * FROM users WHERE username = '” . mysql_real_escape_string($_POST[‘username’]) . “’ AND password = '” . md5($_POST[‘password’]) . “’”) or die(mysql_error());
$uFetch = mysql_fetch_assoc($uQuery);

if($uFetch[‘type’] == 4){

echo ‘

Je bent verwijderd van site-city.
’;

}elseif($uFetch[‘banned_until’] != ‘0000-00-00 00:00:00’ and $uFetch[‘banned_until’] >= date(‘Y-m-d H:i:s’)){

echo 'Server tijd: ’ . date(‘Y-m-d H:i:s’) . ‘
’;

echo '

Je bent verbannen tot ’ . $uFetch[‘banned_until’] . '.
Reden: ’ . $uFetch[‘ban_reason’] . ‘
’;

}elseif(mysql_num_rows($uQuery) > 0){

$_SESSION[‘id’] = $uFetch[‘id’];

mysql_query(“UPDATE users SET visits = visits+1, ip = '” . $_SERVER[‘REMOTE_ADDR’] . “’ WHERE id = '” . $_SESSION[‘id’] . “’”) or die(mysql_error());

?>

Je bent succesvol ingelogd, je word doorgestuurd naar de homepagina..
function WriteCookie (cookieName, cookieValue, expiry) { var expDate = new Date();
expDate.setTime (expDate.getTime() + expiry);
document.cookie = cookieName + "=" + escape (cookieValue) + "; expires=" + expDate.toGMTString() + "; path=/";

}

<?php }else{ ?>
Je hebt de verkeerde gegevens ingevuld

<?php

}

}

?>

Gebruikersnaam:
Wachtwoord:
<?php } ?>[/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service