-1

I am getting an error while running a project using xamp server. The error is Notice: Undefined index: access in C:\xampp\htdocs\Course\includes\header.php on line 8 . I include the header.php file here, please help me.

<?php
If (!isset($user) && !stristr($_SERVER['REQUEST_URI'],'login.php')  
                && !stristr($_SERVER['REQUEST_URI'],'add_user.php')
                 && !stristr($_SERVER['REQUEST_URI'],'forgotten_password.php')) {   
    $user = $_SESSION['learner'];
    $user->set_profile();
}
If ($_GET['access'] && !stristr($_SERVER['REQUEST_URI'],'login.php')) {
tep_set_accessibility($user->id,$_GET['access']);
    $user = $_SESSION['learner'];
    $user->set_profile();
}
?>
Sakir Alam
  • 125
  • 1
  • 12

2 Answers2

3

you need to check if $_GET['access'] has been set:

if (isset($_GET['access'])) {

}
Garytje
  • 874
  • 5
  • 11
0

You dont have access key in your $_GET

Either you pass the value or check it before using it

if (isset($_GET['access'])) {
   if ($_GET['access'] && !stristr($_SERVER['REQUEST_URI'],'login.php')) {
   tep_set_accessibility($user->id,$_GET['access']);
    $user = $_SESSION['learner'];
    $user->set_profile();
  }
}
Prasanth Bendra
  • 31,145
  • 9
  • 53
  • 73