Login script

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.
trenoweth
 
 
Posts: 63
Joined: Mon Feb 08, 2016 10:42 pm
Location: Punganui, New Zealand

Login script

Post by trenoweth » Sun Apr 08, 2018 12:54 am

I have been using the login script for a couple of years but have a problem I've never been able to solve. Whenever someone clicks on to the Sign up page it sends a blank email. This is in additional to those sent when someone has completed the signing up procedure. It's not the end of the world to keep deleting these blank emails, but does get a bit annoying.

The subject of the email is: New logon sign-up

The message is: Values submitted from web site form:

Nothing else. If the sign-up process is completed I then receive the correct messages.

Any idea how to stop the blank ones please?

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

Re: Login script

Post by Pablo » Sun Apr 08, 2018 7:11 am

It looks like you have (accidentally) added an empty form to the page.

trenoweth
 
 
Posts: 63
Joined: Mon Feb 08, 2016 10:42 pm
Location: Punganui, New Zealand

Re: Login script

Post by trenoweth » Mon Apr 09, 2018 12:48 am

Thanks for the suggestion, but that isn't the case as this is the one and only form in this folder on the server. The first login was set up more than two years ago and I have been trying to resolve this on and off ever since.

This weekend I set up another, dummy, one and played around with it to try and see how to stop receiving these blank messages when the login page is opened. But I could only stop it by also stopping the required data being transmitted. :cry:

What I have is:

<?php
$mailto = "email address";
$subject = "New logon sign-up";
$message = "Values submitted from web site form:";
$header = "From: ".$_POST['email'];
foreach ($_POST as $key => $value)
{
if (!is_array($value))
{
$message .= "\n".$key." : ".$value;
}
else
{
foreach ($_POST[$key] as $itemvalue)
{
$message .= "\n".$key." : ".$itemvalue;
}
}
}
mail($mailto, $subject, stripslashes($message), $header);
?><?php
if (session_id() == "")
{
session_start();
}
$database = '../usersdb.php';
$success_page = '/sign-up_thanks.shtml';
$error_message = "";
if (!file_exists($database))
{
die('User database not found!');
exit;
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['form_name']) && $_POST['form_name'] == 'signupform')
{
$newusername = $_POST['username'];
$newemail = $_POST['email'];
$newpassword = $_POST['password'];
$confirmpassword = $_POST['confirmpassword'];
$newfullname = $_POST['fullname'];
$code = 'NA';
if ($newpassword != $confirmpassword)
{
$error_message = 'Password and Confirm Password are not the same!';
}
else
if (!preg_match("/^[A-Za-z0-9_!@$]{1,50}$/", $newusername))
{
$error_message = 'Username is not valid, please check and try again!';
}
else
if (!preg_match("/^[A-Za-z0-9_!@$]{1,50}$/", $newpassword))
{
$error_message = 'Password is not valid, please check and try again!';
}
else
if (!preg_match("/^[A-Za-z0-9_!@$.' &]{1,50}$/", $newfullname))
{
$error_message = 'Fullname is not valid, please check and try again!';
}
else
if (!preg_match("/^.+@.+\..+$/", $newemail))
{
$error_message = 'Email is not a valid email address. Please check and try again.';
}
$items = file($database, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach($items as $line)
{
list($username, $password, $email, $fullname) = explode('|', trim($line));
if ($newusername == $username)
{
$error_message = 'This User Name is already in use. Please try another.';
break;
}
}
if (empty($error_message))
{
$file = fopen($database, 'a');
fwrite($file, $newusername);
fwrite($file, '|');
fwrite($file, md5($newpassword));
fwrite($file, '|');
fwrite($file, $newemail);
fwrite($file, '|');
fwrite($file, $newfullname);
fwrite($file, '|0|');
fwrite($file, $code);
fwrite($file, "\r\n");
fclose($file);
$subject = 'New logon sign-up';
$message = 'You have just signed-up. Please wait for an e-mail confirmation that your login has been activated';
$message .= "\r\nUsername: ";
$message .= $newusername;
$message .= "\r\nPassword: ";
$message .= $newpassword;
$message .= "\r\n";
$header = "From: email address"."\r\n";
$header .= "Reply-To: email addess"."\r\n";
$header .= "MIME-Version: 1.0"."\r\n";
$header .= "Content-Type: text/plain; charset=utf-8"."\r\n";
$header .= "Content-Transfer-Encoding: 8bit"."\r\n";
$header .= "X-Mailer: PHP v".phpversion();
mail($newemail, $subject, $message, $header);
mail('email address', $subject, $message, $header);
header('Location: '.$success_page);
exit;
}
}
?>

As soon as this file is showing on screen it sends the almost blank email:
"Subject: New logon sign-up"
and In the body of the email:
"Values submitted from web site form:"

As I read it the top few lines would seem to generate this message but if I take out:

$mailto = "email address";
$subject = "New logon sign-up";
$message = "Values submitted from web site form:";
$header = "From: ".$_POST['email'];
foreach ($_POST as $key => $value)
{
if (!is_array($value))
{
$message .= "\n".$key." : ".$value;
}
else
{
foreach ($_POST[$key] as $itemvalue)
{
$message .= "\n".$key." : ".$itemvalue;
}
}
}

then the blank message doesn't arrive, but after clicking on 'Create' nor do the full details arrive, just a message with:
"You have just signed-up. Please wait for an e-mail confirmation that your login has been activated
Username: MichaelM
Password: micky"

No full name, no email address

There is nowhere else where the phrase "Values submitted from web site form" is to be found, so it has to be something to do with this.

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

Re: Login script

Post by Pablo » Mon Apr 09, 2018 5:52 am

It looks like you have manually added a script at the start of the page.
As a matter of fact it looks exactly like this script:
http://wysiwygwebbuilder.com/forms_php.html

Please remove all manually added code from the page.

trenoweth
 
 
Posts: 63
Joined: Mon Feb 08, 2016 10:42 pm
Location: Punganui, New Zealand

Re: Login script

Post by trenoweth » Sat Apr 14, 2018 5:06 am

Removing the instructions, which are a necessary part of the page, makes no difference at all. As soon as the file is opened a blank email is sent regardless of what is on the page itself.

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

Re: Login script

Post by Pablo » Sat Apr 14, 2018 6:58 am

Then I think the code is still there.
Please share your project so I can tell you exactly what to do.

trenoweth
 
 
Posts: 63
Joined: Mon Feb 08, 2016 10:42 pm
Location: Punganui, New Zealand

Re: Login script

Post by trenoweth » Mon Apr 16, 2018 1:01 am

Hello Pablo,

You can see the Sign Up form at http://www.trenoweth.co.uk/Sign_up/sign_up.php

This form is exactly as generated, no additional text has been added.

Whenever this page is loaded, or refreshed, an email is sent with the subject: "New logon sign-up"
and in the body: "Values submitted from web site form: "Both of these generated by the file: sign_up.php

Nothing else.

trenoweth
 
 
Posts: 63
Joined: Mon Feb 08, 2016 10:42 pm
Location: Punganui, New Zealand

Re: Login script

Post by trenoweth » Mon Apr 16, 2018 2:18 am

Further to my last posting I have just realised that it is not necessary to reload the URL (or refresh the page) to have the blank email sent - just bringing to the front a browser window with the login form on it is sufficient to send a blank email winging through the ether! :o


(If testy at nosey@nosey.com is seeing this then I can tell you your sign-up did arrive :D )

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

Re: Login script

Post by Pablo » Mon Apr 16, 2018 5:49 am

To be able to help you I need a copy of your project file. I cannot see what you have done based on the HTML code only.

To share your project:
- upload the file to your website or another public server
- share the link
- describe exactly where in your project the page can be found.

trenoweth
 
 
Posts: 63
Joined: Mon Feb 08, 2016 10:42 pm
Location: Punganui, New Zealand

Re: Login script

Post by trenoweth » Tue Apr 17, 2018 6:14 am

Right, something funny seems to be going on here! I just set up a completely new-sign up page

The WBS file is at: www.trenoweth.co.uk/Test/Untitled3.wbs

This file does not send a blank email but nor does it send me the full data from the form. It does send two "Your new account" messages with details of User Name and Password, one to me and one to the person signing-up.

File index.php has the following at its beginning, and sends both a blank email and the data. I.e.:

A blank "New logon sign-up" one to me
A "Your new account" one to both me and the person signing up
A completed "New logon sign-up" one to me


So as I think I have said before (I first tried to resolve this a couple of years ago) the problem lies with this following script. However, this script does not appear on index3.php that I created today though does appear on index.php from the other day. Whatever you or others might be thinking, there is no way I have sufficient knowledge to write this script!

$mailto = "peter@xxxxx";
$subject = "New logon sign-up";
$message = "Values submitted from web site form:";
$header = "From: ".$_POST['email'];
foreach ($_POST as $key => $value)
{
if (!is_array($value))
{
$message .= "\n".$key." : ".$value;
}
else
{
foreach ($_POST[$key] as $itemvalue)
{
$message .= "\n".$key." : ".$itemvalue;
}
}
}
mail($mailto, $subject, stripslashes($message), $header);
?><?php
if (session_id() == "")
{
session_start();
}
Last edited by trenoweth on Wed Apr 18, 2018 2:36 am, edited 2 times in total.

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

Re: Login script

Post by Pablo » Tue Apr 17, 2018 6:22 am

However, this script does not appear on index3.php that I created today though does appear on index.php from the other day. Whatever you or others might be thinking, there is no way I have sufficient knowledge to write this script!
As previously mentioned, I think you have copied this script from here:
http://wysiwygwebbuilder.com/forms_php.html

You either have added this script in the Page HTML or Site HTML. Please remove it or share the project file so I can help you find out where you have added the script.

trenoweth
 
 
Posts: 63
Joined: Mon Feb 08, 2016 10:42 pm
Location: Punganui, New Zealand

Re: Login script

Post by trenoweth » Wed Apr 18, 2018 2:02 am

Right, I had overlooked the addition of the top script in the old file, or to be more accurate, overlooked adding it to the new one.

So, I've gone right back to basics and created a "Feedback" form following the instructions on your site. No additional details, no form, no sign-up for a login or anything.

I simply followed, step by step, the instructions on: http://wysiwygwebbuilder.com/forms_php.html

What I have you may see at www.trenoweth.co.uk/Test/feedback.php

It is a blank page. As soon as that page loads it sends an email with subject: Feedback form
and containing in the body of the email: Values submitted from web site form:

If I had an email address for you I'd add it so that you can see what arrives.

Nothing else. Which it shouldn't as nothing was, nor could be, entered.

This is the problem I've been having with the sign-up script in your Login program. Nothing should be sent until after information has been provided and a "Send" button clicked.

The files are at:
www.trenoweth.co.uk/Test/feedback.php
www.trenoweth.co.uk/Test/feedback.css
www.trenoweth.co.uk/Test/Untitled1.css
www.trenoweth.co.uk/Test/Feedback.wbs

They are all exactly as generated, nothing added at all.

The full text on the feedback.php file is:

<?php
$mailto = "xx@xxxxx";
$subject = "Feedback form";
$message = "Values submitted from web site form:";
$header = "From: ".$_POST['email'];
foreach ($_POST as $key => $value)
{
if (!is_array($value))
{
$message .= "\n".$key." : ".$value;
}
else
{
foreach ($_POST[$key] as $itemvalue)
{
$message .= "\n".$key." : ".$itemvalue;
}
}
}
mail($mailto, $subject, stripslashes($message), $header);
?><!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Feedback</title>
<meta name="generator" content="WYSIWYG Web Builder 12 - http://www.wysiwygwebbuilder.com">
<link href="Untitled1.css" rel="stylesheet">
<link href="feedback.css" rel="stylesheet">
</head>
<body>
</body>
</html>

The full text of feedback.css is:

body
{
background-color: #FFFFFF;
color: #000000;
font-family: Arial;
font-weight: normal;
font-size: 13px;
line-height: 1.1875;
margin: 0;
padding: 0;
}

The full text of Untitled1.css is:

a
{
color: #0000FF;
text-decoration: underline;
}
a:visited
{
color: #800080;
}
a:active
{
color: #FF0000;
}
a:hover
{
color: #0000FF;
text-decoration: underline;
}
h1
{
font-family: Arial;
font-weight: bold;
font-size: 32px;
text-decoration: none;
color: #000000;
background-color: transparent;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
display: inline;
}
h2
{
font-family: Arial;
font-weight: bold;
font-size: 27px;
text-decoration: none;
color: #000000;
background-color: transparent;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
display: inline;
}
h3
{
font-family: Arial;
font-weight: bold;
font-size: 24px;
text-decoration: none;
color: #000000;
background-color: transparent;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
display: inline;
}
h4
{
font-family: Arial;
font-weight: bold;
font-size: 21px;
font-style: italic;
text-decoration: none;
color: #000000;
background-color: transparent;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
display: inline;
}
h5
{
font-family: Arial;
font-weight: bold;
font-size: 19px;
text-decoration: none;
color: #000000;
background-color: transparent;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
display: inline;
}
h6
{
font-family: Arial;
font-weight: bold;
font-size: 16px;
text-decoration: none;
color: #000000;
background-color: transparent;
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 0px;
display: inline;
}
.CustomStyle
{
font-family: "Courier New";
font-weight: bold;
font-size: 16px;
text-decoration: none;
color: #2E74B5;
background-color: transparent;
}

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

Re: Login script

Post by Pablo » Wed Apr 18, 2018 6:07 am

I simply followed, step by step, the instructions on: http://wysiwygwebbuilder.com/forms_php.html
Why are you using this code? This tutorial is to demonstrate how to implement your own form processor script.
This script has nothing to do with the Login Tools. You do not need it. The login tools generate all the required code automatically.
It is a blank page. As soon as that page loads it sends an email with subject: Feedback form
and containing in the body of the email: Values submitted from web site form:
Correct! That is the purpose if this script.
The page with the script is not suppose to be called directly, it should be called via the form's action.

Please do not add this script to your pages unless you know what you are doing. You do not need this script to make the login tools work.

trenoweth
 
 
Posts: 63
Joined: Mon Feb 08, 2016 10:42 pm
Location: Punganui, New Zealand

Re: Login script

Post by trenoweth » Thu Apr 19, 2018 4:24 am

Right, now we are getting somewhere.
The login tools generate all the required code automatically
If I simply upload the signup form as produced using the Signup sub-menu item under the Login menu item, then it doesn't send the full details entered, just the User name and Password.

I recall we had a similar discussion two years ago, but I did not add this code, it was part of the process. I do note, though, that setting up a new login now does not have that code at the top

So, if I don't use that script on the page what should I be doing in order to receive all the information please? Is it something to do with the action="<?php echo basename(__FILE__); ?>" line in the script?

I do realise that I can get the rest of the submission by going into the User Administrator page but it would be more useful if it all came in the email, as it did using the now removed script.

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

Re: Login script

Post by Pablo » Thu Apr 19, 2018 6:17 am

If I simply upload the signup form as produced using the Signup sub-menu item under the Login menu item, then it doesn't send the full details entered, just the User name and Password.
Correct, that was how it was designed .
I recall we had a similar discussion two years ago, but I did not add this code, it was part of the process.
I'm sorry to disagree, but this code was never part of the process. It is not correct to use this code in combination with the login tools.
So, if I don't use that script on the page what should I be doing in order to receive all the information please?
If you need different behavior that the standard functionality, then you will have to modify generated code.
You can customize the code by converting the form it a standard form (Right click the object and select 'Convert to form').
This will require HTML/PHP knowledge!

Please do not change anything unless you know what you are doing.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest