WebSite X5Help Center

 
Capon P.
Capon P.
User

Variable with the 'logged in' user  en

Автор: Capon P.
Просмотрено 2987, Подписчики 3, Размещенный 0  

Hello, can I get a (php)variable with the 'logged in' user in order to add it to a mysql database for logging purposes?

My scenario: a user logs in to protected area. The moment (s)he clicks on a downloadlink the username + clicked link is written to a mysql databas 

Thanks for your suggestions

Размещено
3 Ответы - 1 Полезно - 1 Корректно
Incomedia
Claudio D.
Incomedia

Hello Capon,

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 youcan ask me anytime.

To get the variable of the logged username you can use following code:

<?php

$pa = new imPrivateArea();

$user = $pa->who_is_logged();

echo $user['username'];

?>

Please feel free to write back if you need more information.

Читать больше
Размещено От Claudio D.
Capon P.
Capon P.
User
Автор

Hi Claudio, this works perfectly!

Are User/Group - Remark / Password (from login management) also stored in a variable and can I get these in a way? Is the there a description all used php-variables? I could use this for future projects.

thanks for the quick anc clear responses.  I really like the software and will be making some suggestions for extra functionality.

Читать больше
Размещено От Capon P.
Incomedia
Claudio D.
Incomedia

Hello Capon,

The other variables you can use are the following instead of ['username']:

  • $user['uid'] where you get the User ID.
  • $user['realname'] where you get the real name.

These other fields unfortunately cannot be accessed form the variables.

Many thanks!

Читать больше
Размещено От Claudio D.