I'm new at php and programming in general. I want to gather the user, host and IP address when a person loads my webpage and store it in session variables. I can see the values using
<?php
echo 'IP Address: ' . getHostByName(getHostName());
?>
<?php
echo gethostname() ;
?>
<?php
echo 'Username: ' . get_current_user();
?>
However, I don't seem to understand how I can then assign those values to session variables that I can then call in SQL queries to limit output based on the user variables. For instance, adding this to the PHP top code causing the form to fail to load:
<?php
session_start();
$_SESSION['username'] = . get_current_user();
?>
I know I'm oversimplifying but I have spent hours researching the web looking for this answer which seems like it should be common place and of high value.
Thanks in advance.