Welcome to the nuBuilder Forums!
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
Login script
-
- Posts: 36
- Joined: Sat Jun 02, 2018 1:26 pm
Login script
How do I execute a PHP script right after a user has logged in? The script should only be executed once and the condition should be that an error message is displayed if a user logs in and the IP address is not in a white list. Thank you.
Re: Login script
amit,
Firstly create a Launch Form for each of the Access Levels you would like to check.
https://wiki.nubuilder.cloud/ ... .php/Forms
And then apply the Launch Form to that Access Level.
https://wiki.nubuilder.cloud/ ... cess_Level
Then in the Custom Code Tab of the Launch Form's properties, you can add add PHP, by Clicking on the Before Edit Button.
Then you can use a Hash Cookie to help get the User's information.
https://wiki.nubuilder.cloud/ ... sh_Cookies
Steven
Firstly create a Launch Form for each of the Access Levels you would like to check.
https://wiki.nubuilder.cloud/ ... .php/Forms
And then apply the Launch Form to that Access Level.
https://wiki.nubuilder.cloud/ ... cess_Level
Then in the Custom Code Tab of the Launch Form's properties, you can add add PHP, by Clicking on the Before Edit Button.
Then you can use a Hash Cookie to help get the User's information.
https://wiki.nubuilder.cloud/ ... sh_Cookies
Steven
-
- Posts: 36
- Joined: Sat Jun 02, 2018 1:26 pm
Re: Login script
Thanks, this is what I have so far:
$remoteAddr = $_SERVER['REMOTE_ADDR'];
$ipWhiteList = array("116.100.119.120", "199.36.152.45",);
if (! in_array($remoteAddr, $ipWhiteList)) {
Logout the user here
}
If the IP is not in the whitelist, the user has to be logged out as he is not allowed to access nubuilder.
How can I do this?
$remoteAddr = $_SERVER['REMOTE_ADDR'];
$ipWhiteList = array("116.100.119.120", "199.36.152.45",);
if (! in_array($remoteAddr, $ipWhiteList)) {
Logout the user here
}
If the IP is not in the whitelist, the user has to be logged out as he is not allowed to access nubuilder.
How can I do this?
-
- Posts: 785
- Joined: Sun Oct 14, 2018 11:25 am
Re: Login script
Try this:
Code: Select all
$remoteAddr = $_SERVER['REMOTE_ADDR'];
$ipWhiteList = array("116.100.119.120", "199.36.152.45",);
if (! in_array($remoteAddr, $ipWhiteList)) {
nuDisplayError("Invalid Login");
}
-
- Posts: 36
- Joined: Sat Jun 02, 2018 1:26 pm