Forums

PHP

This topic is locked

Customizing My USer Login Database

Posted 10 Apr 2003 13:20:03
1
has voted
10 Apr 2003 13:20:03 Matt Canning posted:
<font face='Comic Sans MS'>Hiya people what can i do once i hvae done it? how can i put a welcome ( then followed by the username ) and do you know some good sites where i can find amazing scripts </font id='Comic Sans MS'>

HELP ME WITH MY SITE

Replies

Replied 11 Apr 2003 00:25:48
11 Apr 2003 00:25:48 Michael O'Neill replied:
Hi, this code will will show either "Welcome username" or "Welcome Visitor" depending on whether the user is logged in or not.
Hope this helps!
Mike.

&lt;?php
// *** Start the session
session_start();
?&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;/head&gt;

&lt;body bgcolor="#FFFFFF" text="#000000"&gt;
&lt;?php
if(session_is_registered("KT_Username")
{
?&gt;
Welcome
&lt;?php echo $KT_Username?&gt;
&lt;?php
}
else
{
?&gt;
&lt;font size="3"&gt;&lt;b&gt; Welcome Visitor&lt;/b&gt;&lt;/font&gt;
&lt;?php
}
?&gt;
&lt;/body&gt;
&lt;/html&gt;
Replied 11 Apr 2003 12:12:21
11 Apr 2003 12:12:21 Julio Taylor replied:
just a small followup-

whenever you're using KT_Username session-based variables you need to run the session_start() code block as carphone wrote:
<pre id=code><font face=courier size=2 id=code>
&lt;?php
// *** Start the session
session_start();
?&gt;
</font id=code></pre id=code>

a lot of people get stumped on this. it needs to go at the top of your document, as it needs to be executed before you recall any session vars.

------------------------
Julio

PHP | MySQL | DWMX

ICQ: 19735247
MSN:

Reply to this topic