Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder
    Join Date
    Aug 2005
    Posts
    1,119
    Thanks
    2
    Thanked 1 Time in 1 Post

    content switch inside a content switch.

    I have my index.php file which is the layout for the site, and includes a section that im using a:

    PHP Code:
    <?
                                
    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 Code:
    <?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'";
    $resultmysql_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?

  • #2
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    you can't have to GET variables called 'act', call one of them something else


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •