close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

retain some session values after checkout

Thread began 3/24/2015 4:03 pm by CraigR | Last modified 3/26/2015 12:48 pm by CraigR | 346 views | 5 replies

CraigRBeta Tester

retain some session values after checkout

I have a checkout success page with a standard code block at the end to destroy the session values

php:
<?php 

//initialize the session

session_start();

// Unset all of the session variables.
$_SESSION = array();
 
// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (isset($_COOKIE[session_name()])) {
 @
setcookie(session_name(), ''time()-42000'/');
}
// regenerate the session id
//http://www.webassist.com/forums/showthread.php?p=105930#post105930
session_regenerate_id();
// Finally, destroy the session.
@session_destroy();//This will also clear the session cookie which forces a new session ID to be generated.

session_start();

?>



Most pages on this internal site are admin access only, so I want to retain the session values created when the admin user (or superadmin) logs in, via admin_cms/user_login.php

what i have tried to do is simply store the session values as php variables before destroying the session, then reset the session values afterwards, but it doesn't seem to be working,

php:
<?php 

//initialize the session

session_start();

//store login session values before destroying session
$superadminlogin $_SESSION["SuperAdminLogin"];
$adminlogin $_SESSION["AdminLogin"];
$userid $_SESSION['UserID'];
$usergroupid $_SESSION['UserGroupID'];
$contentgroup $_SESSION['ContentGroup'];
$userfname $_SESSION['UserFirstName'];
$userlname $_SESSION['UserLastName'];


// Unset all of the session variables.
$_SESSION = array();
 
// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (isset($_COOKIE[session_name()])) {
 @
setcookie(session_name(), ''time()-42000'/');
}
// regenerate the session id
//http://www.webassist.com/forums/showthread.php?p=105930#post105930
session_regenerate_id();
// Finally, destroy the session.
@session_destroy();//This will also clear the session cookie which forces a new session ID to be generated.

session_start();
//restore login session values
$_SESSION["SuperAdminLogin"] = $superadminlogin;
$_SESSION["AdminLogin"] = $adminlogin;
$_SESSION["UserID"] = $userid;
$_SESSION["UserGroupID"] = $usergroupid;
$_SESSION["ContentGroup"] = $contentgroup;
$_SESSION["UserFirstName"] = $userfname;
$_SESSION["UserLastName"] = $userlname;
?>
<?php var_dump
($_SESSION);?>

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...