General Community > Scripting Help

Getting data from the logged user

(1/1)

merlyn333:
Hello folks:

I would like to know how can I get data from the logged user.

I imagine that I should make something like this:


--- Code: ---<?php

start_session();

include 'something.php';

echo 'Name: ' . $_SESSION['name'] . '<br/>';
echo 'Username: ' . $_SESSION['username'];

?>

--- End code ---

Could you help me?

Arantor:
Don't use start_session() at all, it will really screw things up.

Start off by including the SSI.php file that comes with SMF, and do that *first*. That will deal with the session data for you, and you will be able to see various things in $context['user'] after that.

merlyn333:
Hi Arantor:

Thanks! Very helpful!

Have a nice day!

Navigation

[0] Message Index

Go to full version