WebSite X5Help Center

 
Vander Junio Magalhães
Vander Junio Magalhães
User

Link between user password and forms  en

Autor: Vander Junio Magalhães
Besucht 1512, Followers 1, Geteilt 0  

I created a website that has e-mail sending forms on several pages and they work well. Some of these forms will have access controlled by username and password.

I need the e-mail forms sent by pages with controlled access to include the information of which login was used to fill the form. How should I proceed?

Gepostet am
5 ANTWORTEN - 1 NüTZLICH
Paul M.
Paul M.
Moderator

Hello Vander,

If you insert the following PHP code in the head of the page:

<?php

$pa = new imPrivateArea();

$user = $pa->who_is_logged();

?>

Then the PHP variable $user['username'] will hold the details of the user who logged in to fill the form.

You can then add this information to the form using a hidden field, as follows:

<input type="hidden" name="username" value="<?php echo $user['username']; ?>">

However, you will have to manually edit the HTML code which WebSite X5 produces in order to insert this hidden field.  You can do this in Step 5 of WebSite X5 by exporting the code to disk, after which you reupload the modified page to your server.

Kind regards,

Paul

Mehr lesen
Gepostet am von Paul M.
Vander Junio Magalhães
Vander Junio Magalhães
User
Autor

Hello Paul.

Thank you very much for your reply. 

I did what you described in your message and I can see it worked because when I look at line I wrote (<input type="hidden" name="username" value="<?php echo $user['username']; ?>">) the source code of the page shows the username I used to access the page, witch means the code gathered the information correctly.

My issue now is that the email I recieve from the form contains all information but the username. I wanted to put it right on top of the resulting email, but it simply wasn't there.

Can you help me with that?

Mehr lesen
Gepostet am von Vander Junio Magalhães
Incomedia
Claudio D.
Incomedia

Hello Vander Junio Magalhães,

The email form script cannot use this field since this field has not been added by the program. You will need to use the "Send data to a file" in the send tab and use a custom script to send the email.

Many thanks!

Mehr lesen
Gepostet am von Claudio D.
Vander Junio Magalhães
Vander Junio Magalhães
User
Autor

Can you point me to a tutorial or maybe an example that could help me to understand this option?

Mehr lesen
Gepostet am von Vander Junio Magalhães
Incomedia
Claudio D.
Incomedia

Hello Vander Junio Magalhães,

Unfortunately I cannot help you with the use of custom code, but if you have any doubts or issues on how to add them in the pages you made with WebSite X5 you can ask me.

Generally speaking since the functions do not depend on WebSite X5, you can search useful information about the custom code with search engines like google or wait until someone on the community of Answers can help you.

Many thanks!

Mehr lesen
Gepostet am von Claudio D.