SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Member
    Join Date
    Aug 2004
    Location
    Milwaukee Wisconsin
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ?action=action urls not working properly.

    I want to use the ?action=action urls. Go here:
    http://www.adamb10.com/UltraBlog/blog.php
    Thats the url to my new blogging system I am in the process of making Click login and see what happens. It is showing blog.php on the login page as well and I don't want that. Here is what I have that may be causing the bug:

    Blog.php
    PHP Code:
    <?
    session_start
    ();
    require (
    "sources/sys.php");
    ?>
    Sys.php
    PHP Code:
    <?
    $action 
    $_GET['action'];
    if(
    $action == "login"){
    include 
    "login.php";
    }
    ?>
    Because these urls play a major role in the software I cannot continue to develope it until I get this nasty bug fixed. Any help is greatly thanked!

    Adam

  2. #2
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    around
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    print_r($_GET) and see whats going on

  3. #3
    SitePoint Wizard mark_W's Avatar
    Join Date
    Mar 2004
    Location
    West Midlands, United Kingdom
    Posts
    2,631
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    im not expert but have you tried using $HTTP_GET_VARS['action'] instead of $_GET['action']

  4. #4
    SitePoint Wizard Dangermouse's Avatar
    Join Date
    Oct 2003
    Posts
    1,024
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    They are equal but the former is depreciated. Also <?php is prefered over <?

  5. #5
    reputation consultant ThaVincy's Avatar
    Join Date
    Mar 2003
    Location
    Flanders
    Posts
    523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dangermouse
    They are equal but the former is depreciated. Also <?php is prefered over <?
    First of all --> LOL on the Dangermouse reply.

    Secondly: here is the code I use for my website, it is the same actually, only using 'id' in stead of 'action'.

    PHP Code:
     
    <?php
    switch($_GET['action']) { 
    default: 
    include(
    'main.php');
    break; case 
    "test"
    include(
    'test.php'); 
    ?>
    Should work just fine.
    ThaVincy | redesigning your image
    Twizted Imagebuilding personal and corporate reputation solutions

  6. #6
    SitePoint Wizard Lats's Avatar
    Join Date
    Jun 2003
    Location
    Melbourne, AU
    Posts
    1,142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You'll need to exclude the welcome bit if action=login is true. Something like...
    PHP Code:
    $action $_GET['action']; 
    if(
    $action == "login")

       include 
    "login.php"
    }
    else
    {
       ...
       
    show 'welcome bits'
       
    ...

    Lats...

  7. #7
    SitePoint Wizard Dangermouse's Avatar
    Join Date
    Oct 2003
    Posts
    1,024
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Off Topic:


    Quote Originally Posted by ThaVincy
    First of all --> LOL on the Dangermouse reply.
    Something funny?

  8. #8
    SitePoint Member
    Join Date
    Aug 2004
    Location
    Milwaukee Wisconsin
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Lats
    You'll need to exclude the welcome bit if action=login is true. Something like...
    PHP Code:
    $action $_GET['action']; 
    if(
    $action == "login")

       include 
    "login.php"
    }
    else
    {
       ...
       
    show 'welcome bits'
       
    ...

    I don't quite understand...

  9. #9
    SitePoint Wizard
    Join Date
    Mar 2004
    Posts
    1,647
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    better put the login script into a function couse u dont call nothing with include login!!!
    so...
    PHP Code:
    <?php
    $act 
    $_GET["act"];

    if(
    $act == 'login') { // insert this where u want to see the login box
    login();
    }

    function 
    login() {
    ?>
    your_login_script
    <?php
    }
    ?>


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
  •