Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: A simple request - 200pts for it

  1. #1
    randomize's Avatar
    randomize is offline x10 Lieutenant randomize is an unknown quantity at this point
    Join Date
    Mar 2006
    Posts
    337

    A simple request - 200pts for it

    Hey

    I want someone to tell me how you do the following:

    index.php?page=staff

    well along those lines,

    I wish someone to give the code, and explain in "lamens" terms, (Simplistic if you must) so that I can understand it easily, as I am a complete and utter n00b at PHP.

    I offer to you 200pts for this

    Regards,
    Randomize


    Click the animation above to go to the site where they are created!

    \ /
    (.) (.)
    /_
    \_____/
    The Evil Guy will take over all Signatures. Please help him to do this by copying and pasting him into your Signature.
    Thank you For Helping Evil!

  2. #2
    dharmil's Avatar
    dharmil is offline x10 Elder dharmil is an unknown quantity at this point
    Join Date
    Sep 2005
    Location
    Avenel New Jersey
    Posts
    828

    Re: A simple request - 200pts for it

    This is saying the pages would be under the pages folder and the link would be

    index.php?page=FILE
    file is the name of the file in the page you want to display.
    Staff would be your default page if you didnt do index.php?page=
    as it says &page= "staff";
    PHP Code:
    <?php 
    if ($_GET['page']) { $page "staff"; } else { $page $_GET['page']; } 
    include (
    "pages/$page.php"); 
    ?>


    or

    PHP Code:
    <?php 

    $page 
    $_GET['page']; 

      if (!
    $page) { 
          
    $page "staff"
       } else { 
          
    $page str_replace(":"""$page); 
          
    $page str_replace"/"""$page); 
          
    $page str_replace"."""$page); 
          
    $page str_replace"http"""$page); 
          
    $page str_replace"www"""$page); 
       } 

       include (
    $page .".php"); 
    ?>


    or
    PHP Code:
    <?php 
      
    if (!$_GET['page']) { 
          
    $page "staff"
       } else { 
          
    $page $_GET['page']; 
       } 

       include (
    $page .".php"); 
    ?>
    ps nedren helped me with this long time ago this has to be right...
    Last edited by dharmil; 07-18-2006 at 09:07 AM.

  3. #3
    chris218 is offline x10Hosting Member chris218 is an unknown quantity at this point
    Join Date
    Jul 2006
    Location
    London, UK
    Posts
    65

    Re: A simple request - 200pts for it

    I told you this before and you never paid me the credits..

    You can also very simple way do this:

    Code:
    if ( $_GET['page'] == 'staff' )
    {
    
    }
    and this if you have many pages, and a default (if page is not given..)

    I will give page=staff and page=admin

    Code:
    if( isset($HTTP_GET_VARS['staff']) || isset($HTTP_POST_VARS['staff']) )
    {
        $staff = ( isset($HTTP_GET_VARS['staff']) ) ? $HTTP_GET_VARS['staff'] : $HTTP_POST_VARS['staff'];
        $staff = htmlspecialchars($staff);
    }
    else 
    {
        $staff = "";
    }
    
    switch( $staff )
        {    
             case "staff":
            // code for staff page here
           break;
    
             case "admin":
            // code for admin page here
           break;
    
          default:
         // code for default page here
        break;
    }

  4. #4
    randomize's Avatar
    randomize is offline x10 Lieutenant randomize is an unknown quantity at this point
    Join Date
    Mar 2006
    Posts
    337

    Re: A simple request - 200pts for it

    is this working then?

    http://www.sapiencreations.x10hostin...dis/switch.php

    Code:
    <?php 
    include("../ads.php");
    if( isset($HTTP_GET_VARS['team']) || isset($HTTP_POST_VARS['team']) )
    {
        $team = ( isset($HTTP_GET_VARS['team']) ) ? $HTTP_GET_VARS['team'] : $HTTP_POST_VARS['team'];
        $team = htmlspecialchars($team);
    }
    else 
    {
        $team = "";
    }
    switch( $team )
        {    
             case "team1":
            echo("this is team1 page");
           break;
             case "team2":
            echo("bah1");
           break;
          default:
         echo("bah");
        break;
    }
    ?>
    This should work, as it is exactly what you told me to put? Was I right to use echo? or should it just be html code?

    Points are being sent to both of you however, cuz you told me!

    However when you go to http://sapiencreations.x10hosting.co...tch.php?=team1

    I get the same response as from switch.php!
    Last edited by randomize; 07-18-2006 at 03:43 PM.


    Click the animation above to go to the site where they are created!

    \ /
    (.) (.)
    /_
    \_____/
    The Evil Guy will take over all Signatures. Please help him to do this by copying and pasting him into your Signature.
    Thank you For Helping Evil!

  5. #5
    Reclutador's Avatar
    Reclutador is offline Lord Of The Keys Reclutador is an unknown quantity at this point
    Join Date
    Aug 2005
    Location
    .: Spain :.
    Posts
    1,936

    Re: A simple request - 200pts for it

    A simple method, create one html page in your portal (f.e. MKPortal), choose create one html page, and runs ok example

    Flash chat http://www.dr3.x10hosting.com/index.php?pid=1


  6. #6
    chris218 is offline x10Hosting Member chris218 is an unknown quantity at this point
    Join Date
    Jul 2006
    Location
    London, UK
    Posts
    65

    Re: A simple request - 200pts for it

    Quote Originally Posted by randomize
    is this working then?

    http://www.sapiencreations.x10hostin...dis/switch.php

    Code:
    <?php 
    include("../ads.php");
    if( isset($HTTP_GET_VARS['team']) || isset($HTTP_POST_VARS['team']) )
    {
        $team = ( isset($HTTP_GET_VARS['team']) ) ? $HTTP_GET_VARS['team'] : $HTTP_POST_VARS['team'];
        $team = htmlspecialchars($team);
    }
    else 
    {
        $team = "";
    }
    switch( $team )
        {    
             case "team1":
            echo("this is team1 page");
           break;
             case "team2":
            echo("bah1");
           break;
          default:
         echo("bah");
        break;
    }
    ?>
    This should work, as it is exactly what you told me to put? Was I right to use echo? or should it just be html code?

    Points are being sent to both of you however, cuz you told me!

    However when you go to http://sapiencreations.x10hosting.co...tch.php?=team1

    I get the same response as from switch.php!
    thats because you havn't put team=team1

    Also.. you can use echo or you can include html by doing the bellow or you can do number 2...

    Code:
    include('some_html_file.html');
    Two
    ?>
    HTML HERE
    <?php

    tells server to stop parsing php, so it parses html until you turn php back on with <?php

  7. #7
    mikel2k3 is offline x10 Lieutenant mikel2k3 is an unknown quantity at this point
    Join Date
    Aug 2005
    Location
    West Yorkshire - UK
    Posts
    374

    Re: A simple request - 200pts for it

    oh balls im well confused... i suppose it would be a good thing for me to learn though
    -----------------------------------
    -----------------------------------

    http://www.DistrasDesigns.com

    -----------------------------------
    -----------------------------------

  8. #8
    nightscream is offline x10 Lieutenant nightscream is an unknown quantity at this point
    Join Date
    Feb 2006
    Location
    Hallaar, Belgium
    Posts
    474

    Re: A simple request - 200pts for it

    I did it like this
    Put this in your index.php
    PHP Code:
    <?php
     $id 
    $_REQUEST['page'];
    switch(
    $page) {
    default: include(
    'index2.php');
     break;
    case 
    "News": include('news.php');
    break;
     case 
    "Staff": include('staff.php');
    break;
     case 
    "Links": include('links.php');
     }
    ?>
    and in your nav put this
    default will be index2.php
    index.php?page=News for news
    index.php?page=Staff for staff
    Last edited by nightscream; 07-18-2006 at 06:43 PM.
    ------------------------------------------------------------------------------------------
    If you have any troubles with a website or a script, just send me a pm.

    I also code websites in xHTML/css, can code javascript and php too if needed

  9. #9
    Bryon is offline Administrator Bryon has disabled reputation
    Join Date
    Apr 2005
    Location
    Northfield, NH
    Posts
    7,608

    Re: A simple request - 200pts for it

    Just mentioning a suggestion..

    Make sure to always validate user input *completely*!

    Chris's code examples do that, some other ones I see do not.

    This is why:
    http://forums.x10hosting.com/showpos...75&postcount=6

  10. #10
    randomize's Avatar
    randomize is offline x10 Lieutenant randomize is an unknown quantity at this point
    Join Date
    Mar 2006
    Posts
    337

    Re: A simple request - 200pts for it

    woo thank you chris,

    I sent you the points last night!

    Regards,
    Randomize

    EDIT:

    I got it working under
    http://sapiencreations.x10hosting.co....php?team=ceo1
    http://sapiencreations.x10hosting.co...php?team=team2

    However, I am implementing it into a page, and it uses php includes

    so which do I put it in and which do I link it too?

    the files:

    team_content.php
    ourteam.php

    ourteam.php is the main page that you go to in the navigation, and that page uses an include to team_content.php

    Basically I want to put it in there, so that I can have ourteam.php?team=ceo1

    so where do I place the script?
    Last edited by randomize; 07-19-2006 at 03:22 AM.


    Click the animation above to go to the site where they are created!

    \ /
    (.) (.)
    /_
    \_____/
    The Evil Guy will take over all Signatures. Please help him to do this by copying and pasting him into your Signature.
    Thank you For Helping Evil!

Closed Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. [PS] Making Simple Borders
    By moose in forum Tutorials
    Replies: 0
    Last Post: 03-22-2006, 08:20 AM
  2. New Simple Sig
    By phenetic in forum Graphics & Webdesign
    Replies: 2
    Last Post: 02-23-2005, 08:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers