sandis_m Posted February 23, 2010 Report Share Posted February 23, 2010 Kas notiek? Apgaismojiet mani kāds index.php <?php include ('guard.php'); self_guard(); ?> guard.php <?php session_start(); function self_guard() { if(isset($_COOKIE['user_id']) && isset($_COOKIE['user_name'])){ $_SESSION['user_id'] = $_COOKIE['user_id']; $_SESSION['user_name'] = $_COOKIE['user_name']; } if (!isset($_SESSION['user_id'])) { header("Location: index.php"); } } ?> Kļūda: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\index.php:1) in C:\xampp\htdocs\guard.php on line 2 Quote Link to comment Share on other sites More sharing options...
mounkuls Posted February 23, 2010 Report Share Posted February 23, 2010 if(isset($_COOKIE['user_id']) && isset($_COOKIE['user_name'])){ $_SESSION['user_id'] = $_COOKIE['user_id']; $_SESSION['user_name'] = $_COOKIE['user_name']; } Šis te ļoooooti daudz palīdz... Visur, kad nav if (!isset($_SESSION['user_id'])) lapā neatgriezīs neko. Quote Link to comment Share on other sites More sharing options...
2easy Posted February 23, 2010 Report Share Posted February 23, 2010 slavenā "headers already sent" problēma. pinotais topiks ;) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.