Page 1 of 1

sign up

Posted: Sun Sep 12, 2021 10:07 pm
by sebstek
Hi if you used signup an added Mail Engine SMTP Use SMTP Autentication. upload on server working fine.
code on php its


<?php
session_start();
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['form_name']) && $_POST['form_name'] == 'logoutform')
{
unset($_SESSION['username']);
unset($_SESSION['fullname']);
}
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require __DIR__.'/Exception.php';
require __DIR__.'/PHPMailer.php';
require __DIR__.'/SMTP.php';

$mysql_server = 'localhost';
$mysql_username = '';
$mysql_password = '';
$mysql_database = '';
$mysql_table = '';
$success_page = '';
$activated_page = basename(__FILE__);
$error_message = "";
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'];
$website = $_SERVER['HTTP_HOST'];
$script = $_SERVER['SCRIPT_NAME'];
$timestamp = time();
$code = md5($website.$timestamp.rand(100000, 999999));
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))


but if you :!: convert to form :!: the code its different


<?php
$PHPMAILER$$mysql_server = 'localhost';
$mysql_username = '';
$mysql_password = '';
$mysql_database = '';
$mysql_table = '';
$success_page = '';
$activated_page = basename(__FILE__);
$error_message = "";
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'];
$website = $_SERVER['HTTP_HOST'];
$script = $_SERVER['SCRIPT_NAME'];
$timestamp = time();
$code = md5($website.$timestamp.rand(100000, 999999));
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!';

and show

Parse error: syntax error, unexpected '$' in /reg.php on line 2

Re: sign up

Posted: Sun Sep 12, 2021 10:49 pm
by sebstek
And sugestion added

$sql = "SELECT email FROM ".$mysql_table." WHERE email = '".$newemail."'";
$result = mysqli_query($db, $sql);
if ($data = mysqli_fetch_array($result))
{
$error_message = 'Email already used. Please select another email.';
}
What is wrong
1. you can register another account for this same email
2. If you recovery password, The password will be changed for all users with the same email!

Re: sign up

Posted: Mon Sep 13, 2021 6:02 am
by Pablo
The reason for this is that you have selected to use PHP Mailer. PHP mailer cannot be use in custom code because there is no way fir the sofwtar to understand the structure of custom code.
So, before the conversion you will need to set it to use standard PHP mail.
In the next update, I will disable this automatically.

Re: sign up

Posted: Mon Sep 13, 2021 9:55 am
by sebstek
and you can add validation of the e-mail address if it exists in the database. I duplicated this line from the user and it works fine.

Re: sign up

Posted: Mon Sep 13, 2021 10:16 am
by Pablo
You can post suggestions here:
viewforum.php?f=28

If more users find this useful then I will consider it for future development.