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

How do I add a session variable / value without it being part of the "storeResult" command @ login

Thread began 6/02/2021 11:26 am by NavyChief | Last modified 6/02/2021 2:38 pm by NavyChief | 16 views | 5 replies


How do I add a session variable / value without it being part of the "storeResult" command @ login

I have read a few of the threads on this and it "seems" my situation is a bit different. I cant seem to save session values from page to page if they are NOT stored using the "storeResult" command during login AND I cant even change the existing session values either. When users log in the login table has the values needed for the rest of the pages; however, admins log in in have no values because they should be able to choose a value and that part does not work.

In the example below I am altering the session variables based on selection from a form but I also want to add session vars outside of the login "storeResult" command.

<?php @session_start(); ?>
<?php require_once('/removed/Connections/conWEBPRO.php'); ?>
<?php require_once('/removed/webassist/mysqli/authentication.php'); ?>
<?php require_once('removed/webassist/mysqli/queryobj.php'); ?>
<?php require_once('/removed/webassist/mysqli/rsobj.php'); ?>
$Authenticate = new WA_MySQLi_Auth($conWEBPRO);
$Authenticate->Action = "authenticate";
$Authenticate->Trigger = ((((isset($_POST["un"]))?$_POST["un"]:"") != ""));
$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("admlvl", "lvl");
$Authenticate->storeResult("username", "unm");
$Authenticate->storeResult("password", "upw");
$Authenticate->storeResult("email", "em");
$Authenticate->storeResult("wed_name", "wnm"); // <= initially saved here
$Authenticate->storeResult("wed_key", "wky"); // <= initially saved here
$Authenticate->storeResult("validated", "val");
$Authenticate->RememberMe = (true);
$Authenticate->SaveLogin = (true);
$Authenticate->AutoReturn = false;
$SuccessRedirect = "main.php?wk=".$_POST['wk'];
$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;
{more after}

<?php @session_start(); ?>
<?php require_once('/removed/Connections/conWEBPRO.php'); ?>
<?php require_once('/removed/webassist/mysqli/authentication.php'); ?>
<?php require_once('/removed/webassist/mysqli/queryobj.php'); ?>
<?php require_once('/removed/webassist/mysqli/rsobj.php'); ?>
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['val'] <> 0) { header("Location: noval.php"); }
if (($_SESSION['lvl'] == 9) && (isset($_GET['wk']))) {
$rsWEDLIST = new WA_MySQLi_RS("rsWEDLIST",$conWEBPRO,1);
$rsWEDLIST->setQuery("SELECT wed_name, wed_key FROM security WHERE wed_key = '".$_GET['wk']."' GROUP BY wed_name, wed_key ORDER BY wed_name ASC");
$_SESSION['wnm'] = ($rsWEDLIST->getColumnVal("wed_name")); // <= value changed here
$_SESSION['wky'] = ($rsWEDLIST->getColumnVal("wed_key")); // <= value changed here
{mopre after}

All other pages (example wlist.php) where $_SESSION['wnm'] and $_SESSION['wky'] are referenced show the stored value from login EXCEPT main.php shows the new values as if they are separate session vars.

I think somehow I need to get the session index key and provide it when I save other session vars post login.


Eric Joy

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