SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2011
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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 Code:
    <?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();    }?>

  2. #2
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    71 Post(s)
    Tagged
    0 Thread(s)
    How are you keeping track of who's made payments?

  3. #3
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by rdkd1970 View Post
    This is my codes which work fine. Just need to know how to amend it to redirect them to payment.
    I am not following you exactly, your request seems to be for a simple enough if/else

    PHP Code:
    <?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.
    PHP Code:
    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:
    PHP Code:
    // 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; 

  4. #4
    SitePoint Enthusiast
    Join Date
    Apr 2011
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •