Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Displaying username in every page..

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Displaying username in every page..

Postby pauloluaq » Sun Oct 28, 2012 11:38 pm

Hi sir/maam

I'm practicing a website that, after you login the username will be displayed. I have done that already but I want to improve it more. I want to do is, i have HOME BUSINESS INVENTORY etc.. when I clicked them I want my username to be displayed in every page. Please help me! thank you!
pauloluaq
New php-forum User
New php-forum User
 
Posts: 1
Joined: Sun Oct 28, 2012 11:30 pm

Re: Displaying username in every page..

Postby MeroD » Mon Oct 29, 2012 11:10 pm

//set the $_SESSION['signed_in'] variable to TRUE  
$_SESSION['signed_in'] = true; 

//Put the username values in the $_SESSION, so we can use it at various pages 
$_SESSION['username] = ... 

//check if the user is already signed in...  
if($_SESSION['signed_in'])  {  
echo 'Hello' . $_SESSION['username']...
MeroD
New php-forum User
New php-forum User
 
Posts: 53
Joined: Wed Oct 10, 2012 12:14 am

Re: Displaying username in every page..

Postby jinijames » Tue Oct 30, 2012 4:47 am

<?php require_once('core/db.php'); require_once('core/secure.php'); $query = mysql_query("SELECT username FROM admin WHERE id = 1"); $username = mysql_fetch_array($query); ?><?php echo $username[username]; ?>




hire php developer | hire magento developer
jinijames
New php-forum User
New php-forum User
 
Posts: 20
Joined: Fri Oct 19, 2012 4:32 am
Location: India


Return to PHP coding => General

Who is online

Users browsing this forum: Bing [Bot] and 3 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron