|
|
Posted by petersprc on 02/18/07 21:23
Since the PHP script is run for each request, you can output the name
in the session:
header.php:
<p>
You are logged in as
<?= htmlentities($_SESSION['userName'], ENT_QUOTES) ?>
</p>
On Feb 18, 4:17 pm, "lister" <listerofsme...@hotmail.com> wrote:
> I'm fairly new to this web authoring lark, and I was pondering today
> how to optimise my site for cacheing, but as far as I can see there is
> no way to do it.
>
> My site has a standard header that includes the option to either
> "Login" or "Logout <username>". This header is generated by PHP
> reading the session ID and looking up the corresponding username.
>
> I guess I could cache the username in the user's session data to save
> a DB lookup (or maybe even a cookie to save looking up any session
> data at all). However, I still cannot see how I can ever cache the
> resultant page since the header is user specific, even if everything
> else is static?
>
> How do other people handle this? Having the username at the top seems
> a pretty common design, so I guess the problem must have been tackled
> somehow?
Navigation:
[Reply to this message]
|