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

Issues with creating Login User

Thread began 10/13/2019 2:30 pm by Michael | Last modified 10/18/2019 12:48 pm by Ray Borduin | 34 views | 4 replies |

Michael

Issues with creating Login User

Hi,

I have installed MySQLI server behavior but now I cant create a Login User. My username and password are not being checked. The system just logs me in even when there is no password. My password is MD5 but nothing is checked. Even when I enter wrong Username, I am still logged in.

Below is the code generated by MySQLi Login User

<?php
$Authenticate = new WA_MySQLi_Auth($RMConferenceDBMS);
$Authenticate->Action = "authenticate";
$Authenticate->Trigger = ($_SERVER["REQUEST_METHOD"] === "POST");
$Authenticate->Name = "Admin";
$Authenticate->Table = "admin_login";
$Authenticate->addFilter("user_name", "=", "s", "".($rsAdmin->getColumnVal("user_name")) ."");
$Authenticate->addFilter("password", "=", "s", "".($rsAdmin->getColumnVal("password")) ."");
$Authenticate->addFilter("level", "=", "s", "".($rsAdmin->getColumnVal("level")) ."");
$Authenticate->storeResult("user_name", "user_name");
$Authenticate->storeResult("password", "password");
$Authenticate->storeResult("level", "level");
$Authenticate->RememberMe = (false);
$Authenticate->SaveLogin = (false);
$Authenticate->AutoReturn = false;
$SuccessRedirect = "dashboard.php";
$FailedRedirect = "loginfailadm.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;
$Authenticate->execute();
?>

Please how do I correct this.

Than

Sign in to reply to this post

Michael

Issues with creating Login User

Hi Ray,

I made some modification based on a response from one of the post and its now working. I removed the recordset and changed the Find Record attributes as seen below.

However, I want the system to automatically check the access level as it used to be in the Dreamweaver. I done want users to select their level. In this attached form, I added an inout box for level but I dont want it so. How do I set that so the page checks the Username, Password and Level from the backend

<?php
$Authenticate = new WA_MySQLi_Auth($RMConferenceDBMS);
$Authenticate->Action = "authenticate";
$Authenticate->Trigger = ($_SERVER["REQUEST_METHOD"] === "POST");
$Authenticate->Name = "Admin";
$Authenticate->Table = "admin_login";
$Authenticate->addFilter("user_name", "=", "s", "".((isset($_POST["user_name"]))?$_POST["user_name"]:"") ."");
$Authenticate->addFilter("password", "=", "s", "".((isset($_POST["password"]))?md5($_POST["password"]):"") ."");
$Authenticate->addFilter("level", "=", "s", "".((isset($_POST["level"]))?$_POST["level"]:"") ."");
$Authenticate->storeResult("user_name", "user_name");
$Authenticate->storeResult("password", "password");
$Authenticate->storeResult("level", "level");
$Authenticate->RememberMe = (false);
$Authenticate->SaveLogin = (true);
$Authenticate->AutoReturn = false;
$SuccessRedirect = "dashboard.php";
$FailedRedirect = "loginfailadm.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;
$Authenticate->execute();
?>

Sign in to reply to this post

Ray BorduinWebAssist

You can change this line to something like:

$Authenticate->addFilter("level", "=", "s", "1");

You only want users with a certain access level to be able to log in? That would only allow people to log in if their user level is set to 1 in the database.

Sign in to reply to this post

Michael

Issues with creating Login User

Originally Said By: Ray Borduin
  You can change this line to something like:

$Authenticate->addFilter("level", "=", "s", "1");

You only want users with a certain access level to be able to log in? That would only allow people to log in if their user level is set to 1 in the database.  


Yes Users with certain access level but there are about 5 different access levels. How can I set them.

Adding "1" will only show they have access level but not the different levels

Sign in to reply to this post

Ray BorduinWebAssist

Repeat the authentication code for each access type giving each their own name to reflect the level of access you are filtering for.

Leave the fail redirect blank for all but the last on that appears on the page so that the next one will check after the one before fails down the line.

The other option is to use DataBridge instead of MySQLi Server Behaviors. That would allow you to save the access group as a session variable during login and then define access rules based on the session variable value instead of using separate authentication server behaviors.

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