Page 1 of 1

mini account

Posted: Sun Jul 29, 2007 10:16 am
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.

Posted: Sun Jul 29, 2007 10:22 am
by superdezign
Just make two alternative menus... One for being logged in, one for being logged out. It's fairly simple.

Posted: Sun Jul 29, 2007 10:28 am
by carsky
thanks a lot