Jump to content
php.lv forumi

Kas notiek?


sandis_m

Recommended Posts

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...