I have the following error in PHP error.log
[Tue Dec 19 12:08:22.887574 2017] [:error] [pid 32196] [client xx.xx.xx.x:20560] PHP Notice: Undefined offset: 8 in /var/www/html/page.php on line 55, referer: view.php?1x=8
and the php code that i think causes this is:
$i = isset($_SESSION['i']) ? $_SESSION['i'] : 0;
// echo $_SESSION['websites'][$i];
$website = explode(";", $_SESSION['websites'][$i]);
// echo $website[0];
$i++;
$_SESSION['i'] = $i;
I dont really know what $i = isset($_SESSION['i']) ? $_SESSION['i'] : 0;
does
thank you
session_start();
$i = isset($_SESSION['i']) ? $_SESSION['i'] : 0;
if ($_SESSION['i'] < $sesioni1x) {
// echo $_SESSION['websites'][$i];
$website = explode(";", $_SESSION['websites'][$i]);
// echo $website[0];
$i++;
$_SESSION['i'] = $i;
header("Location: $website[0]"); //redirect
die();
// echo $website[0];
// echo $sesioni1x;
// echo $website[0]." Frame-URL<br>";
// $_SESSION['actual_website'] = $website[0];
}
if ($_SESSION['i'] == $sesioni1x) {
$handle = fopen($list1x, "a"); //open file to append content to csv file
fputcsv($handle, $_SESSION['addwebsite'], ";"); //insert line in opened file
fclose($handle); //close file
header("Location: index.php"); //redirect
die();
// echo "session = var";
}
this is the full code where i get this warning, i must say that script is doing his job, but i want to get rid of the error
the $_SESSION['i']
in the source is 0