WebSite X5Help Center

 
Capon P.
Capon P.
User

Variable with the 'logged in' user  en

Autor: Capon P.
Visitado 3036, Seguidores 3, Compartilhado 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

Publicado em
3 RESPOSTAS - 1 ÚTIL - 1 CORRIGIR
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.

Ler mais
Publicado em de Claudio D.
Capon P.
Capon P.
User
Autor

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.

Ler mais
Publicado em de 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!

Ler mais
Publicado em de Claudio D.