Dreamweaver Club Forums

Dreamweaver Club Forums (http://www.dreamweaverclub.com/forum//index.php)
-   General (http://www.dreamweaverclub.com/forum//forumdisplay.php?f=169)
-   -   displaying a username using a php login script (http://www.dreamweaverclub.com/forum//showthread.php?t=24851)

mcambridge 01-13-2007 08:42 PM

displaying a username using a php login script
Hi, can anyone help me?

I'm using a php login script and have a default page set that the user gets redirected to when he/she logs in.

What I want to to is make that page a little more personal by adding their login name at the top of the page. so if user 'John' logs in, the screen says 'welcome John' and the same for other users.

Its not database driven though, theres a php file in use for the usernames and passwords.

I'm fairly new to php scripting, so any help would be greatly appreciated.



davidj 01-13-2007 08:48 PM

post your php login script

mcambridge 01-13-2007 08:51 PM

which bit would you like? theres about 10 different files that make up the script! theres one for the actual username and pasword boxes:


<table width="800" border="0" align="center" cellpadding="5" cellspacing="0" bgcolor="#FFFFFF">
<td width="884"><form id="form2" name="form2" method="post" action="">
<p><?php echo $slogin_text[$slogin_lang]["Username"]; ?>
<input type="text" name="slogin_POST_username" value="<?php echo $slogin_loginname; ?>" />
<br />
<?php echo $slogin_text[$slogin_lang]["Password"]; ?>
<input type="password" name="slogin_POST_password" />
<br />
<input type="submit" name="slogin_POST_send" value="<?php echo $slogin_text[$slogin_lang]["LoginButton"]; ?>" />

davidj 01-13-2007 09:06 PM

need the bit that queries the database

mcambridge 01-13-2007 09:15 PM

there is no database, it uses a php file or a text file to match the usernames and passwords.

Theres a file that sets variables, and specifies re-directions etc.

heres a link to the site that I got it from:


domedia 01-13-2007 10:25 PM

I found this in the scripts user forum:

Hi. Yes, you can do it! Just add this to the webpage, in the place you want to display it:

PHP Code:

<?php echo "Logged in as $slogin_Username"?>

So, for example, if you have a header file (like header.inc.php) you could add it there too. For example:

PHP Code:

<title><?php echo $slogin_pagetitle;?></title>
<p><?php echo "Welcome $slogin_Username"?></p>

And then all pages would display the "Welcome xxxxx" message.

mcambridge 01-14-2007 07:21 AM

thats absolutely brilliant! works a treat! many thanx for your help on this one

domedia 01-14-2007 09:28 PM

Glad to help mcambridge!

If you want to look at a custom solution later, have a look at davidj's video tutorial on how to make a login script, which also includes code to output the username on the page:

mcambridge 01-15-2007 01:52 PM

many thanx for the info! I might just do that if my site gets that big!

I now have another small issue which i cant seem to solve for love nor money!

would like to have 'Welcome Guest' displayed on the page, but when the user logs in, the word guest is replaced by their login name.

I've got it working perfectly for displaying the users name after login, but this would just add the finishing touch!

Any help would be much appreciated!

davidj 01-15-2007 02:23 PM

PHP Code:

<?php echo "Welcome Guest $slogin_Username"?>

All times are GMT. The time now is 10:41 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com