Jump to content

creating profile


runnerjp

Recommended Posts

ok what i got now is on profile.php

 

echo 'Hello <em><b><u>' . get_username ( $_SESSION['user_id'] ) . '</u></b></em>!<br />this is your name.<br /><br />';
echo 'email <em><b><u>' . get_email ( $_SESSION['user_id'] ) . '</u></b></em>!<br />is your email.<br /><br />'; 

i used the id i had from other post to make this work

and sessions looks like this

 

// ------------------------------------------------------------------------

/**
 * Get username - Returns the username of the logged in member based on session ID
 *
 * @access	public
 * @param	string
 * @return	string/bool
 */


function get_username ( $id )
{
	global $db;

	$query = "SELECT `Username` FROM `" . DBPREFIX . "users` WHERE `ID` = " . $db->qstr ( $id );

	if ( $db->RecordCount ( $query ) == 1 )
	{
		$row = $db->getRow ( $query );

		return $row->Username;
	}
	else {
		return FALSE;
	}
}
/**
 * Get email- Returns the email of the logged in member based on session ID
 *
 * @access	public
 * @param	string
 * @return	string/bool
 */
	function get_email ( $id )
{
	global $db;

	$query = "SELECT `Email` FROM `" . DBPREFIX . "users` WHERE `ID` = " . $db->qstr ( $id );

	if ( $db->RecordCount ( $query ) == 1 )
	{
		$row = $db->getRow ( $query );

		return $row->Email;
	}
	else {
		return FALSE;
	}
} 

 

it works great obviusly when a user is logged in BUT when they are not then how can i show the users data?

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.