Results 1 to 8 of 8

Thread: Need php help

  1. #1
    Join Date
    Dec 2002
    Posts
    2

    Need php help

    Does anyone know where I can get the php script for doing sub pages. Like you have the main page as main.php and the sub pages as main.php?id=page.

  2. #2
    Join Date
    Aug 2003
    Location
    PA
    Posts
    110
    Those are arguements that you are referring to. To call them, use the following in the context that you have given:

    [php]
    <?php

    $variable_passed = $_REQUEST['id'];

    ?>

    Usually, the requested page matches a member info insertion into a database. That is the basis of a templated page, as only the information interior is changed dynamically.

    Later!
    Jim

  3. #3
    Join Date
    Dec 2002
    Posts
    2
    I'm not talking about for a database.

  4. #4
    Join Date
    Oct 2001
    Location
    Maryland
    Posts
    215
    It makes no difference which one of us you vote for. Either way, your planet is doomed... DOOMED!

  5. #5
    Join Date
    Aug 2003
    Location
    PA
    Posts
    110
    Hello...

    Databases aside, the method for getting the variable is just about the same as I had stated. I was simply eluding to the fact of what I believed you to be asking.

    Indeed, the header(Location:$page); would be what I assume you are looking for as stated by the previous poster.

  6. #6
    Code:
    <?
    if(isset($_REQUEST['id']))
    {
    @ $include_id  = include("$id"."php");
    if (!$include_id)
    {
    echo('Sorry, invalid page requested.');
    }
    }
    else
    {
    @include('main.php');
    }
    ?>
    I believe this should do the trick. Put this into your template, where main.php is the index's content, and then all other pages are saved as page.php.

    -Will
    Last edited by WStevens; 09-05-2003 at 01:20 AM.

  7. #7
    Join Date
    May 2002
    Location
    UK
    Posts
    2,994
    Aghh.

    Please include some filtering of the ID or you are opening up a huge security hole by allowing includes from the query string.

    However this line
    @ $include_id = include("$id"."php");


    would be better written as

    @ $include_id = include($id . ".php");

  8. #8
    Join Date
    Aug 2003
    Location
    PA
    Posts
    110
    Hello...

    I didn't even notice he meant an included file.

    As for the include problem, the easiest thing for someone to do is to pass a URL in that string

    I need new glasses....seems these ones are not letting me read anything correctly

    Later

  9. Newsletters

    Subscribe Now & Get The WHT Quick Start Guide!

Related Posts from theWHIR.com

Posting Permissions

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