0

In the platform that I am creating, what I do is start the session, after that the session variables corresponding to the logged-in user are created.

I have an index.php file where I have an iframe to show what is in the closeuser.php file, this file contains the query that the video.php file gets, in the stable video.php file, if the session it creates is not created said session. The following code shows the one I am trying to transmit

index.php:

<?php
if(!isset($_SESSION)){
    echo "no exist";
  }
?>

<!DOCTYPE html>
<html lang="en"> 
<head>
    <meta charset="UTF-8">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="css/bootstrap.min.css">
  <link rel="stylesheet" href="css/styles.css">
  <link rel="shortcut icon" href="imgs/icon/favicon.ico">
  <title>Auditorio</title>
<body id="plenario">


<iframe  id="recargar" name="recargar" width="500" marginwidth="0" height="500" marginheight="0" frameborder="0"></iframe>

<script>setInterval(function(){parent.frames['recargar'].location='closeuser.php';}, 1000);</script>
</body>
</html>

closeuser.php:

    <?php 
error_reporting(E_ALL ^ E_NOTICE);
require_once 'Connections/video.php';
 $connection_video = new Video();
$videoactual = $connection_video->getUsers2(8); 
echo $videoactual["user"]."111";

?>

Video.php:

    <?php
require_once("conexion.php");
if(!isset($_SESSION)){
session_start();
}

class Video extends Connection{


}

The error that I get is Error session_start(): Cannot start session when headers already sent in Video.php, But I do not understand why, if I have the condition that if the session variable does not exist then to start it, if it exists then to skip the condition. Check in my other files and all do not have the variable session started.

0 Answers0