Hallo!
Warum kommen denn da Cookie-Fehler??
u.a.
Code-Ausschnitt:
Warum kommen denn da Cookie-Fehler??
u.a.
Code:
Warning: Cannot modify header information - headers already sent by (output started at /home/www/s2_8/html/123-mobile/forum/index.php:16) in /home/www/s2_8/html/123-mobile/forum/forum.php on line 27
PHP-Code:
<?
session_start();
$qur = "0"; //startzahl der anbfragezahlen
$host = "localhost"; //host der mysql datenbank
$user = "s2_8"; //user der datenbank
$pass = "fapmelissa"; //passwort der datenbank
$database = "usr_s2_8_1"; //name der datenbank
$table = "123_boards"; //tabellenname für die boards
$tablr = "123_board_threads"; //tabellenname für die threads und aw's'
$tabblr = "123_board_users"; //tabellenname für die users
@mysql_connect($host, $user, $pass) or die("Fehler! Konnte keine Verbindung zum mySQL-Server herstellen!");
@mysql_select_db($database) or die("Fehler! Die angegebene Datenbank konnte nicht ausgewählt werden.");
if ($_POST['autologin'] == "1"&&$action == "login_b")
{
$result = mysql_query("SELECT * FROM 123_board_users WHERE user_name = '".$username."'"); $qur++;
$result = mysql_fetch_array($result); $qur++;
if(base64_decode($result['user_pw']) == $_POST['passwort']){
setcookie("123_auto_login",$_POST['username'],time()+3600*24*30);
}
}
if($_GET['action'] == "logout"){
session_destroy();
setcookie("123_auto_login","",time());
}
if($_COOKIE['123_auto_login']&&!$_SESSION['user_name']){
$cook = explode("%7C", $_COOKIE['123_auto_login']);
$result = mysql_query("SELECT * FROM $tabblr WHERE user_name = '".$cook[0]."'"); $qur++;
$result = mysql_fetch_array($result); $qur++;
if($result['user_pw'] == $cook[1]){
$_SESSION['user_id'] = $result["user_id"];
$_SESSION['user_name'] = $result["user_name"];
$_SESSION['user_type'] = $result["user_type"];
$_SESSION['user_view'] = $result["user_view"];
$_SESSION['time_difference'] = $result["time_difference"];
$_SESSION['newtime'] = $result["last_logout"];
}
}
Kommentar