A
A
Alexander2017-09-19 22:10:50
PHP
Alexander, 2017-09-19 22:10:50

Error in session_start...?

There are pages on the site that require authorization to view, otherwise they are redirected to the main page, and so, everything works, but the error_log constantly gives an error. The error is on the first line. It seems that I re-read the session manual, apparently I missed something, I want to somehow eliminate this error.

<?php
  session_start(); 
  $vlogin = $_SESSION['login'];
  $n = ""; 
  if($vlogin == $n){
    header('Location: /');
  }
    else{	  
  }
 ?>

Thanks in advance for your replies.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Egor Peregudov, 2017-09-20
@Stalk-p

session_start();
Must be before any content is displayed on the page. If you have include, then you do not need to write session_start () again in other files;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question