close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


Newly created session vars not persistent

Thread began 5/10/2021 12:18 pm by NavyChief | Last modified 5/10/2021 1:08 pm by Ray Borduin | 71 views | 1 replies |


Newly created session vars not persistent

I have an event management system where there are super admins (only one for now - me) and event admins. The event they can manage is in the same table as the login information. On the login page as a part of the login I get the event info and save them. The problem is the event for Super Admins is "NONE" SO on the page the login jumps to (admin.php) I set a new session variable for that event name passing it to that page using a URL var (GET). The problem is my new session variable does not persist and I know it is something I am doing wrong. I am sure this is a simple fix but I have tried EVERYTHING I can. Do I need to add the session variables by calling some function within the authentication.php???

LOGIN.PHP snippet showing passing posted event name through the URL to the admin.php page:

<?php require_once('/removed/Connections/conWEBPRO.php'); ?>
<?php require_once('/removed/webassist/mysqli/authentication.php'); ?>
<?php require_once('/removed/webassist/mysqli/rsobj.php'); ?>
<?php @session_start(); ?>
$rsWN = new WA_MySQLi_RS("rsWN",$conWEBPRO,0);
$rsWN->setQuery("SELECT wed_name, wed_key FROM security WHERE wed_name <> 'None' GROUP BY wed_name, wed_key");
$Authenticate = new WA_MySQLi_Auth($conWEBPRO);
$Authenticate->Action = "authenticate";
$Authenticate->Trigger = ((((isset($_POST["attempt"]))?$_POST["attempt"]:"") != ""));
$Authenticate->Name = "username";
$Authenticate->Table = "security";
$Authenticate->addFilter("username", "=", "s", "".((isset($_POST["un"]))?$_POST["un"]:"") ."");
$Authenticate->addFilter("password", "=", "s", "".((isset($_POST["pw"]))?$_POST["pw"]:"") ."");
$Authenticate->storeResult("idx", "widx");
$Authenticate->storeResult("adm_lvl", "alvl");
$Authenticate->storeResult("admlvl", "lvl");
$Authenticate->storeResult("username", "unm");
$Authenticate->storeResult("wed_name", "wnm");
$Authenticate->storeResult("wed_key", "wky");
$Authenticate->RememberMe = (true);
$Authenticate->SaveLogin = (true);
$Authenticate->AutoReturn = false;
$SuccessRedirect = "admin.php?awn=".$_POST['wnm'];
$FailedRedirect = "failure.php";
if (function_exists("rel2abs")) $SuccessRedirect = $SuccessRedirect?rel2abs($SuccessRedirect,dirname(__FILE__)):"";
if (function_exists("rel2abs")) $FailedRedirect = $FailedRedirect?rel2abs($FailedRedirect,dirname(__FILE__)):"";
$Authenticate->SuccessRedirect = $SuccessRedirect;
$Authenticate->FailRedirect = $FailedRedirect;

ADMIN.PHP snippet (the wedname and wedkey session variables are not persistent):

<?php require_once('/removed/Connections/conWEBPRO.php'); ?>
<?php require_once('/removed/webassist/mysqli/authentication.php'); ?>
<?php require_once('/removed/webassist/mysqli/rsobj.php'); ?>
<?php @session_start(); ?>
if (true) {
$RestrictAccess = new WA_MySQLi_Auth();
$RestrictAccess->Action = "restrict";
$RestrictAccess->Name = "username";
$RestricAccessRedirect = "login.php";
if (function_exists("rel2abs")) $RestricAccessRedirect = $RestricAccessRedirect?rel2abs($RestricAccessRedirect,dirname(__FILE__)):"";
$RestrictAccess->FailRedirect = $RestricAccessRedirect;
if ($_SESSION["lvl"] == 9) { $sql = "SELECT wed_name, wed_key FROM security where wed_name = '".$_GET["awn"]."' group by wed_name, wed_key"; }
if ($_SESSION["lvl"] <> 9) { $sql = "SELECT wed_name, wed_key FROM security where wed_name = '".$_SESSION["wnm"]."' group by wed_name, wed_key"; }

$rsADHOC1 = new WA_MySQLi_RS("rsADHOC1",$conWEBPRO,0);

$_SESSION["wedname"] = ($rsADHOC1->getColumnVal("wed_name"));
$_SESSION["wedkey"] = ($rsADHOC1->getColumnVal("wed_key"));

Sign in to reply to this post

Ray BorduinWebAssist

Add this line:
<?php @session_start(); ?>

directly above where the session variables are set. It might be closed by the scripts above and that might be why they aren't being saved.

Sign in to reply to this post
Did this help? Tips are appreciated...

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





Ease of use


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...