Customized user login

Reply

Join Date: Oct 2009
Posts: 19
Reputation: rukshilag is an unknown quantity at this point 
Solved Threads: 0
rukshilag rukshilag is offline Offline
Newbie Poster

Customized user login

 
0
  #1
30 Days Ago
what is the script to customise a login. for example if "abc" logs in to the website, how do i get it to display "Welcome abc", if "pqr" logs in "Welcome pqr" and so on...

please help!
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 539
Reputation: network18 is an unknown quantity at this point 
Solved Threads: 63
network18 network18 is offline Offline
Posting Pro
 
0
  #2
30 Days Ago
Originally Posted by rukshilag View Post
what is the script to customise a login. for example if "abc" logs in to the website, how do i get it to display "Welcome abc", if "pqr" logs in "Welcome pqr" and so on...

please help!
once the user logs in, save his username in the session variable.
  1. session_start();
  2. if(username/password check)
  3. {
  4. //some code
  5. $session['username'] = $_POST['txtfield_name_username'];
  6. }
and you can echo it like this -
  1. if(isset($session['username']) && $session['username'] !='')
  2. {
  3. echo "Welcome ".$session['username'];
  4. }else echo "Welcome guet";
"The discipline of writing something down is the first step towards making it happen."

follow me on twitter
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 19
Reputation: rukshilag is an unknown quantity at this point 
Solved Threads: 0
rukshilag rukshilag is offline Offline
Newbie Poster

let me show u my files

 
0
  #3
30 Days Ago
frameset2.php
<FRAMESET ROWS="15%,*">
<FRAME SRC="banner.html" name="banner">

<FRAMESET COLS="20%,*">
<FRAME SRC="leftmenu.html" NAME=sidebar>
<FRAME SRC="welcome.html" NAME=main>
</FRAMESET>
</FRAMESET><noframes></noframes>

login.html
<form action="validateUserLogin.php" method="post">
Username <input type="text" name="textBox1" /> <br>
Password <input type="password" name="txtPassword" /> <br>
<input type="submit" value="Ok" />
<input type="button" value="Cancel" />
</form>
<p> <a href=""> New User? </a></p>

banner.php
<p align="center"> <font style="outline-style:none" size="+4" color="#FFFFFF"> ABC & Company </font> </p>
<body bgcolor="#666666">

where do i add the php script for it to work the way i mentioned above? as in if pqr logs in then --> welcome pqr~!
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 539
Reputation: network18 is an unknown quantity at this point 
Solved Threads: 63
network18 network18 is offline Offline
Posting Pro
 
0
  #4
30 Days Ago
put this -
  1. session_start();
  2. if(username/password check)
  3. {
  4. //some code
  5. $session['username'] = $_POST['txtfield_name_username'];
  6. }
inside login.html
and this -
  1. if(isset($session['username']) && $session['username'] !='')
  2. {
  3. echo "Welcome ".$session['username'];
  4. }else echo "Welcome guet";
inside welcome.html
"The discipline of writing something down is the first step towards making it happen."

follow me on twitter
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 19
Reputation: rukshilag is an unknown quantity at this point 
Solved Threads: 0
rukshilag rukshilag is offline Offline
Newbie Poster
 
0
  #5
30 Days Ago
i will have to save those 2 as php files then right?
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 539
Reputation: network18 is an unknown quantity at this point 
Solved Threads: 63
network18 network18 is offline Offline
Posting Pro
 
0
  #6
30 Days Ago
Originally Posted by rukshilag View Post
i will have to save those 2 as php files then right?
form your code, it seems that you already have those files.
"The discipline of writing something down is the first step towards making it happen."

follow me on twitter
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 19
Reputation: rukshilag is an unknown quantity at this point 
Solved Threads: 0
rukshilag rukshilag is offline Offline
Newbie Poster
 
0
  #7
30 Days Ago
it didnt work - i inserted the code in login.php and welcome.php the way u mentioned, but nothing works
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 44
Reputation: phouse512 is an unknown quantity at this point 
Solved Threads: 1
phouse512 phouse512 is offline Offline
Light Poster
 
0
  #8
29 Days Ago
You need some sort of username and password verification

You could use some sort of MySQL query like this:
  1. SELECT user_id, username FROM login WHERE username = '$user_username' AND password = '$user_password
  2.  

And put that in a conditional to see if it checks, and then if it does, set the session cookies like network18 said.
Reply With Quote Quick reply to this message  
Reply

Tags
login, php

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC