Jump to content

HELP needed - how to display user first name after log in?


eva9

Recommended Posts

Hi, wonder if anyone can help me with this. I wanted to have user information, ex. "Welcome, [firstname]" display after they log in, how do I do that? anyone can help?   ??? ???

 

Here's part of the Login scripts I used:

-------------------------------

<?php

$qry="SELECT member_id FROM members WHERE login='$login'

AND passwd='".md5($_POST['password'])."'";

$result=mysql_query($qry);

?>

-------------------------------

<?php

if(mysql_num_rows($result)>0) {

session_regenerate_id();

$member=mysql_fetch_assoc($result);

$_SESSION['SESS_MEMBER_ID']=$member['member_id'];

session_write_close();

header("location: member-index.php");

exit();

}

?>

--------------------------------

<?php

session_start();

if(!isset($_SESSION['SESS_MEMBER_ID']) ||

(trim($_SESSION['SESS_MEMBER_ID'])=='')) {

header("location: access-denied.php");

exit();

}

?>

--------------------------------

<?php

session_start();

unset($_SESSION['SESS_MEMBER_ID']);

?>

---------------------------------

 

 

 

upate your script to fetch firstname of user also.

 

$qry="SELECT member_id,member_firstname FROM members WHERE login='$login

 

then

$_SESSION['SESS_First_NAME']=$member['member_firstname'];

 

and ahead you can use i suppose where ever you want to echo it you can

 

welcome. $_SESSION['SESS_First_NAME']

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.