Logout user from a text database

Issues related to the Login tools of WYSIWYG Web Builder.
Forum rules
PLEASE READ THE FORUM RULES BEFORE YOU POST:
viewtopic.php?f=12&t=1901

MUST READ:
http://www.wysiwygwebbuilder.com/login_basics.html
http://www.wysiwygwebbuilder.com/login_tools.html

TIP:
A lot of information about the login tools can be found in the help/manual.
Also checkout the demo template that is include with the software.
Post Reply
Aris
 
 
Posts: 238
Joined: Wed Aug 28, 2013 9:28 am

Logout user from a text database

Post by Aris » Fri Jun 16, 2017 8:48 pm

Hi.

I have a text database on my server.

When a user choose to log out,

1. His/her information remain on the database?
2. If the answer to the question 1 is YES, this means that I must delete this information by hand?
3. If the answer to the question 1 is NO, when or how it will be deleted?

I would wish the user information to be deleted automatically...
Is there some other choice?

Thank you.

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

Re: Logout user from a text database

Post by Pablo » Fri Jun 16, 2017 8:57 pm

1. His/her information remain on the database?
Yes
2. If the answer to the question 1 is YES, this means that I must delete this information by hand?
No. Why?
3. If the answer to the question 1 is NO, when or how it will be deleted?
The login state will not be stored in the database, only the username/password.
The login session will end as soon as the user closes the browser or when the timeout expires.
https://www.w3schools.com/php/php_sessions.asp

Aris
 
 
Posts: 238
Joined: Wed Aug 28, 2013 9:28 am

Re: Logout user from a text database

Post by Aris » Fri Jun 16, 2017 9:09 pm

Thank you, Pablo.
The login session will end as soon as the user closes the browser or when the timeout expires.
This means (if I understand well) that when the user closes the browser and he open it again, he will cannot login with the same username and password?

User avatar
Biju
 
 
Posts: 356
Joined: Thu Mar 10, 2016 7:02 pm
Location: Kerala, INDIA.

Re: Logout user from a text database

Post by Biju » Sat Jun 17, 2017 4:06 am

This means (if I understand well) that when the user closes the browser and he open it again, he will cannot login with the same username and password?
.Yes he can; since the username /password remains unchanged even if he closed the browser. See Pablo's answer below:
The login state will not be stored in the database, only the username/password.
~ Remain Curious
and Keep Learning ~

_________________

Aris
 
 
Posts: 238
Joined: Wed Aug 28, 2013 9:28 am

Re: Logout user from a text database

Post by Aris » Sat Jun 17, 2017 5:14 am

I understand what you write, but I cannot find the solution to the problem.

Probably I I have made something wrong.

All the web pages have the extension .php

The logout page is a protected (with the lock) web page with the logout button?
Is it correct?

On the Object properties > Logout of the logout button I made a "than you page": ./logout_thank_you.php
Is it correct?

In the Page HTML of the logout page (start of page) I read the following code:

Code: Select all

<?php
if (session_id() == "")
{
   session_start();
}
if (!isset($_SESSION['username']))
{
   header('Location: #');
   exit;
}
if (isset($_SESSION['expires_by']))
{
   $expires_by = intval($_SESSION['expires_by']);
   if (time() < $expires_by)
   {
      $_SESSION['expires_by'] = time() + intval($_SESSION['expires_timeout']);
   }
   else
   {
      unset($_SESSION['username']);
      unset($_SESSION['expires_by']);
      unset($_SESSION['expires_timeout']);
      header('Location: #');
      exit;
   }
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['form_name']) && $_POST['form_name'] == 'logoutform')
{
   if (session_id() == "")
   {
      session_start();
   }
   unset($_SESSION['username']);
   unset($_SESSION['fullname']);
   header('Location: ./logout_thank_you.php');
   exit;
}
?>
Do you see something wrong here?

The login session will end as soon as the user closes the browser or when the timeout expires.

I have read https://www.w3schools.com/php/php_sessions.asp, but I cannot understand whether I must change something on my page:
Last night I created a user (sign up) on my computer. I used logout. But today I can login with the same username and password.

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

Re: Logout user from a text database

Post by Pablo » Sat Jun 17, 2017 6:56 am

But today I can login with the same username and password.
Correct. Nothing is wrong. This is how it works. Why would you need a different username/password?

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests