Code

Discussion on Advanced Security - PHP Register/Login System

Discussion on Advanced Security - PHP Register/Login System

Cart 2,756 sales

niftycode supports this item

Supported

This author's response time can be up to 1 business day.

1144 comments found.

Hello Milos,

I got serious problem to run AS in mobile environments. I’ve been testing it under iPhone/iPad/Macbook Pro (All OS is the latest ver.). I had no issue on Macbook(Safari/Chrome/Firefox). However, using iphone/ipad, AS runs really unreliable way. I’m talking about the symptom as I don’t have idea about the root cause. Hereafter I’ve summarized the symptom for your better view; 1. Either logging in on Macbook or not, iphone and ipad LOSES its connection quite often. 2. I don’t see any delay to connect server on Macbook, but on iphone/ipad, the ANNOYING DELAY is monitored. Yes, quite often. 3. Quite often, logging in and logging out on iphone/ipad takes more than 20 sec. 4. logging in iphone with an ID, trying to connect with same ID on Macbook, iPhone loses connection right away.

Can you guide me how I can start the debugging with your hypothesis on the root cause? Thank you. Jason Purchase code :1a06eba0-921a-49d0-ba03-0760447a6b2c

Hey,

Well you will know if session has expired since you will be redirected to login page in that case. Have you tried to set the LOGIN_FINGERPRINT to false inside ASConfig.php file? Maybe your IP is changing very often and that’s why you are being logged out. Check http://docs.as-php.com/configuration.html#login for more info.

There should not be any difference weather you are accessing from mobile or a computer and in AS it doesn’t matter how many active sessions you have for specific user, which means that you can be logged in to the same account on any number of devices at the same time.

To monitor server activity I usually SSH to the server and use some linux tools programs like “htop” or similar. However, maybe GoDaddy offers something from their admin area where you can see the server usage and stuff like that.

About such huge delay when you fetch some HTML via ajax, it can be also related to the DNS resolving issues, but since everything is working properly on your computer, then it’s most likely not the case here.

Regards,

Milos

Hi Milos, Thank you very much for your support. I’ll definitely try as you guided. Most of all though can you let me know how I can take the moments that the IP is being changed to cause the problem? Four instance, using var_dump() like function( probably useless since it is already disconnected under the problem), storing the ip changes in a file or any tool?

Thank you

Hey,

Well if you disable LOGIN_FINGERPRINT then IP changing won’t affect your session. If you still want to see if IP has changed or not, then I would suggest some kind of simple logging which will put the IP address into some log file on each request, so you can see if it changes often. Such logging system does not exist in AS, but you can easily add it, since it will just put the IP address from the request into a file, which is pretty easy to implement.

Regards,

Milos

hi, I should implement db session instead of cookies but can’t be static.

How can I do? Outside of the container?

Made with service container and app. But now when I try to login I receive the following error: ASLibrary/js/login.js:43 Uncaught ReferenceError: $_lang is not defined “asengine.loadingButton(btn, $_lang.logging_in);”

Hey,

That’s because you are have not included js-boostrap.php script on the page or it is not loading for some reason, which you can check from your browser’s console. It should be included inside the <head></head> element of the page, like following (make sure that path is correct if you have moved login.php file to some other directory):

<script type="text/javascript" src="ASLibrary/js/js-bootstrap.php"></script>

Regards,

Milos

Very strange, nothing has been changed outside ASEngine… I try to check. Thanks

Hi – I am having some issues installing this script. When I run the installation, it hangs on the last step, and I see in Chrome debugger the error: Warning: _wpe_old_file_put_contents(/nas/content/live/satistar/auth/install/../ASEngine/ASConfig.php): failed to open stream: Permission denied in /opt/nas/www/common/production/php_prevent_flock.php on line 58

It appears there is a permissions issue with creating the ASConfig.php file. I contacted my web host, and their support me they do not allow me to change any directory to “777” permissions for security reasons.

Is there a way to manually install this without running the installer? Or can I run the installer on another host and just copy the files over? How can I get around this?

Hey,

Yeah, it looks like the app cannot create the ASConfig.php file properly. Have you tried to set the ASEngine directory permissions to 775 or 755?

About manually installing the app, the easiest way is to install it on your localhost and then upload the ASEngine/ASConfig.php file directly to your server (that file is generated after successful installation) and update database credentials inside of it. You will also need to export/dump the database tables generated after the installation process from your localhost and import them on your server.

Regards,

Milos

dup

dup Purchased

Hello Milos, me again with a problem of redirection.I use the method of login.php?to=....
all my script are ok and works if at the final I have something like this: window.open("../security/login.php?to=https://www.google.ch/");
but if the url is one from paypal like this: window.open("../security/login.php?to=https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=U4.......");
it generate an error on paypal: beacuse in fact the url is not complete, it finished after the s-xclick: https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_s-xclick A solution? Best regards Dup
dup

dup Purchased

Thanks again but the problem is in the login.js in success: function (result) { for simple form dropdown inside a page we must write

location.reload();
for somethings else:
window.location = result.page;
for a modal colorbox:

window.opener.location.reload();
     parent.$.colorbox.close();
so I’m a little confused how to manage all! so finally perhaps the solution is to use allways a modal but you tsaid me that it was not good to open your default login.php like this.why? too much questios that take your time. best regards dup

Hey,

Well this is really your implementation detail and it does not belong to the support I provide. In general there are a ton of ways to implement something like this, and how would I probably do it is just by defining a global javascript variable on the page before you include the login.js and set it to some page specific value (for example

<script>var pageType = 'modal';</script>

Then inside login.js you can just check like if (pageType == 'modal') ... and so on.

Or, again, you can always standardize it and use modal, but then you should not open the login.php entirely inside an iFrame or something since there is no need for that and can cause complications with how things are implemented. Instead, you can just extract the content you need from login.php file and add it inside a modal directly.

Regards,

Milos

dup

dup Purchased

Hey Great : with your answer I understanded a lot! Last week when I was blocked with too codes problems, I bought other script but yours is the best and your patience incredible! I also found a solution that can help other to the problem of “modal”: as I have a dropown menu to login and a button at the bottom of the same page to open the modal via featherlight.js: conflit because same “id” in the page and in the modal:

id="login-username",
id="login-password",
id="btn-login" 
so when the modal open the login doesn’t work! I don’t know if a problem of featherlight.js or all lightbox will do the same. so I put on button this code to bypass the problem.

$('.popup').click(function() { $('.loginDropdown').html('');});
$('.popup').featherlight('my_login_form_02.php');
regards

How can I get in touch via email since here I can not leave the comment with the format that I need (to be understood). Thank you!

Hi, Does this have integrated payments?

Hey,

Unfortunately, as you can see from the demo, there are no payments integrated into this system.

Regards,

Milos

Could you help me a bit with this? It’s causing a few errors on my page when I install it, and the documentation isn’t helpful. Discord @ zenful#0348

Alright, so it turns out the script really is riddled with vulnerabilities, and cant really be fixed without completely tearing the script apart. This is not good, and this is not what I paid for either.

I am not smart enough to actually provide an example of SQL injection but I am sure that someone will want to do it.

Look at this article about prepared statements also: https://www.owasp.org/index.php/SQL_Injection_Prevention_Cheat_Sheet#Defense_Option_1:_Prepared_Statements_.28with_Parameterized_Queries.29

Hey,

Well if you claim something like this, I expect that you will provide some example on how it should be exploited. The link you pasted above represent just some general info about prepared statements, which are already being used by AS script properly. I really don’t have time to explain to someone that some function I wrote is working properly and instead I expect that when someone claims that it is vulnerable he also provides an example on how it can be exploited…

Now, if you think that you have found some (other) potential vulnerabilities, please be more specific about it so I can see what you are talking about and provide more info about it. Saying something pretty serious like “it turns out the script really is riddled with vulnerabilities” without actually pointing out what you think that those vulnerabilities are is just absurd.

Regards,

Milos

It’s alright. I have someone who has already identified the problems, and is explaining them to me now. Hopefully he will be more understanding of the problems. Thanks for the help. :/

I would need to directly enter the database for the users (I already have the data) and they are enabled to enter. But you enter data manually into the database and the system does not recognize them. Thank you

Hey,

You can enter any user data to the database manually, but in such case password won’t be hashed properly and users won’t be able to log in until they reset their password. Don’t forget that if you are adding users manually, user data must also be stored inside as_user_details table and not just as_users, and if you don’t create even empty rows inside that table for each user it will probably break the app.

Regards,

Milos

I want to thank Milos for his patience and speed in the technical support, to try to solve a problem with the script that actually (as Milos said) was a permissions problem on the server. Thank you very much for the dedication Milos!

Hey,

No problem, I’m glad that it is working properly now. :)

Regards,

Milos

dup

dup Purchased

Hello I bought your script 2 days ago : great but need help: I want to use the script like here in “envato” a button on page that call your “login.php” in popup and when the people clic on “login” I want the popup to close and return to the page: I can’t achieve that I’m allways redirect to xour” index.php”! I try to the redirect in the “loggin.php” but allways go to the index.php Best regards

dup

dup Purchased

hi Milos Thanks again I think I found the mistake I made with your working solution above. I opened your login.php with a popup jquery
$('.log').featherlight('../security/login.php?to=http://google.com');
So I think that popup in jquery is not possible with this method? Best regards Dup

Hey Dup,

I asked you multiple times how you display the login form, weather it is a popup or you redirect users to a login page, but I never got a precise answer. :)

Anyways, it’s not recommended to display login form like that. Either redirect the user to a login page or add the form directly on your page, without loading the whole actual login.php file with featherlight plugin.

So, if you want to have a modal popup, don’t load the whole login.php page with featherlight plugin, just include required content on any of your pages and display regular modal which does not load the external file. In that case, the method I described in one of my first answers above for handling the login inside a modal will work just fine.

Regards,

Milos

dup

dup Purchased

Hi Milos, I finally understand a little better and found the key of the tank of your Cadillac. I will certainly find the other keys next days to test the real power! THANKS AGAIN for your patience and kindness. Have a good week-end. And don’t forget: +1 for the next paypal adventure ;-) regards Dup

Hello, i just buy a licence for advanced security. This seem to work well but i don’t understand how i can redirect logged user to a specific url?

Can you tell me the code to write and where?

For exemple, the rôle named: test should go to: http://google.be

Thanks !

My item purchase code: d27e4d5a-cf1f-4d38-86ea-8575cfa05c03

Hey,

Well if you want to redirect user with role “test” to “http://google.be”, all you need to do is to update the “SUCCESS_LOGIN_REDIRECT” constant inside ASEngine/ASConfig.php file to look like following:

define('SUCCESS_LOGIN_REDIRECT', serialize(array('default' => "index.php", "test" => "http://google.be")));

And that should do the trick and redirect the users with “test” role to google.be after successful authentication. :)

Regards,

Milos

Hello Milos, I try to configure and install but it stays forever on the screen that I should check the database (and that box appears pink without text) so I was reading in other comments that has been a recurring problem. I am a beginner user and it is difficult for me to solve the situation. I would appreciate if you guided me in the initial configuration. Thank you.

the web where I’m testing is grupalmedia.com

Hey,

Lets see what the issue is. :)

From what I’ve checked on the link you provided everything looks ok, however I cannot install it since I don’t have the DB credentials. Can you please send me the db info via contact form on my CodeCanyon profile page so I can try to actually install it on your server and see exactly what issues you have?

Regards,

Milos

dup

dup Purchased

Hi, One question before to buy Is it possible to implant paypal? and change the role of users? Like if payed permissions is superior? best regards

Hey,

Well after you purchase the app you get whole source code, so if you are familiar with Laravel you can implement anything you need. However, PayPal does not come out of the box and you will actually have to do the coding and implement it manually.

Regards,

Milos

I have installed Advanced Security – PHP Register/Login System. I can login and I have it redirecting to a page and that page loads fine. But when I submit the form which submit to the same page I get this.

Invalid CSRF token.

On the redirected page I do have this.

include ‘ASEngine/AS.php’;

if (! app(‘login’)->isLoggedIn()) { redirect(“login.php”); }

Hi, loving the script and started to work it into my design. I placed login/register as an option and linked to login.php.

Is there a way to return users to their current page after login?

ex: index.php?p=about or index.php?p=contact

Thanks!

Hey,

Well out of the box there is no such option, however it is pretty easy to implement. Here is how you can implement that:

Let’s say that when users click on your login link, you implement your login link to look like following: login.php?to=about.php

1. On top of login.php file, right after you require AS.php file and check if user is logged in, you can add this


$redirectPage = isset($_GET['to']) ? $_GET['to'] : get_redirect_page(); // get redirect page will return default redirect page for current user according to his role

ASSession::set('redirect', $redirectPage);

2. Inside ASLogin.php file, at the bottom of userLogin method, you will modify the redirect to look like following:


 respond(array(
    'status' => 'success',
    'page' => ASSession::get('redirect')
));

Regards,

Milos

Hi, I bought the AS login package today. Just wondering how I would go about grabbing current logged in user’s details to echo.

One usage for example is to echo a name:

Welcome back <User’s Name>,

Thank you.

Hey,

Please check the documentation at the following link: http://docs.as-php.com/current-user.html

Regards,

Milos

Thank you.

Hey Milos,

Great script!

After logging in my session will last ~30 minutes or less before I’m asked to log back in.

Is there a way to fix this? ASSessions.php has the cookie expiration set at “lifetime”. Is there somewhere else I should check?

Thanks! Jeff

Hey Jeff,

Well by default session will last as long as you keep the browser open. This means that once you close the browser session cookie will immediately expire, no matter if you were logged in for 5 minutes or few hours.

To change this behavior just update the ASSession.php file and inside startSession method replace

$cookieParams["lifetime"]
with an integer which represents the session cookie lifetime in seconds. For example:

 session_set_cookie_params(
            60*60*24, // session cookie will now be valid for 24 hours
            //...
        );

Regards,

Milos

Hey Milos,

Thanks for the quick reply!

I keep getting logged out, with the browser window open. My setting is:

$cookieParams[“lifetime”]

Any reason why this would be happening?

Thanks Again, Jeff

Hey Jeff,

Hmmm… Really don’t have an idea. Is that clean AS installation or you have modified some things?

Regards,

Milos

Hi! Considering to buy this. How is this script to translate for use on a norwegian website? Is there seperate language files to make it easy to make a new translation?

Hey,

You can easily translate it to any language you want just by updating the language file. More about the localization is available inside the docs: http://docs.as-php.com/localization.html

Regards,

Milos

Hi, I was going through the documentation but I couldn’t see this info. How can I access the current user information through javascript? Thanks..

Hey,

I’m sorry but your support for this item has expired. Please extend the support if you need my help.

Regards,

Milos

Is it possible to login via Ajax call ?

Thanks for the response. Is ASAjax.php documented or do I have to analyse the PHP code ?

Hey,

It’s not inside the documentation, but actually there is really nothing to document there. :) It is pretty simple and if you take a look at it you will see how it works. Basically you just send specific “action” value and then depending on that action value you execute specific code.

But anyways, you don’t have to use ASAjax.php if you don’t want to. You can create your own files that will handle AJAX requests and just include ASEngine/AS.php on top of them so you can get access to all AS related features.

Regards,

Milos

Thanks again.

by
by
by
by
by
by

Tell us what you think!

We'd like to ask you a few questions to help improve CodeCanyon.

Sure, take me to the survey