logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > General
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 01-13-2007, 08:42 PM   #1
mcambridge
 
Join Date: Dec 2005
Posts: 20
Default 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.

regards

Mark
mcambridge is offline   Reply With Quote
Old 01-13-2007, 08:48 PM   #2
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

post your php login script
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 01-13-2007, 08:51 PM   #3
mcambridge
 
Join Date: Dec 2005
Posts: 20
Default

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

Code:
 
<table width="800" border="0" align="center" cellpadding="5" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<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"]; ?>" />
</p>
</form></td>
</tr>
</table>
mcambridge is offline   Reply With Quote
Old 01-13-2007, 09:06 PM   #4
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

need the bit that queries the database
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 01-13-2007, 09:15 PM   #5
mcambridge
 
Join Date: Dec 2005
Posts: 20
Default

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:

http://www.mariovaldez.net/software/sitefilo/
mcambridge is offline   Reply With Quote
Old 01-13-2007, 10:25 PM   #6
domedia
Administrator
domedia's Avatar
 
Join Date: Dec 2003
Posts: 9,730
Default

I found this in the scripts user forum:
Quote:
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:
<html>
<head>
<title><?php echo $slogin_pagetitle;?></title>
</head>
<body>
<p><?php echo "Welcome $slogin_Username"?></p>

And then all pages would display the "Welcome xxxxx" message.
http://www.mariovaldez.net/webapps/f...7c425c71645a34
domedia is offline   Reply With Quote
Old 01-14-2007, 07:21 AM   #7
mcambridge
 
Join Date: Dec 2005
Posts: 20
Default

thats absolutely brilliant! works a treat! many thanx for your help on this one
mcambridge is offline   Reply With Quote
Old 01-14-2007, 09:28 PM   #8
domedia
Administrator
domedia's Avatar
 
Join Date: Dec 2003
Posts: 9,730
Default

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:
http://www.dreamweaverclub.com/vtm/php-login-script.php
domedia is offline   Reply With Quote
Old 01-15-2007, 01:52 PM   #9
mcambridge
 
Join Date: Dec 2005
Posts: 20
Default

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!
mcambridge is offline   Reply With Quote
Old 01-15-2007, 02:23 PM   #10
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

PHP Code:
<?php echo "Welcome Guest $slogin_Username"?>
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:43 AM.


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