Thank you. Here is the code for the index.php
<?php
$page = $_GET['p'];
if(isset($_SESSION['username']))
{
header("location:
http://google.com");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
http://www.3org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title></title>
<link rel="stylesheet" href="templates/main/css/layout.css" type="text/css">
</head>
<body>
<div id='wrapper'>
<div id='headerwr'>
</div>
<div id='topnavwr'>
<div id="tnButtonHolder">
<span class='TopNavLinks'>
<a href='#' style='margin-right: 4px;'>Home</a>
<a href='#' style='margin-right: 4px;'>Products</a>
<a href='#' style='margin-right: 4px;'>Web Hosting</a>
<a href='' style='margin-right: 4px;'>Web Design</a>
<a href='?p=login' style='margin-right: 4px;'>User Login</a>
</span>
</div>
</div>
<div id="centerbackground">
<div id='leftwr'>
<?php
include_once('templates/main/template.left.php');
?>
</div>
<div id='middlewr'>
<?php
if (($page == "index") or ($page ==""))
{
include('templates/main/template.main.php');
}
else if($page == "products")
{
include('templates/main/template.products.php');
}
else if($page == "webdesign")
{
include('templates/main/template.webdesign.php');
}
else if($page == "login")
{
include('templates/main/template.login.php');
}
else if($page == "admin")
{
include('admin/templates/admin.template.adminpanel.php');
}
else if(($page == 'addblock1' or $page == 'addblock2'))
{
include('admin/templates/admin.template.addblock.php');
}
else if($page == "viewblocks")
{
include('admin/templates/admin.template.viewblocks.php');
}
else if($page == "checklogin")
{
include_once('classes/class.corefuncs.php');
$obj = new class_corefuncs();
$obj->userlogin();
}
else
{
echo 'Wrong Page';
}
?>
</div>
</div>
<br />
</div>
<div id='footerwr'>
<span>this is the footer</span>
</div>
</body>
</html>
and here is the corefuncs.php
<?php
include_once('class.mysqlfuncs.php');
class class_corefuncs
{
public function getSideBoxes()
{
$obj = new class_mysqlfuncs();
$sqlConn = $obj->sqlConnect();
$return = $obj->sqlQuery("SELECT * FROM sideboxes");
return $return;
}
public function getContentBoxes()
{
$obj = new class_mysqlfuncs();
$sqlConn = $obj->sqlConnect();
$return = $obj->sqlQuery("SELECT * FROM contentboxes order by orderid ASC LIMIT 10");
return $return;
}
public function userLogin()
{
$obj = new class_mysqlfuncs();
$sqlConn = $obj->sqlConnect();
$strUser = $_POST['username'];
$strPass = $_POST['password'];
$strUser = stripslashes($strUser);
$strPass = stripslashes($strPass);
$strUser = mysql_real_escape_string($strUser);
$strPass = mysql_real_escape_string($strPass);
$strReturn = $obj->sqlQuery("SELECT username, password FROM siteusers WHERE siteusers.username=\"{$strUser}\" and siteusers.password=\"{$strPass}\"");
$x=mysql_num_rows($strReturn);
if($x == 1)
{
session_start();
$_SESSION['username']=$strUser;
}
else
{
echo "wrong username or password";
}
}
}
?>
and the template.login.php
<div id='loginwr'>
<div id='headermiddle'># User Login</div>
<div id='conmiddle'>
<form id='login' method='post' action='?p=checklogin'>
<input type='text' name='username'></input><br>
<input type='text' name='password'></input>
<input type='submit' value='login' name='submit'></input>
</form>
</div>
</div>
is this what ya need?