Hi,
i’m making a login-page for my website [url]www.ezemaal.tk
And i want to use a cookie so when someone comes back to my site, he/she is automatically logged in. The problem is that i can’t make the cookie work.
In Internet Explorer, it only works when i set my cookie settings to “accept all cookies”, instead of the default cookie settings. In Netscape it works perfectly.
But i want the cookie to work in Internet Explorer with default settings.
My domain [url]www.ezemaal.tk[url]http://users.skynet.be/yannickdelvaux/ezemaal/
But all my php files are stored on my computer (including all the login files) on [url]http://yannickdelvaux.mine.nu/ezemaal
I’ve tried filling every possible domain name in the domain section of the cookie, but nothing works.
This is the code of the 3 files that i made for the login:
login.php (this is where the user can fill in his username and password )
[code=php]
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>
<head>
<title>Untitled Document</title>
<SCRIPT LANGUAGE=”JavaScript” SRC=”above.js” TYPE=”text/javascript”></SCRIPT>
<link rel=”stylesheet” type=”text/css” href=”http://users.skynet.be/yannickdelvaux/ezemaal/stijl1.css” />
<!embed src=”1.mp3″ hidden=”true” autostart=”true” nosave=”true” width=145 height=55>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<style type=”text/css”>
<!–
body {
margin-right: 0px;
margin-top: 4px;
}
–>
</style></head>
<body bgcolor=”#000000″ onload=”pageChange()”>
<table height=”83px” width=”100%” border=”0″>
<tr>
<td width=”78%”> </td>
<td width=”22%”>
<p align=”center” class=”kleiner”>
<form method=”post” action=”inloggenbezig.php”>
<table width=”100%” border=”0″>
<tr>
<td width=”50%” valign=”top”><p align=”left” class=”kleiner”>Gebruiker:<br><input maxlength=”22″ type=”text” name=”gebruikersnaam”></p></td>
</tr>
</table>
<table width=”100%” border=”0″>
<tr>
<td width=”50%” valign=”top”><p align=”left” class=”kleiner”>Paswoord:<br><input maxlength=”22″type=”password” name=”paswoord”></p></td>
</tr>
</table>
<table width=”100%” border=”0″>
<tr>
<td width=”50%” valign=”top”><input type=”submit” name=”submit” value=”Log in…”></td>
</tr>
</table>
</form>
</p></td>
</tr>
</table>
</body>
</html>
inloggenbezig.php (this is where the filled in username and password is compared to the one in the mysql database and where the cookie is created)
[code=php]
<?php if(empty($_POST[‘gebruikersnaam’]) || empty($_POST[‘paswoord’]))
{ ?>
<p class=”kleiner”>Vul alles in. <a href=”http://yannickdelvaux.mine.nu/ezemaal/login.php”>ga terug</a></p>
<?php exit;
}
else
{
<?php
$gebruikersnaam=$_POST[‘gebruikersnaam’];
$paswoord=($_POST[‘paswoord’]);
$db=mysql_connect(“localhost”,”beheerder”,”wachtwoord”);
mysql_select_db(“dbEzemaal”,$db);
$result=mysql_query(“SELECT * FROM tblUsers WHERE username= “$gebruikersnaam” AND paswoord= “$paswoord””);
if ($myrow = mysql_fetch_row($result)) {
//————————————————————
//$str = $username.”|”.$password;
//$up = serialize($str);
//setcookie(“ezemaalkoekje”, $up, time()+(1000*86400));
//————————————————————
setcookie(“ezemaalkoekje”,$gebruikersnaam.”-“.$paswoord,time()+(1000*86400),”/”,”users.skynet.be”,1);
header(“Location: [url]http://yannickdelvaux.mine.nu/ezemaal/ingelogd.php[/url]”);
//printf(“%s”,mysql_result($result,’0′,”username”));
//printf(” – %s”,mysql_result($result,’0′,”paswoord”));
//printf(“U bent succesvol ingelogd !!!!!!!!!!!!!!!!”);
//print($ezemaalkoekje);
//}
else {
$url=”http://yannickdelvaux.mine.nu/ezemaal/login.php”;
printf(“<p>Het wachtwoord is niet juist of de gebruikersnaam bestaat niet. Gelieve opnieuw te proberen.<br><br><a href=$url>Klik hier<a> om terug te keren naar het inlog-scherm.</p>”);
}
?>
ingelogd.php (this should show the login as it is stored in the cookie)
[code=php]
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>
<head>
<title>Untitled Document</title>
<SCRIPT LANGUAGE=”JavaScript” SRC=”above.js” TYPE=”text/javascript”></SCRIPT>
<link rel=”stylesheet” type=”text/css” href=”http://users.skynet.be/yannickdelvaux/ezemaal/stijl1.css” />
<!embed src=”1.mp3″ hidden=”true” autostart=”true” nosave=”true” width=145 height=55>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<style type=”text/css”>
<!–
body {
margin-right: 0px;
margin-top: 5px;
}
–>
</style></head>
<body bgcolor=”#000000″ onload=”pageChange()”>
<table height=”83px” width=”100%” border=”0″>
<tr>
<td width=”78%”> </td>
<td width=”22%”>
<p align=”center” class=”kleiner”>
<?php
printf(“Ingelogd als:</p>”);
//$str = $_COOKIE[“ezemaalkoekje”];
//$up = unserialize($str);
//echo $up;
$data = $_COOKIE[“ezemaalkoekje”];
$array = explode(“-“, $data);
echo $array[0];
//Verbinding maken met de database en het aantal bezoeken eerst updaten, daarna weergeven.
//$db=mysql_connect(“localhost”,”beheerder”,”wachtwoord”);
//mysql_select_db(“dbEzemaal”,$db);
//$sql=”SELECT * FROM tblUsers WHERE “;
//$result=mysql_query($sql);
//printf(“<p align=”center” class=”kleiner”><a href=”http://yannickdelvaux.mine.nu/ezemaal/login.php”>Log in</a>”);
//printf(” – “);
//printf(“<a href=”http://yannickdelvaux.mine.nu/ezemaal/registreer.php” target=”rechts”>Registreer</a>”);
?>
</p></td>
</tr>
</table>
</body>
</html>
Can anyone help me please ?