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

MySQLi Log In User not allowing log in despite correct credentials?

Thread began 8/02/2018 8:40 am by Nathon Jones Web Design | Last modified 8/03/2018 2:39 pm by Ray Borduin | 33 views | 4 replies |

Nathon Jones Web Design

MySQLi Log In User not allowing log in despite correct credentials?

My login form...

<form action="" class="form-signin" name="prescIN" method="post">
<h1 class="h3 mb-3 font-weight-normal"><button class="btn btn-sm btn-primary"><i class="fal fa-user-md fa-2x"></i></button> Please sign in</h1>

<?php if (isset($_GET["f"]) && $_GET["f"] == 1) { ?><small class="text-danger"><em>The login details you have entered are incorrect.</em></small><?php } ?>

<label for="inputEmail" class="sr-only">E-mail address</label>
<input type="email" name="prescEMAIL" id="prescEMAIL" class="form-control" placeholder="E-mail address" required autofocus>

<label for="inputPassword" class="sr-only">Password</label>
<input type="password" name="prescPASS" id="prescPASS" class="form-control" placeholder="Password" required>

<div class="checkbox mb-3">
<label>
<input type="checkbox" value="remember-me" name="prescMINDME"> Remember me
</label>
</div>

<button class="btn btn-lg btn-primary btn-block" type="submit" name="prescinBTN" id="prescinBTN">Sign in</button>
</form>



The behaviour code...

<?php require_once('webassist/mysqli/authentication.php'); ?>
<?php
$Authenticate = new WA_MySQLi_Auth($csdbmysqli);
$Authenticate->Action = "authenticate";
$Authenticate->Trigger = (isset($_POST["prescinBTN"]) || isset($_POST["prescinBTN_x"]));
$Authenticate->Name = "prescIN";
$Authenticate->Table = "DGPSTteam";
$Authenticate->addFilter("teamEMAIL", "=", "s", "".((isset($_GET["prescEMAIL"]))?$_GET["prescEMAIL"]:"") ."");
$Authenticate->addFilter("teamPASS", "=", "s", "".((isset($_GET["prescPASS"]))?$_GET["prescPASS"]:"") ."");
$Authenticate->storeResult("teamID", "prescID");
$Authenticate->storeResult("teamACCESS", "prescACC");
$Authenticate->storeResult("teamTITLE", "prescTITLE");
$Authenticate->storeResult("teamFIRST", "prescFIRST");
$Authenticate->storeResult("teamSUR", "prescSUR");
$Authenticate->storeResult("teamIMG", "prescIMG");
$Authenticate->RememberMe = isset($_POST["prescinBTN"]) || isset($_POST["prescinBTN_x"]);
$Authenticate->SaveLogin = " == ";
$Authenticate->AutoLogin = true;
$Authenticate->AutoReturn = false;
$SuccessRedirect = "admin.php";
$FailedRedirect = "staff.php?f=1";
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();
?>



Despite entering the correct credentials it always jumps to the FailedRedirect URL.

Anything obvious with the above?
Thank you.
NJ

Sign in to reply to this post

Ray BorduinWebAssist

Your form method is POST but the form element references are using GET in the code.

Sign in to reply to this post

Nathon Jones Web Design

The MySQLi Log In User behaviour automatically generated GET, and if I set the form method to GET it doesn't work either.

Should the behaviour be setting the form element references using POST?

Thank you.
NJ

Sign in to reply to this post

Nathon Jones Web Design

I've manually changed the form element references to POST and it appeared to be letting me log in successfully, however no matter what credentials I use the same user is always logged in. I attach a URL and two separate login credentials, privately below, to allow you to test that.

I'm wondering if this is all related to the problems I'm also having with the Log Out User and Restrict Access to Page behaviours which I've reported separately here:
http://www.webassist.com/forums/posts.php?id=41249

I don't understand the "Enable automatic login" section in the Log In User behaviour, however when I uncheck this it produces an error in the behaviour code. Could you explain the Auto-login Check and Remember-me Check sections? I have a suspicion that this might also be contributing to the problems I'm experiencing.

Thank you Ray
NJ

Sign in to reply to this post

Ray BorduinWebAssist

Your admin.php page was filtering the recordset with:

teamID = $_SESSION['prescACC']

The value of prescACC for both users is 1. You want to be filtering it with

teamID = $_SESSION['prescID']

I've made the change on your page and it works now.

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