Help with syntax

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • manguish
    Senior Member
    • Jan 2004
    • 361

    Help with syntax

    I`m trying to stop a usergroup viewing a page, and have the following :

    PHP Code:
    if(( $bbuserinfo[usergroupid == 2]) 

    eval(
    print_standard_error('nopermission_loggedin')); 

    else 

     
    val('print_output("' fetch_template('chat') . '");'); 
    Which gives me parse errors.

    Where am i going wrong?

    Many Thanks.
    For all your minimoto needs : www.minimotoclub.com
  • Floris
    Senior Member
    • Dec 2001
    • 37767

    #2
    if(( $bbuserinfo[usergroupid == 2])
    The first error would be ((
    change this to (

    if ( .. )

    you have if (( ..)

    Your second error would be the if statement itself, it is not closed.

    if ( .. )
    {
    something
    }
    else
    {
    something else
    } // was missing.

    and you have:
    val('print ...
    maybe that should be eval ...

    Comment

    • manguish
      Senior Member
      • Jan 2004
      • 361

      #3
      My cut and paste missed the e off

      Cheers for spotting the bracket
      For all your minimoto needs : www.minimotoclub.com

      Comment

      • manguish
        Senior Member
        • Jan 2004
        • 361

        #4
        I now have this :

        PHP Code:
        <?php
        require_once('./global.php');
         
        if(
        $bbuserinfo[usergroupid=='2']) 

        eval(
        print_standard_error('nopermission_loggedin')); 

        else 

        eval(
        'print_output("' fetch_template('chat') . '");');
        }
        ?>
        But it still allows userid of 2 to view the page. Any idea why this may be?
        Last edited by manguish; Thu 1 Apr '04, 3:44am.
        For all your minimoto needs : www.minimotoclub.com

        Comment

        • Zachery
          Former vBulletin Support
          • Jul 2002
          • 59097

          #5
          you just dont want guest to view the page right?

          PHP Code:
           <?php 
          require_once('./global.php');
           
          if(
          $bbuserinfo[userid] == '0'

          eval(
          print_standard_error('nopermission_loggedin') ); 

          else 

          eval(
          'print_output("' fetch_template('chat') . '");');
          }
           
           
           
           
          ?>

          your if was still abit off


          if($bbuserinfo[usergroupid=='2']) needs to be if($bbuserinfo[usergroupid] == X) you had the 2 inside the varible.

          Comment

          • manguish
            Senior Member
            • Jan 2004
            • 361

            #6
            Yeah i figured this while you replied

            your one doesn`t work though - you need this :

            PHP Code:
            <?php
            require_once('./global.php');
            if(
            $bbuserinfo[usergroupid] == 2)

            eval(
            print_STANDARD_ERROR('nopermission_loggedin')); 

            else 

            eval(
            'print_output("' fetch_template('chat') . '");');
            }
            ?>
            With usergroupid in it instead of userid.
            For all your minimoto needs : www.minimotoclub.com

            Comment

            • Zachery
              Former vBulletin Support
              • Jul 2002
              • 59097

              #7
              Lol, you dnot want the registered usergroup to see it my bad

              Comment

              • manguish
                Senior Member
                • Jan 2004
                • 361

                #8
                For all your minimoto needs : www.minimotoclub.com

                Comment

                widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                Working...