mini account

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
carsky
Forum Commoner
Posts: 30
Joined: Sun Jul 08, 2007 3:26 am

mini account

Post by carsky »

hi guys, need your help again as usual..i wanted to make a miniaccount menu for my customers so that they would have a short cut menu for their profile..well what I want to happen is that once a user is logged in..this miniaccount menu will be functional..but once this the user is not logged in, majority of this menus will redirect the user to the login page.

here's my miniaccount.php..

Code: Select all

<?

//this php function checks the user if he/she is logged in

function checkUser()
{
	// if the session id is not set, redirect to login page
	if (!isset($_SESSION['thesis1_customer_id'])) {
		header('Location: ' . WEB_ROOT . 'include/login.php');
		exit;
	}
	
	// the user want to logout
	if (isset($_GET['logout'])) {
		doLogout();
	}
}

?>

<br/>
				<table cellpadding="0" cellspacing="10" border="0" bgcolor="#6CFF9D" width="170" style="font-family:sans-serif">
					<tr>
						<td align="center" style="font-size:14px;background-color:#461B7E;color:#ffffff">MY ACCOUNT MENU</td>
					</tr>
					<tr>
                                                 <!--if logged in, user can edit/view profile..else if the user is not logged redirect to login.php-->
						<td class="accountmenu"><a href="" class="accmenu">View/Edit Profile</a></td>
					</tr>
					<tr>
                                                 <!--if logged in, user can edit/view cart..else if the user is not logged redirect to login.php-->
						<td class="accountmenu"><a href="" class="accmenu">View Shopping Cart</a></td>
					</tr>
					<tr>
                                                <!--if logged in, user can view orders..else if the user is not logged redirect to login.php-->
						<td class="accountmenu"><a href="" class="accmenu">View Order History</a></td>
					</tr>
					<tr>
                                                <!--if logged in, hide this menu..else if the user is not logged in show this login.php link-->
						<td class="accountmenu" ><a href="" class="accmenu">Login</a></td>
					</tr>
					<tr>
                                                <!--if logged in, hide this menu..else if the user is not logged in  show this registration.php link-->
						<td class="accountmenu"><a href="" class="accmenu">Register</a></td>
					</tr>
					<tr>
                                                <!----hide this menu if not logged in..else if logged in show this menu--->
						<td class="accountmenu"><a href="" class="accmenu">Logout</a></td>
					</tr>
				</table>
if made comments on the template for miniaccount.php, guys maybe you could help me make conditions so that i could attain what i want to happen..thanks in advance.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Just make two alternative menus... One for being logged in, one for being logged out. It's fairly simple.
carsky
Forum Commoner
Posts: 30
Joined: Sun Jul 08, 2007 3:26 am

Post by carsky »

thanks a lot
Post Reply