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 7 of 7
  1. #1
    Regular Coder
    Join Date
    Nov 2006
    Posts
    601
    Thanks
    1
    Thanked 2 Times in 2 Posts

    user and guest pages

    Parse error: syntax error, unexpected T_IF in /home/runnerse/public_html/index.php on line 10

    thats what i keep getting with this code

    Code:
    <?
    // File ID: index.php (main page for profile site)
    
    
    include("require/config.php");
    require("require/authmember.php");
    
    $auth=authenticate($login, $password);
    include("include/get_config.inc.php");
    $content=if($auth[error]) { include("include/index.inc.php"); }
                else { include("include/index.log.php"); } 
    if ($auth[error]) {$menu="include/menu_u.inc.php";} else {$menu="include/menu_v.inc.php";}
    
    include("include/header.inc.php");
    include("include/body.inc.php");
    //include("include/footer.inc.php");
    ?>
    any idea ppl cheers

  • #2
    Regular Coder
    Join Date
    Jun 2004
    Posts
    130
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by runnerjp View Post
    Parse error: syntax error, unexpected T_IF in /home/runnerse/public_html/index.php on line 10

    thats what i keep getting with this code

    Code:
    <?
    // File ID: index.php (main page for profile site)
    
    
    include("require/config.php");
    require("require/authmember.php");
    
    $auth=authenticate($login, $password);
    include("include/get_config.inc.php");
    $content=if($auth[error]) { include("include/index.inc.php"); }
                else { include("include/index.log.php"); } 
    if ($auth[error]) {$menu="include/menu_u.inc.php";} else {$menu="include/menu_v.inc.php";}
    
    include("include/header.inc.php");
    include("include/body.inc.php");
    //include("include/footer.inc.php");
    ?>
    any idea ppl cheers
    yes,

    this part is bull:

    PHP Code:
    $content=if($auth[error]) { include("include/index.inc.php"); }
                else { include(
    "include/index.log.php"); } 
    should be
    PHP Code:
    if($auth[error]) { include("include/index.inc.php"); }
                else { include(
    "include/index.log.php"); } 
    if you want to store the included file in a variable, use output buffering

  • #3
    Regular Coder
    Join Date
    Nov 2006
    Posts
    601
    Thanks
    1
    Thanked 2 Times in 2 Posts
    what do you mean by output buffering... i take it that thats wat till make it so the page appears in the body ??

  • #4
    Regular Coder
    Join Date
    Jun 2004
    Posts
    130
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by runnerjp View Post
    what do you mean by output buffering... i take it that thats wat till make it so the page appears in the body ??
    read the manual, http://nl3.php.net/manual/en/function.include.php,

    if you include a file it's included, ran as if it was inline with the code. so no need to put in in a var an then output that var or whatever.

    output buffering is needed when you dó want to store the included stuff in a var for maybe later outputting. but i don't think you want to do that.

    here's something about output buffering:
    http://blog.mdijksman.nl/?item=putti...-in-a-variable

  • #5
    Regular Coder
    Join Date
    Nov 2006
    Posts
    601
    Thanks
    1
    Thanked 2 Times in 2 Posts
    yes i dont think i need that... that the problem im haveing now is that i have used

    Code:
    if (file_exists($content)) {
    include($content);
    } else {?>
    in the body to display the content and before i changed the script i used
    Code:
    $content="include/index.inc.php";
    so that the index file would display in the content bit in body


    so how would i add $content= to

    Code:
    if($auth[error]) { include("include/index.inc.php"); } 
                else { include("include/index.log.php"); }

  • #6
    Regular Coder
    Join Date
    Jun 2004
    Posts
    130
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by runnerjp View Post
    yes i dont think i need that... that the problem im haveing now is that i have used

    Code:
    if (file_exists($content)) {
    include($content);
    } else {?>
    in the body to display the content and before i changed the script i used
    Code:
    $content="include/index.inc.php";
    so that the index file would display in the content bit in body


    so how would i add $content= to

    Code:
    if($auth[error]) { include("include/index.inc.php"); } 
                else { include("include/index.log.php"); }
    wasnt completely right above, sorry, it's almost weekend

    PHP Code:
    if ($auth[error])
    {
        
    $content = include('./include/index.inc.php');
    }
    else
    {
        
    $content = include('./include/index.log.php');
    }

    OR

    $content $auth[error] ? include('./include/index.inc.php') : include('./include/index.log.php');

    OR

    $includeFile $auth[error] ? 'index.inc.php' 'index.log.php';
    $content = include('./include' $includeFile); 
    or something :P

  • #7
    Regular Coder
    Join Date
    Nov 2006
    Posts
    601
    Thanks
    1
    Thanked 2 Times in 2 Posts
    lol wunderd why i got it worng


    thing is i cant seem to get it to work...even with what you gave me... it always appear at top of page with every thing below it


  •  

    Posting Permissions

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