close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Problem with user authentication

Thread began 9/18/2018 1:16 am by María Luisa | Last modified 9/18/2018 9:04 am by Ray Borduin | 392 views | 1 replies |

María Luisa

Problem with user authentication

Hello, thanks for reading. I have the following problem: in my WA code it appears:

<?php
$Authenticate = new WA_MySQLi_Auth($Prueba_MCC_i);
$Authenticate->Action = "authenticate";
$Authenticate->Trigger = (false);
$Authenticate->Name = "administracion";
$Authenticate->Table = "usuarios";
$Authenticate->addFilter("u_email", "=", "s", "mail");
$Authenticate->addFilter("u_password", "=", "s", "csign");
$Authenticate->RememberMe = false;
$Authenticate->SaveLogin = false;
$Authenticate->AutoReturn = false;
$SuccessRedirect = "edicion.php";
$FailedRedirect = "MCC_error.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();
?>

On the other hand I have a simple access form:

<form id="Acceso" name="Acceso" method="POST" action="">

<table width="400" border="0" cellspacing="0" cellpadding="6">
<tr>
<td width="133" align="right" valign="top">Correo electrónico</td>
<td width="243" align="left" valign="top">
<label for="mail"></label>
<input name="mail" type="text" id="mail" size="20" />
</td>
</tr>
<tr>
<td align="right" valign="top">Contraseña</td>
<td align="left" valign="top">
<label for="csign"></label>
<input name="csign" type="password" id="csign" size="15" />
</td>
</tr>
<tr>
<td colspan="2" align="center" valign="top">
<input name="Acceder" type="submit" value="Acceder" class="espaciar_btn" /> <input name="Restablecer" type="reset" value="Restablecer" class="espaciar_btn"/>
</td>
</tr>
</table>
</form>

But if I enter a valid email address and the correct password and click the "Acceder" button (submit) to test the page in my MAMP, nothing happens: it does not go to the Error page ("MCC_error.php") nor to the of success in the login ("edicion.php") and stays in the same access form. The same thing happens if I enter an invalid email or password: it does not go to the error page and stays on the page of the form.

Can someone help me please. Thank you very much

Sign in to reply to this post

María Luisa

Record Set was missing

Hello, I have found the solution by myself. The problem was that I had not made a recordset with the data of the table that interested me for the authentication of the form and, also, I had placed these in Find Record.

With this code it works:

<?php
$Recordset1 = new WA_MySQLi_RS("Recordset1",$Prueba_MCC_i,1);
$Recordset1->setQuery("SELECT usuarios.u_email, usuarios.u_password FROM usuarios");
$Recordset1->execute();?>
<?php
$Authenticate = new WA_MySQLi_Auth($Prueba_MCC_i);
$Authenticate->Action = "authenticate";
$Authenticate->Trigger = ($_SERVER["REQUEST_METHOD"] == "POST");
$Authenticate->Name = "user";
$Authenticate->Table = "usuarios";
$Authenticate->addFilter("u_email", "=", "s", "".($Recordset1->getColumnVal("u_email")) ."");
$Authenticate->addFilter("u_password", "=", "s", "".($Recordset1->getColumnVal("u_password")) ."");
$Authenticate->storeResult("u_email", "u_email");
$Authenticate->RememberMe = false;
$Authenticate->SaveLogin = false;
$Authenticate->AutoReturn = false;
$SuccessRedirect = "edicion.php";
$FailedRedirect = "MCC_error.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();
?>

A greeting :)

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