<?php
require_once("class.simpleusersystem.php");
session_start();
$login=New simple_usersystem();
$thisuser=$login->headerTemplate="";
$thisuser=$login->footerTemplate="";
//check for user login
$thisuser=$login->login_form($logintemplate="example3/login.php");
//Only Logged-in Users can view following content
if($thisuser=="admin") $admincp="<li><a href=\"?p=admin\">Manage Users</a></li>";
else $admincp="";
$menu='<li class="first"><a href="?" >Homepage</a></li>
<li><a href="?p=p2">Page2</a></li>
<li><a href="?p=profile">Profile</a></li> '.$admincp.'
<li><a href="?p=contact">Contact Us</a></li>
<li><a href="?logout=y">Logout</a></li>';
$home="<h1 class=\"title\"><a href=\"#\">Home Page</a></h1>
<p>This is a test home page for Simple User System class by Abhishek Shukla.</p>
<p>This is visible for logged in users.</p>";
$p2="<h1 class=\"title\"><a href=\"#\">Page 2</a></h1>
<p>This is a Page 2.</p>";
//homepage
$content=$home;
//other pages
if(isset($_GET['p'])) {
switch($_GET['p']){
Case "p2";
$content=$p2;
break;
Case "contact";
include("example3/contact.php");
die();
break;
Case "admin";
$login->adminurl="?p=admin&";
$cpadmin=$login->manage_user();
$notices=$login->notices;
$content="<h1 class=\"title\"><a href=\"#\">Manage Users</a></h1>
<p>".$notices."</p><p>".$cpadmin."</p>";
break;
Case "profile";
$login->adminurl="?p=profile&";
$profile=$login->user_profile($thisuser);
$notices=$login->notices;
$content="<h1 class=\"title\"><a href=\"#\">Profile</a></h1>
<p>".$notices."</p><p>".$profile."</p>";
break;
}
}
include("example3/template.php");
|