...

View Full Version : content switch inside a content switch.



thesavior
01-05-2006, 06:02 AM
I have my index.php file which is the layout for the site, and includes a section that im using a:


<?
switch($act)
{
case 'rand': include('includes/random.inc.php'); break;
case 'submit': include('includes/submit.inc.php'); break;
case 'admin': include('admin/admin.php'); break;
case 'adminlog': include('admin/adminlogin.php'); break;
default: include('includes/new10.inc.php'); break;
}
?>

In the admin.php page, it is a form, which the action is adminlogin.php

Inside a part of the adminlogin.php page, i have another switch, that again i want to use the same template as index.php, and insert itself in the same place.

adminlogin.php

<?php
session_start();

include "../includes/config.inc.php";
mysql_connect ($dbhost, $dbusername, $dbuserpass);
mysql_select_db($dbname) or die(mysql_error());
$query="SELECT * from $logtable where username='$username' and password='$password'";
$result= mysql_query($query) or die("Could not execute query: $q." . mysql_error());

if (mysql_num_rows($result) == 0)
{
echo "<div align=center><b>Oops! Your login is wrong. Please click back and try again.</b></div>";
}
else
{
if ($_SESSION['login_username'] = $username)
{


switch($act)
{
case 'edit': include('edittuts.php'); break;
default: include('edittuts.php'); break;
}

}
else{
header("Location: ../index.php?act=admin");
}
}
?>

But this isn't working correctly. I want to be able to get to all of these things through an index.php?act=adminlog&act=edit

Im thinking the code i am currently using should work, but it doesn't. Any idea how to do this but make it work?

GJay
01-05-2006, 08:10 AM
you can't have to GET variables called 'act', call one of them something else



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum