Im having a problem with my code.
When I run it to php4 and it works fine. Then I tried it to php5. Im getting error -"Undefined Variable: _Session in ..."

<?php
	session_start();
	
	
	function logged_in() {
		
		return isset($_SESSION['idnum']);
		return isset($_SESSION['user_type']);
		return isset($_SESSION['fname']);
		
	}
	
	function confirm_logged_in() {
		if (!logged_in()) {
			redirect_to("index.php");
		}
	}
	function confirm_logged_in_admin() {
		if (!logged_in()) {
			redirect_to("admin.php");
		}
	}
	function booking_restriction(){
		if ($_SESSION['user_type'] == 4) {
			redirect_to("home.php");	
		}
	}	
	function confirm_if_admin() {
 		if ($_SESSION['user_type'] == 2 ||
			$_SESSION['user_type'] == 3 ||
			$_SESSION['user_type'] == 4 ) {
	         redirect_to("../home.php");}
	}	
?>

Can you copy the full text from your error
And can you give us the source where you save the $_SESSIONS

Hi! thanks for the reply.

here is the error:

Notice: Undefined index: user_type in D:\xampp\htdocs\Main\includes\header.php on line 20

Notice: Undefined index: user_type in D:\xampp\htdocs\Main\includes\header.php on line 21

Notice: Undefined index: user_type in D:\xampp\htdocs\Main\includes\header.php on line 22

<?php 
if ($_SESSION['user_type'] == 1 ||
	$_SESSION['user_type'] == 2	||
	$_SESSION['user_type'] == 3) { 
$html2 = "<a href=\"booking/booktour.php\"><div>Book a Tour</div></a>";
echo $html2;
}else {}
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.