Is there a timed session option with this? I need this for a client site and I need limited logged-in sessions. Before I purchase this I just wanted to know if this is a configurable option with this product, where I can have login sessions time-out or just force the user to be logged out upon browser window close.
this does not provide that functionality, but it can be done with one line of code
3600 should be the number of seconds the session will last for
I just purchased Advanced PHP Protection and was wondering where the code for the time out go as described in the previous comment?
I also do not see how to allow multiple users in the code. How do I enable this for MySQL?
The timeout code needs to go anywhere before the session is started, so just put it at the very top of the file.
A basic example of MySQL integration is in the documentation, it’s not really a feature of this item so there is not thing to enable exactly.
You are indeed correct about the example in the documentation. I’m sorry that I missed it before initially posting about it. I look forward to using your code!
This of this as a way to prompt the user for a password and check it against the one you pass to the function, so all you need to do is give it the username and password form the database and it should work.
In the example.php file, I think you should change this line of code:
header('Location: ' . $_SERVER['PHP_SELF']);
so that no matter what the end user changes the php file name to, the code will still work.
Otherwise great script. 5 stars from me!
Can this be set to a folder with php files inside, or do I actually have to put the code on each individual php file.
You have to have this code added to the files in the folder in some way. If you need to protect all of the files you could try using a auto_prepend_file.
I am using this plugin in single line mode.
What would be the code to logout?
You would have to call the logout method
This would have to be done from php not in a href of a link.
Is it possible to have multiple users with redirects? I have a site I want to post sites in progress on. The main page could have a button list or such so the customer could click on it, be prompted for password, then be passed along to the demo site.
Or, could a password screen be all that’s on the main page, and redirect customers based upon password?
Need some guidance.
This would be able to do only the password part, the rest would have to be done with your own code.
You could also have the main page with no protection and then use this item to protect each site separately which would give you the same effect but might be a little easier.
How to protect the my index.php in admin folder…...?
include the file in it ?
Nice work, 10 seconds to set 5 stars
Hmmm…just tried to include this class on my login page..
Login works nice….but…
If I have in the protected page a link like ”?logout” the browser is redirected to the default login page as expected, but with ”?logout” appended to the URL although “header: /” is sent via php…
So I have to press the login button always twice…
Okay found the bugger (o;
If I comment out following line then it works:
// $pass->custom_session_keys(‘name’, ‘pass’);
You probably want to change them to something that is not being used rather than commenting that line out. It might be the cause of the problem in your next comment.
Also seems that this class can’t be used when authenticating several php files for a site…
After authentication each new called php file (although the class is included) needs a new authentication…
You should stay logged in across multiple pages as long as the session keys are the same. I guess make sure the session variables are being set and not overwritten.
It doesn’t even stay authenticated on the same page…
Let’s say I have index.php with the authentication stuff in the beginning…
When I log in it displays correctly the rest of the php file instead of the login template).
Pressing reload the browser asks me if I want to resend the login credentials (shouldn’t happen in my opinion).
Retyping the same url I end up again at the login page…
(or just place the cursor at the end of the url and press enter)
Then your session is not working for some reason, can you try adding
at the top of the page above the password code and see if you get any errors when logging in ?
Well…it seems it doesn’t like to be authenticated against postgresql database (o;
If I replace following code with the example one it works:
$username = $_POST['username'];
$q = pg_query($conn, "SELECT password FROM users WHERE username = '$username'");
$q = pg_fetch_assoc($q);
When using md5 hash I have to supply the password as well as md5 hash…
But login won’t work until I supply the password in clear text although set_hash_type(‘md5’) is used…
Anyone using this login class with PHP >= PHP -5.4?
ERROR IN SCRIPT
THIS SEND ME THIS ERROR.
Warning: file_put_contents(C:\xampp\htdocs\proteccion\secure\bfp_files\BFP_::1.txt): failed to open stream: Invalid argument in C:\xampp\htdocs\proteccion\secure\security.class.inc.php on line 184
Warning: file_get_contents(C:\xampp\htdocs\proteccion\secure\bfp_files\BFP_::1.txt): failed to open stream: Invalid argument in C:\xampp\htdocs\proteccion\secure\security.class.inc.php on line 189
I am having a hard time with this. How can I make the page redirect upon submitting the right username and password?
I want my home page to show up with the login screen the be redirected to my sites home page.
Sorry but this looks TERRIBLE on mobile. Windows phone
Great Product !
Can’t get this to work with md5 or sha1
The demo provided doesn’t work except in straight text
hi i dont much about PHP… just bought this because i thought there will be instructions on how to install and implement this on my html website. Can I ask how can I use this for my html website?
Use, by you or one client, in a single end product which end users are not charged for. The total price includes the item price and a buyer fee.
Use, by you or one client, in a single end product which end users can be charged for. The total price includes the item price and a buyer fee.
View license details
Deliver better projects faster. Photos, templates & courses
Unlimited downloads. Only $29/month
Learn almost anything with
Envato Tuts+ for free
25,000+ tutorials and 1,000+ courses
Designers matched perfectly to
you on Envato Studio
2000 artists ready to undertake your work