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

rating

how to store successful logins

Thread began 1/15/2020 10:51 am by CraigR | Last modified 1/15/2020 2:28 pm by Ray Borduin | 28 views | 4 replies |

CraigRBeta Tester

how to store successful logins

I have a site which uses security assist as a basis or its login page.
the login page checks the members table and on authentication, the members is permitted site access

i wish to store successful logins in a separate table so i can see how often particular members access the site.
so far this has been quite straightforward, and the login form and the insert works well

php:
<?php

if(isset($_POST["LogIn"])){
    
$WA_Auth_Parameter = array(
    
"connection" => $mysqli,
    
"database" => $database_mysqli,
    
"tableName" => "tblmembers",
    
"columns" => explode($WA_Auth_Separator,"MemberEmail".$WA_Auth_Separator."MemberPassword"),
    
"columnValues" => explode($WA_Auth_Separator,"".((isset($_POST["emailaddress"]))?$_POST["emailaddress"]:"")  ."".$WA_Auth_Separator."".sha1(((isset($_POST["userpassword"]))?$_POST["userpassword"]:""))  .""),
    
"columnTypes" => explode($WA_Auth_Separator,"text".$WA_Auth_Separator."text"),
    
"sessionColumns" => explode($WA_Auth_Separator,"MemberID".$WA_Auth_Separator."userLevel"),
    
"sessionNames" => explode($WA_Auth_Separator,"MemberID".$WA_Auth_Separator."userLevel"),
    
"successRedirect" => "",
    
//"successRedirect" => "/index.php",
    
"failRedirect" => "",
    
"gotoPreviousURL" => FALSE,
    
"keepQueryString" => TRUE
    
);
    
    
WA_AuthenticateUser($WA_Auth_Parameter);
    
//print_r($WA_Auth_Parameter);
}
?>
<?php
 
if((isset($_POST["LogIn"])) && (WA_Auth_RulePasses("Admins and members"))) { // login success
 //print_r('hello');
 //if(""=="") {
  
$InsertQuery = new WA_MySQLi_Query($mysqli);
  
$InsertQuery->Action "insert";
  
$InsertQuery->Table "tbllogin";
  
$InsertQuery->bindColumn("MemberID""i""".$_SESSION['MemberID']  ."""WA_DEFAULT");
  
$InsertQuery->saveInSession("LoginID");
  
$InsertQuery->execute();
  
$InsertGoTo "";
  if (
function_exists("rel2abs")) $InsertGoTo $InsertGoTo?rel2abs($InsertGoTo,dirname(__FILE__)):"";
  
$InsertQuery->redirect($InsertGoTo);
}
?>



However the problem i have is as follows...

if i use the login form with login.php as the url, both blocks of code execute and the login table is populated

if i have been redirected to the login form from say the index page which has restricted access, the url will read /login.php?accesscheck=%2Findex.php%3F

if i complete the login form here, the insert block does not run.

i tries setting gotoPreviousURL to false, but it doesn't seem to make any difference

Sign in to reply to this post

Ray BorduinWebAssist

You may have an older version of the security assist helper_php.php file. I think that setting wasn't working at one point in the past.

If you give me FTP access then I can take a look at that file and see if it needs to be updated.

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

CraigRBeta Tester

Originally Said By: Ray Borduin
  You may have an older version of the security assist helper_php.php file. I think that setting wasn't working at one point in the past.

If you give me FTP access then I can take a look at that file and see if it needs to be updated.  


PM

Attached Files
helper_php.php
Sign in to reply to this post

Ray BorduinWebAssist

Update line 68 from:
if (isset($_GET['accesscheck'])) {

to:
if (isset($_GET['accesscheck']) && $WA_Auth_Parameter["gotoPreviousURL"]) {

That should fix the problem.

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

CraigRBeta Tester

awesome Ray.

thanks very much for your help.

Have a good day

Sign in to reply to this post

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