validation of user login

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
meetmec12
User
Posts: 13

validation of user login

Post by meetmec12 »

Can I validate the number of times a user can login (eg user can login with their details up to 5times after that login won't be possible ) I also haven't seen any validation of fields or any time


digitalphotoworld
User
Posts: 416
Location: Nürnberg/Germany

Post by digitalphotoworld »

You could use a field in databasetable USER that contains the logincount. Each login the value increase. If the limit is reached, the user can't login.

You have to use the server events. Take a look at the helpfile, the server events are well documented.


danielc
User
Posts: 1601

Post by danielc »

Are you talking about the Maximum failed attempts? You can click [Advanced]->[User Login Options]. Then enable [Track failed attempts] and set [Maximum failed attempts] to 5 (up to 5 times).

If you need to have other than password validation, you may setup Form_CustomValidate server event under Server Events->Other->Login Page. See Server event and Client script in help file.


meetmec12
User
Posts: 13

Post by meetmec12 »

@danielc no am not talking about login attempts or time to login( in GMT) I Mean the actual number of time the user can login to the site ever . When the time is exhausted an error msg comes up saying you have exceed your login time. Thanks


Webmaster
User
Posts: 9430

Post by Webmaster »

Enable Audit Trail -> Track login/logout activities and use database table for Audit Trail (see PHP Settings -> General -> Audit Trail in the help file). Then use User_LoggingIn server event (see Server Events and Client Scripts in the help file) to query the audit trail table and get the number of login, if more than what you allowed (including the just successful login), call setFailureMessage and redirect user to the logout page, e.g.

$count = ew_ExecuteScalar("SELECT COUNT(*) FROM YourAuditTrailTable WHERE YourUserNameField = '" . ew_AdjustSql($usr) . "'");
if ($count > 6) {
$this->setFailureMessage("Your Message");
return FALSE;
}


meetmec12
User
Posts: 13

Post by meetmec12 »

perfect


Post Reply