Login tool update profile

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
BethlehemOffice
 
 
Posts: 23
Joined: Wed Sep 06, 2017 3:08 pm

Login tool update profile

Post by BethlehemOffice » Wed Oct 24, 2018 3:39 pm

Ok, I looked at this tutorial - http://www.wysiwygwebbuilder.com/customize_signup.html very helpful but what I need is this tutorial for the update profile form. Is it available and I'm just not finding it?

My db is already pre-populated so users only have to register to see their information and update it. I don't need to ask for that info on sign up, just on the update.

THANKS!!!!

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

Re: Login tool update profile

Post by Pablo » Wed Oct 24, 2018 4:15 pm

I'm sorry, I do not have a standard solution for that.
This requires a custom script.

BethlehemOffice
 
 
Posts: 23
Joined: Wed Sep 06, 2017 3:08 pm

Re: Login tool update profile

Post by BethlehemOffice » Wed Oct 24, 2018 4:33 pm

can you just tell me which sections I need to update? I've tried a few times and I think I'm still missing something.

I'm re-learning php as I go (used to be more proficient about 10 years ago) and most of it makes sense but trying to figure out someone else's code...hard. So what I see is that at the beginning there's this code

Code: Select all

$db_fullname = '';
$db_email = '';
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['form_name']) && $_POST['form_name'] == 'editprofileform')
{
   $success_page = './ProfileInfo.php';
   $oldusername = $_SESSION['username'];
   $newusername = $_POST['username'];
   $newemail = $_POST['email'];
   $newpassword = $_POST['password'];
   $confirmpassword = $_POST['confirmpassword'];
   $newfullname = $_POST['fullname'];
which I think is working on when they click update as there's NEW at the front of the fields. So if I have added fields I need to create something like

$newaddress1 = $_POST['address1'];

for each custom field. Then there's some validating of username, password etc. which I don't need to mess with. In that section there's this code

Code: Select all

 {
         $crypt_pass = md5($newpassword);
         $newusername = mysqli_real_escape_string($db, $newusername);
         $newemail = mysqli_real_escape_string($db, $newemail);
         $newfullname = mysqli_real_escape_string($db, $newfullname);
         $sql = "UPDATE `".$mysql_table."` SET `username` = '$newusername', `fullname` = '$newfullname', `email` = '$newemail' WHERE `username` = '$oldusername'";
         mysqli_query($db, $sql);
         if (!empty($newpassword))
         {
            $sql = "UPDATE `".$mysql_table."` SET `password` = '$crypt_pass' WHERE `username` = '$oldusername'";
            mysqli_query($db, $sql);
         }
Which is updating the table - right? so i need to add my fields here as well like

$sql = "UPDATE `".$mysql_table."` SET `username` = '$newusername', `fullname` = '$newfullname', `email` = '$newemail', 'address1' = '$newaddress1' WHERE `username` = '$oldusername'";

and that's all I think I need to edit except for the bottom part which I already have (see below). Or do I need to add my fields like this as well -
$newaddress1 = mysqli_real_escape_string($db, $newaddress1);

If so, what's that code for? Just point me to a resource page, no need for in depth explanation. I can do more research if I know where it's going.

Code: Select all

sql = "SELECT * FROM ".$mysql_table." WHERE username = '".$_SESSION['username']."'";
$result = mysqli_query($db, $sql);
if ($data = mysqli_fetch_array($result))
{
$db_username = $data['username'];
   $db_fullname = $data['fullname'];
   $db_email = $data['email'];
 
$db_address1 = $data['address1'];


Is there anywhere else I need to update? And you are a great help and I would suggest making a tutorial on this.
If the answer is too in-depth, I completely understand. You don't need to be teaching Php to all of us 1 at a time. :D

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

Re: Login tool update profile

Post by Pablo » Wed Oct 24, 2018 4:47 pm

I'm sorry, I cannot help you with programming related questions.
This is outside of the scope of support I can give you.

BethlehemOffice
 
 
Posts: 23
Joined: Wed Sep 06, 2017 3:08 pm

Re: Login tool update profile

Post by BethlehemOffice » Wed Oct 24, 2018 4:52 pm

Thanks anyway - got a good resource that might help? WW3 schools is ok but i need something with a bit more explanation.

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

Re: Login tool update profile

Post by Pablo » Wed Oct 24, 2018 5:06 pm

This is a good place to start:
http://php.net/manual/en/index.php

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests