0

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!

3
Contributors
7
Replies
8
Views
8 Years
Discussion Span
Last Post by phouse512
0

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.

session_start();
if(username/password check)
{
//some code
$session['username'] = $_POST['txtfield_name_username'];
}

and you can echo it like this -

if(isset($session['username']) && $session['username'] !='')
{
  echo "Welcome ".$session['username'];
}else echo "Welcome guet";
0

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~!

0

put this -

session_start();
if(username/password check)
{
//some code
$session['username'] = $_POST['txtfield_name_username'];
}

inside login.html
and this -

if(isset($session['username']) && $session['username'] !='')
{
  echo "Welcome ".$session['username'];
}else echo "Welcome guet";

inside welcome.html

0

i will have to save those 2 as php files then right?

form your code, it seems that you already have those files.

0

it didnt work - i inserted the code in login.php and welcome.php the way u mentioned, but nothing works

0

You need some sort of username and password verification

You could use some sort of MySQL query like this:

SELECT user_id, username FROM login WHERE username = '$user_username' AND password = '$user_password

And put that in a conditional to see if it checks, and then if it does, set the session cookies like network18 said.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.