Pragma: no-cache
Hoe kan ik dit werkend krijgen in IE 6? het word namelijk maar ondersteund tm IE4 heb ik me laten vertellen...
Code:
header("Pragma: ");
header("Cache-Control: ");
header("Expires: Mon, 26 Jul 1999 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, proxy-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
//set global variables
global $username,$password;
header("Pragma: no-cache");
Je hebt lege headers.
en wat moet daar in komen te staan?
header("Cache-Control: ");
Weghalen.
werkt het nog niet...
'Wat' werkt niet?
lees de slimme vragen tutorial eens.
Validate.php:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?
header("Expires: Mon, 26 Jul 2006 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, proxy-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
//set global variables
global $username,$password;
header("Pragma: no-cache");
//hieronder gebruikersnaam en wachtwoord aanpassen
//alleen cijfers en letters gebruiken zonder spaties
$uname[1] = "***";
$upass[1] = "*******";
$known_as[1] = "****";
//veel meer gebruikers kunnen worden toegevoegd
//verwijder dan de slashes voor onderstaande regels
$uname[2] = "***8";
$upass[2] = "******";
$known_as[2] = "*****";
//de login-pagina
$login_page = "login.php";
//pagina na het inloggen
$success_page = "nieuwelink.php";
//pad naar validate.php
$validate_path = "http://chatty.ch.funpic.org/links/validate.php";
//foutmelding na het inloggen
$login_err = '<div align="center">Uw gebruikersnaam of wachtwoord is onjuist !!!</b><br></div>';
//Lege velden
$empty_err = '<div align="center"><b>U heeft(nog) niets ingevuld !!!<br></b></div>';
//Foute invoer voor wachtwoord en/of gebruikersnaam
$chr_err = '<div align="center"><b>Probeer het nogmaals aub ...</b></div>';
//if the form is empty and the cookie isn't set
//then display error message the return to login
if($username == "" && $password == "" && !isset($_COOKIE["this_cookie"])){
include($login_page);
print($empty_err);
exit();
}
//if the form is not empty and the cookie isn't set
//then make sure that only letters and numbers are entered
//if there are then display error message the return to login
if($username != "" || $password != "" && !isset($_COOKIE["this_cookie"])){
if (preg_match ("/[^a-zA-Z0-9]/", $username.$password)){
include($login_page);
print($chr_err);
exit();
}
}
//if the cookie isn't set
if (!isset($_COOKIE["this_cookie"]) ){
$user_count = count($uname);
$user_exists = false;
// check through all the users to see if they exist
for ($i = 1; $i <= $user_count; $i++) {
if ($uname[$i] == $username && $upass[$i] == $password){
$user_id=$i;
//$welcome_name = $known_as[$i];
$user_exists = true;
}
}
if(!$user_exists){
include($login_page);
print ($login_err);
exit();
}
//if the login is correct then set the cookie
$cookie_val=crypt($uname[$user_id]);
//set the cookie so it dies when the browser is closed
setcookie ("name", $known_as[$user_id], 0);
setcookie ("this_cookie", $cookie_val, 0);
header("Location: $success_page");
exit();
}
//if a user tries to access validate.php directly and they are logged in
if($REQUEST_URI == $validate_path){
echo "<html>\n<head>\n";
echo "<title>U bent al ingelogd</title>\n";
echo "</head>\n";
echo "<body bgcolor=\"white\">\n";
echo "U bent ingelogd. <a href=\"".$success_page."\" target=\"_self\">Ga verder</a>\n";
echo "</body>\n";
echo "</html>\n";
}
?>
header("Expires: Mon, 26 Jul 2006 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, proxy-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
//set global variables
global $username,$password;
header("Pragma: no-cache");
//hieronder gebruikersnaam en wachtwoord aanpassen
//alleen cijfers en letters gebruiken zonder spaties
$uname[1] = "***";
$upass[1] = "*******";
$known_as[1] = "****";
//veel meer gebruikers kunnen worden toegevoegd
//verwijder dan de slashes voor onderstaande regels
$uname[2] = "***8";
$upass[2] = "******";
$known_as[2] = "*****";
//de login-pagina
$login_page = "login.php";
//pagina na het inloggen
$success_page = "nieuwelink.php";
//pad naar validate.php
$validate_path = "http://chatty.ch.funpic.org/links/validate.php";
//foutmelding na het inloggen
$login_err = '<div align="center">Uw gebruikersnaam of wachtwoord is onjuist !!!</b><br></div>';
//Lege velden
$empty_err = '<div align="center"><b>U heeft(nog) niets ingevuld !!!<br></b></div>';
//Foute invoer voor wachtwoord en/of gebruikersnaam
$chr_err = '<div align="center"><b>Probeer het nogmaals aub ...</b></div>';
//if the form is empty and the cookie isn't set
//then display error message the return to login
if($username == "" && $password == "" && !isset($_COOKIE["this_cookie"])){
include($login_page);
print($empty_err);
exit();
}
//if the form is not empty and the cookie isn't set
//then make sure that only letters and numbers are entered
//if there are then display error message the return to login
if($username != "" || $password != "" && !isset($_COOKIE["this_cookie"])){
if (preg_match ("/[^a-zA-Z0-9]/", $username.$password)){
include($login_page);
print($chr_err);
exit();
}
}
//if the cookie isn't set
if (!isset($_COOKIE["this_cookie"]) ){
$user_count = count($uname);
$user_exists = false;
// check through all the users to see if they exist
for ($i = 1; $i <= $user_count; $i++) {
if ($uname[$i] == $username && $upass[$i] == $password){
$user_id=$i;
//$welcome_name = $known_as[$i];
$user_exists = true;
}
}
if(!$user_exists){
include($login_page);
print ($login_err);
exit();
}
//if the login is correct then set the cookie
$cookie_val=crypt($uname[$user_id]);
//set the cookie so it dies when the browser is closed
setcookie ("name", $known_as[$user_id], 0);
setcookie ("this_cookie", $cookie_val, 0);
header("Location: $success_page");
exit();
}
//if a user tries to access validate.php directly and they are logged in
if($REQUEST_URI == $validate_path){
echo "<html>\n<head>\n";
echo "<title>U bent al ingelogd</title>\n";
echo "</head>\n";
echo "<body bgcolor=\"white\">\n";
echo "U bent ingelogd. <a href=\"".$success_page."\" target=\"_self\">Ga verder</a>\n";
echo "</body>\n";
echo "</html>\n";
}
?>
Gewijzigd op 01/01/1970 01:00:00 door michel
En wat is het probleem?
inloggen.php:
<html>
<head>
<title>:: LOGIN :: Mijn startpagina :: </title>
<link rel=stylesheet type="text/css" href="../css.css">
</head>
<body><table width="400" align="center">
<tr>
<th valign=top>U moet ingelogd zijn om deze pagina te bekijken<br><br></th>
</tr>
<tr><td>
Code (php)
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
<?
//if no cookie is set then display the form
if(!isset($_COOKIE["this_cookie"])){
echo '<div align="center"><form action="validate.php" method="post">';
echo 'Gebruikersnaam : <input type="text" name="username"><br><br>';
echo 'Wachtwoord : <input type="password" name="password"><br><br>';
echo '<input type="submit" value="Login"></form></div>';
}else{
echo "U bent al ingelogd !!! <a href=\"admin.php\">Ga verder ...</a>";
}
?>
//if no cookie is set then display the form
if(!isset($_COOKIE["this_cookie"])){
echo '<div align="center"><form action="validate.php" method="post">';
echo 'Gebruikersnaam : <input type="text" name="username"><br><br>';
echo 'Wachtwoord : <input type="password" name="password"><br><br>';
echo '<input type="submit" value="Login"></form></div>';
}else{
echo "U bent al ingelogd !!! <a href=\"admin.php\">Ga verder ...</a>";
}
?>
</td>
</tr>
</table>
</body>
</html>
nog suggesties?
Graag wat meer info. Wat gebeurt er. Zet error reporting aan. Eventueel echoes in de code.
IE accepteerd inderdaad cookies...
Quote:
nog suggesties?
schrijf je eigen login systeem en controleer als men ingelogd is a.d.h.v. cookies & verander bv. 0 naar 1 in db als iemand ingelogd is dan heb je ook geen headers nodig of weinig...