Change your password tool

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.
kether
 
 
Posts: 31
Joined: Sun Oct 22, 2017 11:34 am

Re: Change your password tool

Post by kether » Fri Mar 29, 2019 5:21 pm

Pablo wrote:
Fri Mar 29, 2019 4:44 pm
Maybe the "change password" page is in another folder?
Yes, it's in another folder, but when I put any other tool in the same folder on the page of this member, it works without problems with the same database
Pablo wrote:
Fri Mar 29, 2019 4:44 pm
What is the PHP code of the page?
<?php
if (session_id() == "")
{
session_start();
}
if (session_id() == "")
{
session_start();
}
if (!isset($_SESSION['username']))
{
header('Location: ./../../pages/pageno.php');
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: ./../../pages/pageno.php');
exit;
}
}
$users = array("kether");
if (!in_array($_SESSION['username'], $users))
{
header('Location: ./../../pages/pageno.php');
exit;
}
if (session_id() == "")
{
session_start();
}
$error_message = "";
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['form_name']) && $_POST['form_name'] == 'changepassword')
{
$database = 'osaok.php';
$success_page = '';
if (!isset($_SESSION['username']))
{
$error_message = 'Not logged in!';
}
else
if (filesize($database) == 0)
{
$error_message = 'User database not found!';
}
else
{
$password_value = md5($_POST['password']);
$newpassword = md5($_POST['newpassword']);
$confirmpassword = md5($_POST['confirmpassword']);
$username_value = $_SESSION['username'];
if ($newpassword != $confirmpassword)
{
$error_message = 'The confirm new password must match the new password entry';
}
else
if (!preg_match("/^[A-Za-z0-9_!@$]{1,50}$/", $newpassword))
{
$error_message = 'New password is not valid, please check and try again!';
}
else
{
$items = file($database, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach($items as $line)
{
list($username, $password) = explode('|', trim($line));
if ($username_value == $username)
{
if ($password_value != $password)
{
$error_message = 'Old password is not valid!';
break;
}
}
}
if (empty($error_message))
{
$file = fopen($database, 'w');
foreach($items as $line)
{
$values = explode('|', trim($line));
if ($username_value == $values[0])
{
$values[1] = $newpassword;
$line = '';
for ($i=0; $i < count($values); $i++)
{
if ($i != 0)
$line .= '|';
$line .= $values[$i];
}
}
fwrite($file, $line);
fwrite($file, "\r\n");
}
fclose($file);
header('Location: '.$success_page);
exit;
}
}
}
}
?>
Pablo wrote:
Fri Mar 29, 2019 4:44 pm
What is the location of the page?
http://www.orsaf.be/membres/115/pages/compte.php

Thanks a lot for your help

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

Re: Change your password tool

Post by Pablo » Fri Mar 29, 2019 5:31 pm

The database is configured as:
'osaok.php'

This means that it should be is the same folder as the page.

Your page is here:
http://www.orsaf.be/membres/115/pages/compte.php

So, the database should be here:
http://www.orsaf.be/membres/115/pages/osaok.php

According to the server, the file does not exists in this folder.

kether
 
 
Posts: 31
Joined: Sun Oct 22, 2017 11:34 am

Re: Change your password tool

Post by kether » Fri Mar 29, 2019 7:40 pm

Pablo wrote:
Fri Mar 29, 2019 5:31 pm
So, the database should be here:
http://www.orsaf.be/membres/115/pages/osaok.php

According to the server, the file does not exists in this folder.
This is a member area where each member has their own pages and redirects. When I put any tool (login, password, registration, etc.) on this page of this member, everything works perfectly when I edit the database. There is only this tool "change password" that gives the error message that the database was not found on the server, etc. I put the database where you indicated, but I still have the same error message when i edit the database

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

Re: Change your password tool

Post by Pablo » Fri Mar 29, 2019 9:36 pm

The page seems to be referring to itself. This is not correct, the browser will go into an endless loop.

Code: Select all

header('Location: ./../../pages/pageno.php');

kether
 
 
Posts: 31
Joined: Sun Oct 22, 2017 11:34 am

Re: Change your password tool

Post by kether » Sat Mar 30, 2019 11:36 am

Pablo wrote:
Fri Mar 29, 2019 9:36 pm
The page seems to be referring to itself. This is not correct, the browser will go into an endless loop.

Code: Select all

header('Location: ./../../pages/pageno.php');
This page is not a problem. This is a personalized redirect page. All members have that. The problem is really only with this tool "change password". I can take a blank page and I put all the tools, and they work without any problem with the database, except the tool "change the password". I can edit the database locally with all the tools except with the "change password".

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

Re: Change your password tool

Post by Pablo » Sat Mar 30, 2019 11:44 am

I'm sorry, but there must be an error in the logic of the page.

Firstly, it looks like you have added a 'protected page' object., so this mean that the page cannot be reached until you login.
If the user is not logged, he will be redirect to
./../../pages/pageno.php -> http://www.orsaf.be/membres/pageno.php
This page does not seem to exist.

I really think you should simplify your folder structure and make sure all files are in the correct folders.
Based on the HTML code I currently do not see any logic in it.

kether
 
 
Posts: 31
Joined: Sun Oct 22, 2017 11:34 am

Re: Change your password tool

Post by kether » Sat Mar 30, 2019 1:34 pm

Pablo wrote:
Sat Mar 30, 2019 11:44 am
I'm sorry, but there must be an error in the logic of the page.

Firstly, it looks like you have added a 'protected page' object., so this mean that the page cannot be reached until you login.
I think if there was an error on the page, all the tools would not work. But all work except "change the password". Actually, the member must be connected. My problem is not there! Sideways, everything is working properly
Pablo wrote:
Sat Mar 30, 2019 11:44 am
If the user is not logged, he will be redirect to
./../../pages/pageno.php -> http://www.orsaf.be/membres/pageno.php
This page does not seem to exist.
Actually! The member will be redirect to this page "pageno.php", and this page exists. it's a redirect page in which each member is redirected to his own page. Everything works perfectly.
Pablo wrote:
Sat Mar 30, 2019 11:44 am
I really think you should simplify your folder structure and make sure all files are in the correct folders.
Based on the HTML code I currently do not see any logic in it.
OK but i think I do not get it right: my database is "osaok.php" (flat file). When I create, for example, a new blank page and I put all tools (login, forgotten password, register, edit the profile and change the password), ALL tools work without problem with the database, except the tool "change password". When I say that all tools work well, it means that I can edit the database locally from all the tools. When I am logged in and want to change my password through the "change password" tool, which is on my "account.php" page, I am redirected to the landing page, but the word page is not changed!
Even when I create a blank page at the root of the site, and for which I have not made any configuration, this tool still does not work and I have the same error message, while all others work. With all other tools I can edit the database without problems, except with this one ...

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

Re: Change your password tool

Post by Pablo » Sat Mar 30, 2019 3:44 pm

ALL tools work without problem with the database, except the tool "change password".
Maybe this tools has different settings?

Note that all login tools must be on a separate page.
From the help:
It is strongly advised to use only one form per page to prevent conflicts between the scripts.

Also note that I cannot exactly see what you have done based on the code only.
To be able to say anything meaningful about this, I need the project file.
See also: viewtopic.php?f=10&t=82134

kether
 
 
Posts: 31
Joined: Sun Oct 22, 2017 11:34 am

Re: Change your password tool

Post by kether » Sun Mar 31, 2019 12:53 pm

Hi,
Here is the link of my .wbs project.
http://www.orsaf.be/test-pablo/test-pablo.wbs

I put 3 different tools: login, change the password and recover the password. In the 3 tools, there is the same database "test.php", which is in flat file. When I edit the database with the tools "connect" and "recover password", it works without any problem. But when I want to edit the database with the tool "change password", I have an error message. I did not put any personal configuration. I just created my database.
What I want, is that each member can change his password from his space that will contain the tool "change the password".
Thanks for the help

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

Re: Change your password tool

Post by Pablo » Sun Mar 31, 2019 1:46 pm

I'm sorry, but the implementation is not correct. Each form should be on a different page.
Also, note that you are using an older version. The login tools have many improvement in recent versions.

kether
 
 
Posts: 31
Joined: Sun Oct 22, 2017 11:34 am

Re: Change your password tool

Post by kether » Sun Mar 31, 2019 5:47 pm

Pablo wrote:
Sun Mar 31, 2019 1:46 pm
I'm sorry, but the implementation is not correct. Each form should be on a different page.
Also, note that you are using an older version. The login tools have many improvement in recent versions.
OK pablo, I will update to migrate to version 14 in April. But if it was a question of updating the tool or the program, should not the other tools have the same problem?
I put the tool in a single page, the "test" page, but the problem persists. Is it still an implementation problem?
If you could check the 3 tools that I put on the same page, by editing the database, you would have found that, only with the tool "change the password", we can not edit the database.
Here is the new link for the .wbs project. Can you, please, verify it?
http://www.orsaf.be/test-pablo/test-pablo.wbs

kether
 
 
Posts: 31
Joined: Sun Oct 22, 2017 11:34 am

Re: Change your password tool

Post by kether » Sun Mar 31, 2019 5:50 pm

Here is the image of the message error
Image

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

Re: Change your password tool

Post by Pablo » Sun Mar 31, 2019 8:29 pm

But if it was a question of updating the tool or the program, should not the other tools have the same problem?
There have been many changes/fixes since version 12.0.0, so the issue may have been addressed in one of these updates.
Please install the latest version first, to make sure this has not already been fixed.
Here is the new link for the .wbs project. Can you, please, verify it?
http://www.orsaf.be/test-pablo/test-pablo.wbs
It works for me, after putting 'test.php' on the server.
Tested with version 14.3.3

kether
 
 
Posts: 31
Joined: Sun Oct 22, 2017 11:34 am

Re: Change your password tool

Post by kether » Mon Apr 01, 2019 7:45 am

OK. I'm going to update to the version 14 this week. Thank you very much for your help and your availability. How to put the subject "resolved"?

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

Re: Change your password tool

Post by Pablo » Mon Apr 01, 2019 8:58 am

Did you try if it works for you in WB14?

Post Reply