Redirect for payment for already login mem

I am working on getting members that are ready to make a payment after they have logged in and want to view their emails to make the payment first. How can I reprogram my session to stop them from entering the email section and make a payment first.

This is my codes which work fine. Just need to know how to amend it to redirect them to payment.


<?php	//Start session
	session_start();
//Check whether the session variable SESS_MEMBER_ID is present or not	if(!isset($_SESSION['SESS_ID']) || (trim($_SESSION['SESS_ID']) == '')) {		header("location: access-denied.php");		exit();	}?>

How are you keeping track of who’s made payments?

I am not following you exactly, your request seems to be for a simple enough if/else


<?php	//Start session
session_start();

//Check whether the session variable SESS_MEMBER_ID is present or not

if( !isset($_SESSION['SESS_ID'])  
     || (trim($_SESSION['SESS_ID']) == '')) {
header("location: access-denied.php");
exit();
}else{
header("location: payment-page.php");
exit();
}

?>

Is that what you mean? The question might then be how do you check the validity of the session?

That could be wrapped up in a function.


function checkValidSession($session_id){

// do some kind of check and it is good
return true;

// otherwise
return false;

}

You may find checkValidSession() is a function you will use in other places too, you can put it into a file of its own and include it when you need it.

In that case the the check could become as simple as:


// default action is to send away
$target_page = 'access-denied.php';

// overwrite the variable if the conditions are met
if( isset($_SESSION['SESS_ID'] && checkValidSession($_SESSION['SESS_ID') ){
$target_page = 'payment.php';
}

header('Location ' . $target_page);
exit;

Thanks I also have to set up a standard side to a premium side for members the premium being the paid section. Thanks for your help.:smiley: