Beste cp'ers
Ik stap op een probleem dat is het volgende:
Dit geeft hij aan bij mijn login script:
1
2
3
|
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/maffia12/domains/maffiasolution.v3host.be/public_html/login.php:9) in /home/maffia12/domains/maffiasolution.v3host.be/public_html/login.php on line 114
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/maffia12/domains/maffiasolution.v3host.be/public_html/login.php:9) in /home/maffia12/domains/maffiasolution.v3host.be/public_html/login.php on line 114
|
|
|
Login script zelf:
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
|
<?php
require("connect.php");
session_start(); // Hier gaat het om <<<<<<<
if(isset($_POST['login'])) {
if(trim($_POST['naam']) <> "" && trim($_POST['wacht']) <> "") {
$naam = $_POST['naam'];
$wacht = md5($_POST['wacht']);
$res = mysql_query("SELECT id, pass, level FROM users where name='".$naam."'") or die(mysql_error());
if(mysql_num_rows($res) > 0) {
$row = mysql_fetch_assoc($res);
if(!strcmp($wacht, $row['pass'])) {
if(isset($_POST['memory'])) {
setcookie("login_cookie", $row['id'].";".$row['pass'], time()+3600*24*31*2, "/");
$ip = $_SERVER['REMOTE_ADDR'];
mysql_query("UPDATE users SET last_ip='".$ip."' WHERE id=".$row['id']) or die(mysql_error());
}
$_SESSION['suser'] = $naam; // gebruikersnaam van ingelogd persoon
$_SESSION['slevel'] = $row['level']; // bijbehorende gebruikersniveau
$_SESSION['stime'] = time(); // de huidige tijd
$_SESSION['smaxidle'] = 60 * 60; // het aantal seconden inactiviteit
} else {
$_SESSION = array();
session_destroy();
}
unset($row);
mysql_free_result($res);
}
header("Location: /ingame/play.php");
}
}
?>
<?php
if(!isset($_SESSION['suser'])) {
?>
<form action="login.php" method="post">
naam <input type="text" name="naam" size="15">
wachtwoord <input type="password" name="wacht" size="15">
<input type="checkbox" name="memory" value="1"> onthoud mijn login (gebruikt cookie)
<input type="submit" name="login" value="log in">
</form>
<?php
} else {
?>
Hi <b><?= $_SESSION['suser'] ?></b>,
<a href="voorbeeld.php">voorbeeld pagina</a>
<a href="logout.php">uitloggen</a>
<?php
}
?>
|
|
|
Laatst gewijzigd door Willem op 2011-03-01 19:52:17
01-03-2011 19:15
Dit topic is 202 keer bekeken door 41 verschillende leden
Reacties op: "Probleem met login"
1
Reageer op: "Probleem met login"
1