SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 34 of 34
  1. #26
    Winemaster bronze trophy BonRouge's Avatar
    Join Date
    Oct 2004
    Location
    Sendai, Japan
    Posts
    2,417
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey duuudie,
    Yes, thanks - my problem is solved.
    Thanks for the info here - I'll read through that thread as soon as possible.
    (I'm sure I'll be back to bother you some time soon though).

  2. #27
    gimme the uuuuuuuuuuu duuudie's Avatar
    Join Date
    Feb 2004
    Location
    Switzerland
    Posts
    2,253
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by BonRouge
    Hey duuudie,
    Yes, thanks - my problem is solved.
    Thanks for the info here - I'll read through that thread as soon as possible.
    (I'm sure I'll be back to bother you some time soon though).
    you'll be more than welcome, of course.


  3. #28
    Winemaster bronze trophy BonRouge's Avatar
    Join Date
    Oct 2004
    Location
    Sendai, Japan
    Posts
    2,417
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe... Tell me if I'm on the right lines here...

    For reference, here are a few of the links in my menu:

    Code:
    	<li><a href="br.php?page=tablemenus">Table menus</a></li>
    	<li><a href="br.php?page=ul-table">UL 'table' menu</a></li>
    	<li><a href="br.php?page=fixH">Equal height</a></li>
    So, this page :
    PHP Code:
    <?php include ("br-head.htm"); ?>
    <body>
    <div id="wrap">
    <div id="menu">
    <?php include ("menu.php"); ?>
    </div>
    <div id="body">
    <?php include ("$page.htm"); ?>
    <div class="clear"></div>
    </div>
    </div>
    </body>
    </html>
    Should maybe look something like this...?
    PHP Code:
    if (
       $_GET['page'] != dmenu && $_GET['page'] != tablemenus && $_GET['page'] != ul-table && $_GET['page'] != fixH
    )
    {
    header("Location: index.php");
    }
    else
    {
    return true
    <?php include ("br-head.htm"); ?>
    <body>
    <div id="wrap">
    <div id="menu">
    <?php include ("menu.php"); ?>
    </div>
    <div id="body">
    <?php include ("$page.htm"); ?>
    <div class="clear"></div>
    </div>
    </div>
    </body>
    </html>
    If I'm way off with the syntax, please go easy on me...

  4. #29
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, i wold say no. you shouldn't redirect them. make a default page that will be loaded if somebody enters a wrong page or somebody enters nothing. so you would something like
    PHP Code:
    $page = 'default page';
    if (
       $_GET['page'] == dmenu && $_GET['page'] == tablemenus && $_GET['page'] == ul-table && $_GET['page'] == fixH
    )
    {
     $page = $_GET['page'];
    }
    else
    {
    return true
    <?php include ("br-head.htm"); ?>
    <body>
    <div id="wrap">
    <div id="menu">
    <?php include ("menu.php"); ?>
    </div>
    <div id="body">
    <?php include ("$page.htm"); ?>
    <div class="clear"></div>
    </div>
    </div>
    </body>
    </html>

  5. #30
    Winemaster bronze trophy BonRouge's Avatar
    Join Date
    Oct 2004
    Location
    Sendai, Japan
    Posts
    2,417
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Jaswinder,
    Hang on. Have you slipped with the syntax? I can follow your logic, but shouldn't it be || rather than && ?

  6. #31
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    o yeas it should be \\
    i just changed your code from != to == but forgot to put ||
    sorry my mistake. thanks for pointing out.

  7. #32
    Winemaster bronze trophy BonRouge's Avatar
    Join Date
    Oct 2004
    Location
    Sendai, Japan
    Posts
    2,417
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No probs.

    Thanks a lot for your help!

  8. #33
    SitePoint Wizard swdev's Avatar
    Join Date
    Oct 2004
    Location
    UK
    Posts
    1,053
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perhaps a more maintainable way would be this, which would be place right at the top of your pages

    PHP Code:
      // list of valid pages
      
    $valid_pages = array('dmenu''tablemenus''ul-table''fixH');
      
      
    // get requested page name
      
    $page = (true === isset($_GET['page'])) ? $_GET['page'] : '';
      
      if (
    false == in_array($page$valid_pagestrue))
      {
        
    // redirect them to where they just cam from
        
    header('Location: ' $_SERVER['HTTP_REFERER']);
        exit();
      } 

  9. #34
    Winemaster bronze trophy BonRouge's Avatar
    Join Date
    Oct 2004
    Location
    Sendai, Japan
    Posts
    2,417
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That looks great. I've just changed the page and now I'll change it again.

    Thanks swdev.


Bookmarks

Posting Permissions

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