Retrieve login details

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
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Retrieve login details

Post by alex4orly »

I am using the standard WWB login form.
When creating / adding records I have to enter
Full Name and email

How can I retrieve those details after a user logs in
I know hoe to get the user name as a session variable, but what are the session objects for the above two additional items?

Cheers
User avatar
Pablo
 
Posts: 21572
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Retrieve login details

Post by Pablo »

The full name is stored in $_SESSION['fullname']. See also the code of the 'Login Name' object.

The email address is not stored is a session variable. You will need to implement that yourself (by modifying the 'Login' object).
Tip: convert the 'Login' object to a form and then you can modify the code.
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Retrieve login details

Post by alex4orly »

Pablo wrote:The full name is stored in $_SESSION['fullname']. See also the code of the 'Login Name' object.

The email address is not stored is a session variable. You will need to implement that yourself (by modifying the 'Login' object).
Tip: convert the 'Login' object to a form and then you can modify the code.
Not clear, how to modify the Login object to a form?
I looked in the PHP code for the object and can see that 'email' is not stored / loaded.
Can I just add it into the PHP code? But then it will be overwritten when I publish the page again?

So, how do I do that?
Cheer
User avatar
Pablo
 
Posts: 21572
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Retrieve login details

Post by Pablo »

I'm sorry, I cannot help you modify the code.
But when you right click the 'Login' object then you can select 'Convert to form'.
After that you can modify the code to suit your needs.
Can I just add it into the PHP code? But then it will be overwritten when I publish the page again?
Yes
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Retrieve login details

Post by alex4orly »

Pablo wrote:I'm sorry, I cannot help you modify the code.
But when you right click the 'Login' object then you can select 'Convert to form'.
After that you can modify the code to suit your needs.
Can I just add it into the PHP code? But then it will be overwritten when I publish the page again?
Yes
OK, I inserted a new line into the html code for email, but it gives me the email of the last record in the file, not the member logged in

$_SESSION['username'] = $_POST['username'];
$_SESSION['fullname'] = $fullname;
$_SESSION['email'] = $email;
User avatar
Pablo
 
Posts: 21572
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Retrieve login details

Post by Pablo »

Unfortunately it is not that simple, you will need to make more changes to the code.
You will need to add an extra variable to stored the email address, just like the fullname value.

Please note that I cannot assist you with programming related issues. For me this my also take a lot of time to figure out.
maxime
 
 
Posts: 117
Joined: Sat Apr 02, 2011 6:15 pm
Contact:

Re: Retrieve login details

Post by maxime »

are you using the flat file database , the msql database or the NONE option in the login object ? If you use the NONE option it will be not simple to do that.


But if you use the others database then look at the[ b] Edit Profile object[/b]. This object retrieve the info from the database for a user to be able to change the info than if you look at the code Inside it will help you to figure out how to do the same .
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Retrieve login details

Post by alex4orly »

maxime wrote:are you using the flat file database , the msql database or the NONE option in the login object ? If you use the NONE option it will be not simple to do that.


But if you use the others database then look at the[ b] Edit Profile object[/b]. This object retrieve the info from the database for a user to be able to change the info than if you look at the code Inside it will help you to figure out how to do the same .
Hi Maxime,

The flat file format, no idea where is the "Edit Profile Object"

Please help
Thanks again
maxime
 
 
Posts: 117
Joined: Sat Apr 02, 2011 6:15 pm
Contact:

Re: Retrieve login details

Post by maxime »

in the menu Insert then Login then you choose the edit profile object.


You should find it since you have use the Login object you should then be able to find the Edit profile !
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Retrieve login details

Post by alex4orly »

maxime wrote:in the menu Insert then Login then you choose the edit profile object.


You should find it since you have use the Login object you should then be able to find the Edit profile !
I found it, what is this for?
Edit Profile is another object, do you say that I should use this instead of using the Login object?
maxime
 
 
Posts: 117
Joined: Sat Apr 02, 2011 6:15 pm
Contact:

Re: Retrieve login details

Post by maxime »

do you say that I should use this instead of using the Login object?
No i am not saying that. The purpose of the Login object is for Login.

you ask a question how to retrieve the info from you database then i say if you want to learn or how to do it use also on another page The update profil object because there is code inside this object who retrieve the info you are looking. if you right click on the object you have an option to convert to form then you will be able to see the code inside andstudy it.


But what do you want do exactly is it the samething that the other post you have made. i mena retrieve the info to autofilled another form ? If so can you tell exactly what field you want to report? is it only the username, the full name and the email ? Also do you want them to be able to change the info in the database ?
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Retrieve login details

Post by alex4orly »

maxime wrote:
do you say that I should use this instead of using the Login object?
No i am not saying that. The purpose of the Login object is for Login.

you ask a question how to retrieve the info from you database then i say if you want to learn or how to do it use also on another page The update profil object because there is code inside this object who retrieve the info you are looking. if you right click on the object you have an option to convert to form then you will be able to see the code inside andstudy it.


But what do you want do exactly is it the samething that the other post you have made. i mena retrieve the info to autofilled another form ? If so can you tell exactly what field you want to report? is it only the username, the full name and the email ? Also do you want them to be able to change the info in the database ?
Hello again,

OK, I will tell you - I am creating a form for membership application. When the Member of the club logs in, I want all the details - name and email to be already populating the input fields of the form. There are other fields on the form and when they click the button, I want this to send email to the club admin.

Can I add my own fields to the database userdb.php? I would like my form to
1) Show / populate the email field and
2) Update it, and
3) Update the other fields in the database from my form

Cheers and thanks again
maxime
 
 
Posts: 117
Joined: Sat Apr 02, 2011 6:15 pm
Contact:

Re: Retrieve login details

Post by maxime »

ha ha, i knew it was a thing like that. if it is all that you want ( i mean save the info in the database with other field ) then you will have to start again.


Can I add my own fields to the database userdb.php? Yes you must use the admin object you can add field. with the admin you will be able to control and make change your self.

I would like my form to
1) Show / populate the email field and
2) Update it, and
3) Update the other fields in the database from my form

when you say update , do you mean you want member to do it themself or you want to do it yourself when they will send you the email ?


it is not so simple to create a membership system but if you use whht you have done so far there is what you can do to retrieve the following info:

username, fullname, email.

put this code in an htm object at the syart of the page (php)

Code: Select all

<?php
if (session_id() == "")
{
   session_start();
}
if (!isset($_SESSION['username']))
{
   $accessdenied_page = './login.php';
   header('Location: '.$accessdenied_page);
   exit;
}
$database = './usersdb.php';
if (filesize($database) == 0)
{
   die('User database not found!');
}

$items = file($database, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach($items as $line)
{
   list($username, $password, $email, $name, $active, $code) = explode('|', trim($line));
   if ($username == $_SESSION['username'])
   {
      $db_username = $username;
      $db_fullname = $name;
      $db_email = $email;
   }
}
?>

look at the code careffuly you should change the name of the database with the name of your database.
you should change also the $accessdenied_page = './login.php'; with your own page.


Then after that you will be able to retrieve the info with those code:

<?php echo $db_fullname; ?> for the full name

<?php echo $db_email; ?> email

<?php echo $db_username ; ?> username

you may put those code in an edit box or in html object as you wish.


Warning try those code on a new page. Make test.
Last edited by maxime on Fri Feb 10, 2017 11:52 pm, edited 1 time in total.
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Retrieve login details

Post by alex4orly »

Maxime, you are a champ...

When you say start it again - start again what? I did not program the membership for yet
When you say to use the Admin object do you mean - the Edit Profile object?

I have to start with one page - the Login object right?
Then, if all OK, it takes the Member to the form - where they will input their details
Then when the click the button - I would like it to update the database and send the email with the detail to the Club Administrator.
If I can't have sending email and updating the database, then only sending the email

So, how do I go about it?
maxime
 
 
Posts: 117
Joined: Sat Apr 02, 2011 6:15 pm
Contact:

Re: Retrieve login details

Post by maxime »

please read again my answer i have edit my answer.

i can not teach you how to make a membership system. But i have gave you a code to use with what you have done so far.

As for the membership system you will have to read the wwb help file and also the tutorial section because you asking me basic question like where do i find the object ?

i do not understand when you ask me those question because you should know where to find them since you have already use the login object !
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Retrieve login details

Post by alex4orly »

Thanks Maxime,

I will look for the membership object

Cheers
maxime
 
 
Posts: 117
Joined: Sat Apr 02, 2011 6:15 pm
Contact:

Re: Retrieve login details

Post by maxime »

I will look for the membership object
there is NO memberrship object. there is only a lot of object then you can use to create a memebership system. So you have the Admin object to make the administartion of the user. You have the signup object where people can signup. you have also update profil where people can upadt their profil. As you know there is also the Login object There is also other obejcet in the login section.

With the combination of all those object you can create a membership system . But it is not mandatory to use all the object in same time but i think you already know that.
User avatar
BaconFries
 
 
Posts: 5325
Joined: Thu Aug 16, 2007 7:32 pm

Re: Retrieve login details

Post by BaconFries »

@Alex although maxime has tried to assist you and others are free to also assist it is really out with what the forum offers.

Such programming issues may take hour/days to write and implement with this said you may have to read more on the subject matter or even hire/pay for this.

Like maxime has already mentioned the tools are available in the programme but it will require some more work PHP and backend side to fully achieve what you need.
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Retrieve login details

Post by alex4orly »

BaconFries wrote:@Alex although maxime has tried to assist you and others are free to also assist it is really out with what the forum offers.

Such programming issues may take hour/days to write and implement with this said you may have to read more on the subject matter or even hire/pay for this.

Like maxime has already mentioned the tools are available in the programme but it will require some more work PHP and backend side to fully achieve what you need.
Baconfries,

I understand and appreciate any help offered here on the forum. I understand that nobody should do any programming for me!

It will take me time to get my hand around this and decide how to go about it. I am looking at the PHP code of the "Edit Profile" object of WWB and can't figure out what / how to get the "email" also showing up on my form - like I use the <?php echo $_SESSION['fullname']; ?> and <?php echo $_SESSION['username']; ?> to populate the respective fields on my form

I need to do something in the Login Object (after making it into a HTML page) - at this point, that is the ONLY thing I am asking help for

Thanks again
User avatar
alex4orly
 
 
Posts: 632
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Retrieve login details

Post by alex4orly »

Hello all,

Well, I managed to figure it out and the "Thank-You" goes especially to Maxime, who gave me a hint as to where to look for an answer. The solution is in the lines below - marked in RED / BOLD, works just like I wanted it. Will gladly like to hear better suggestions?

Cheers

<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['form_name']) && $_POST['form_name'] == 'loginform')
{
$success_page = './membershiprenewal.php';
$error_page = './failed.html';
$database = './memberslogin.php';
$crypt_pass = md5($_POST['password']);
$found = false;
$fullname = '';
$session_timeout = 600;
$emailaddress = '';
if(filesize($database) > 0)
{
$items = file($database, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach($items as $line)
{
list($username, $password, $email, $name, $active) = explode('|', trim($line));
if ($username == $_POST['username'] && $active != "0" && $password == $crypt_pass)
{
$found = true;
$fullname = $name;
$emailaddress = $email;
}
}
}
if($found == false)
{
header('Location: '.$error_page);
exit;
}
else
{
if (session_id() == "")
{
session_start();
}
$_SESSION['username'] = $_POST['username'];
$_SESSION['fullname'] = $fullname;
$_SESSION['emailaddress'] = $emailaddress;
$_SESSION['expires_by'] = time() + $session_timeout;
$_SESSION['expires_timeout'] = $session_timeout;
$rememberme = isset($_POST['rememberme']) ? true : false;
if ($rememberme)
Post Reply