Login object - remember me

This section is for posting questions which are not directly related to WYSIWYG Web Builder.
Examples of off topics: web server configuration, hosting, programming related questions, third party scripts.

Note that these questions will generally not be answered by the administrators of this forum.
Post Reply
User avatar
alex4orly
 
 
Posts: 567
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Login object - remember me

Post by alex4orly » Thu Aug 23, 2018 10:30 pm

I look at the code generated here by WWB, at the end of it there are 2 lines

setcookie('username', $_POST['username'], time() + 3600*24*30);
setcookie('password', $_POST['password'], time() + 3600*24*30);

Then, after that:
$username = isset($_COOKIE['username']) ? $_COOKIE['username'] : '';
$password = isset($_COOKIE['password']) ? $_COOKIE['password'] : '';

1) It seems that there are 2 cookies created, why? Can't I create a cookie with several elemnts in it?
2) I want to store the flag $active 0 or 1 in it to be interrogated at log in time, do I need a 3rd cookie for that?

Cheers

User avatar
Pablo
 
Posts: 14581
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Re: Login object - remember me

Post by Pablo » Fri Aug 24, 2018 6:52 am

You can find more information about setcookie here:
http://php.net/manual/en/function.setcookie.php

User avatar
alex4orly
 
 
Posts: 567
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Login object - remember me

Post by alex4orly » Fri Aug 24, 2018 8:32 am

This answers my first question, from the article I can see how to have multiple elemnt in ONE Cookie, but

1) Whay is that not used in the PHP code generated by WWB when using the Login object?
2) What is the purpose of the final two lines? Is that just so that those values become available to subsequent pages? If this is the case, I can consider what to do. Please let me know

Thanks

User avatar
Pablo
 
Posts: 14581
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Re: Login object - remember me

Post by Pablo » Fri Aug 24, 2018 9:28 am

I just choose to implement it this way. If do not like it this way then you can write your own code.
The code puts the cookie value into a PHP variable.

Please note that I generally do not discuss generated code. This is beyond the scope of this forum.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests