First Aid Page for Advanced Login

If you have any problems, then write an email to me »

Watch the video tutorials to learn how to set up the extensions.

sreenshots

 

Advanced Login Action:

- Open a (new?) PHP document. This will be the loginpage.
- You will need a database connection. (Not in the current document)
- Now you have to set up the behavior.
- To access this serverbehavior, go to serverbehaviors (or klick ctrl+F9), ... towbee, ... Advanced Login Action.
- Open the behavior.
- Choose your database connenction and select the table, where the userdatas are stored.
- To use all features of the behavior, the database should have this structur:

CREATE TABLE `AdvancedLoginDemo` (
 `ID` INT( 5 ) NOT NULL AUTO_INCREMENT ,
 `username` VARCHAR( 20 ) NOT NULL ,
 `email` VARCHAR( 25 ) NOT NULL ,
 `password` VARCHAR( 20 ) NOT NULL ,
 `access_section` VARCHAR( 20 ) NOT NULL ,
 `logintrys` VARCHAR( 10 ) NOT NULL ,
 `blocked_time` VARCHAR( 25 ) NOT NULL ,
 `logincount` VARCHAR( 10 ) NOT NULL ,
 `logintime` VARCHAR( 255 ) NOT NULL ,
 `auxiliary` VARCHAR( 25 ) NOT NULL ,
 PRIMARY KEY ( `ID` )
)
The auxiliary column is needed for the activate account behavior. If you want to store more than 3 timestamps of the users login, then you have to create a text field for it.

Main tab:
- Select the database column where the usernames are stored.
- Select the column, where the passwords are stored.
- Now decide, if the user have to type in upper and lower case, or it makes no different. e.g: username or Username.
- If you want a limited access also based on an access section (eg administrator), then select this option.
- For more informations about access sections, check der DW help.
- In this case select the column where the access status are stored.
Select the column where the login trys are stored. In this field is the number how often an user logged in falsly (column for logintrys).
Select the column where the timestamp is stored if an user logs in incorrect (column for blocked time).
This fields are necessary, you have to create this two columns in your database.

Counter tab:

The „count loginaction“ function counts the number of logins from a user and saves the time and date of the logins. The database fields should be varchar. NOTE: every date and timestamp uses 20 characters! So if you want to save a lot of timestamps from the logins, then use a text field. You can change the dateformat later Now declare how long an account is blocked, if an user logged in falsly to often. Set up the date and time format. This format ist displayed and stored in the database.

More Tab:

You can choose if you want to store the (unix) timestamps in the database or the complete date, with the date and timeformat you can choose. If you want to store the timestamps in the database, then check the checkbox and in this case, you don't have to change the dateformat and timeformat. If you want, enable Account Expiration: You can offer an account which expires after a few days, like you want. You need two database columns. One column needs the registration day of the user. This have to be an unix timestamp (create it in php with time() ). In the other database column should stand the days after the account expires. E.g.: 5, for five days. If you want to remove the expiration, only delete the expiration days in the database expiration column. Then, the account is open again.

Redirects tab:

You will need an absolute URL for redirect after login. If you want to redirect the user to the page he was redirected to the loginpage, the check the option: redirect to previous url if available.

Cookies tab:

You can set up the cookie variables. But note, to save the password in a cookie is not very save.

E-Mail tab:

If you want a forgot password routine, then check the option and set up the values. You can customize the email text. But let the „$dbpassword“ variable inside. This is the password of the user.

If you want to process the password stored in the Cookie, use this function:
function pwdDecode($thepwd) {
  for($i=0; $i < strlen($thepwd); $i++) { $decodedPwd .= chr(ord($thepwd{$i})-5); }
  return $decodedPwd; }
pwdDecode($_COOKIE['password']); 
// change the name of cookie to your settings
// If you want to display the logged in users last logintime, then create a 
// database query with a query that contains the stored last logins and 
// change ist like this:
From:
 $sql_result['lastLogins']
To:
 substr($sql_result['lastLogins'],20,19)



Activate Account:
This serverbehavior creates a part of new user registration. If you did not do it yet, then provide a user registration without username, userpassword and useremail.
After the insert action the user must be passed on on the current page. Here the username, the password and the emailaddress are queried and written into the database and at the same time produced automatic email. In these email is a link contained with that the new account is activated.
Now: Create a new php- file and call the behavior. Select the database connection and table where the userdatas should be stored. Select the database columns for username, password and emailaddress. The auxiliary column needs the same characteristics as the email column. The email address is written first here inside and with the activation into the emailaddresses column. Now you can write still another its own text, which is indicated, if double usernames are present and get their own email message a those the user dispatched. Do not change “$activatelink”. Linebreaks are produced with \n.