So the article title says it. i wanna make the name as like a welcome message, something like "Welcome, <name>!" and yes there are many articles on the web that gives you coding and what not but i still don't understand how to get it done. sigh. forgive me im a noob at this php mysql stuff.
Anyway, my login page uses email and password:
loginpage.php
<form name="flogin" action="index.php" method="post">
<table width="350px">
<tr>
<td ><b>Email :</b></td>
<td><input type="text" name="email"></td>
</tr>
<tr>
<td><b>Password :</b></td>
<td><input type="password" name="password"></td>
</tr>
</table>
<div><input type="submit" class="login" value="Login" name="login"></div>
</form>
<?php
session_start();
if (isset($_POST['login']))
{
$email = mysql_real_escape_string($_POST['email']);
$password = mysql_real_escape_string($_POST['password']);
$email=stripslashes($email);
$password=stripslashes($password);
if ($email&&$password)
{
require "connect.php";
$query = mysql_query("SELECT * FROM register WHERE email='$email'");
$numrows = mysql_num_rows($query);
if ($numrows != 0)
{
while ($rows = mysql_fetch_assoc($query))
{
$dbemail = $rows['email'];
$dbpassword = $rows['password'];
}
if ($email==$dbemail && $password==$dbpassword)
{
$_SESSION['email']=$dbemail;
echo ('<script type="text/javascript">window.location = "profile.php"</script>');
}
else
{
echo ('<script type="text/javascript">alert("Incorrect Password");
window.location = "index.php";
</script>');
}
}
else
{
echo ('<script type="text/javascript">alert("The Email Does Not Exist In Database");
window.location = "index.php";</script>');
}
}
else
{
echo ('<script type="text/javascript">alert("Please Enter An Email and/or Password");
window.location = "index.php";</script>');
}
}
exit();
?>
now what do i do so that after login and user goes to profile on the profile page it says "Welcome, <users name>!" like facebook where we login with email and password and our name is on our profile and that particular coding, do i put it in the profile.php or login.php ?