close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

authenticate using two tables?

Thread began 1/25/2013 12:57 pm by paulshoe379536 | Last modified 1/26/2013 8:55 pm by paulshoe379536 | 712 views | 4 replies |

paulshoe379536

authenticate using two tables?

Is it possible to authenticate users using two tables? I have a database with multiple groups. Each group has multiple members. I am currently authenticating users by username, password, and active status. Groups (the 2nd table) have an expiration date. I would like to also setup a rule and session value if the group date has expired.

Result desired:
If the visitor logging in can not be authenticated or the group they belong to has expired, deny access.

Sign in to reply to this post

Jason ByrnesWebAssist

it will take a little finagling to do this.

on the login page, edit the security assist authenticate user behavior, on the session tab, click the plus button to store the Group ID in a session variable.

you will also need to uncheck the Go To Previous page if it exists option.

next, on the login success page, create a recordset to query the groups table and use the groupID Session to filter.

you can then save the groups expiration date to another session.

Sign in to reply to this post

paulshoe379536

Thank you Jason,

That's what I was doing but I was also trying to avoid adding the validation code to all of the pages that a member can view.

Currently, if they bookmark a page that is not the normal start page, the authentication sends them to the log in page but after logging in they are returned to their bookmarked page. I have "gotoPreviousURL => FALSE"

Code below:
-------------------------------------
<?php
if((((isset($_POST["Login"]))?$_POST["Login"]:"") != "")){
$WA_Auth_Parameter = array(
"connection" => $cpDVD,
"database" => $database_cpDVD,
"tableName" => "members",
"columns" => explode($WA_Auth_Separator,"username".$WA_Auth_Separator."password"),
"columnValues" => explode($WA_Auth_Separator,"".((isset($_POST["username"]))?$_POST["username"]:"") ."".$WA_Auth_Separator."".((isset($_POST["userpassword"]))?$_POST["userpassword"]:"") .""),
"columnTypes" => explode($WA_Auth_Separator,"text".$WA_Auth_Separator."text"),
"sessionColumns" => explode($WA_Auth_Separator,"member_id".$WA_Auth_Separator."privileges".$WA_Auth_Separator."group_id".$WA_Auth_Separator."family_id".$WA_Auth_Separator."block_access"),
"sessionNames" => explode($WA_Auth_Separator,"member_id".$WA_Auth_Separator."privileges".$WA_Auth_Separator."group_id".$WA_Auth_Separator."family_id".$WA_Auth_Separator."block_access"),
"successRedirect" => "members/members_list1.php",
"failRedirect" => "index.php?failed=true",
"gotoPreviousURL" => FALSE,
"keepQueryString" => FALSE
);

WA_AuthenticateUser($WA_Auth_Parameter);
}
?>
-------------------------------------------------------------

Sign in to reply to this post

Jason ByrnesWebAssist

Maybe try creating a view that uses a join query to join the Users and Group tables, then in the authenticate user behavior, use the view in stead of the users table, this way you will be able to access the expiration column on the sessions tab.

Sign in to reply to this post

paulshoe379536

Thank you Jason. That was a good idea. I linked the two tables on the login page using the $_POST values from the authenticate user behavior. On post, I compared my dates and set a session value if expired.

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