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!

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";

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

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

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

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

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

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.