1 (edited by Nix 2005-04-23 15:42)

Topic: PHP Problems.

Hey,
my site: www.the44th.co.uk

If you look in the bottom right hand corner of both the index.php and members.php page. You will notice a 'User Panel'.

This panel is a simple if-else statement checking if the user is a guest or not and then a switch within the else to define different access.

I originally had this hard-coded into the index.php page, but as I recently added it to the members.php page so I saw the benefits of using an include instead to help with editing.

The problem I now have it that the panel does not want to recognise when people are logged in. I've printed the variable $pun_user['g_id']; which you can see is "3" (Guest) and it does not change even when people are logged in and their g_id should be different.




<?php


define('PUN_ROOT', './forum/');                             /* Where the root folder is */
require PUN_ROOT.'include/common.php';                      /* Get the file "include/common.php" */

                   
                       
                          /* Logged in / Logged out section */


   print $pun_user['g_id'];

   if ( $pun_user['g_id'] == 3 ) { 

         ?>
       
          /* Some HTML */

        <?

  }

   else {
    
      ?>

         /* HTML & Switch */

       <?

 }

                          /* End of Logged in / logged out section */

?>

Any help will be much appreciated. Thanks.

Re: PHP Problems.

Whether that code is directly in the script of in an included script really shouldn't affect anything. Are you sure that's the only change you've made?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

3

Re: PHP Problems.

I'm pretty sure, I have the

define('PUN_ROOT', './forum/');                             /* Where the root folder is */
require PUN_ROOT.'include/common.php';                      /* Get the file "include/common.php" */

on the top of my index.php page too.

I have no idea why it's doing it but the g_id just will not recognise the change when someone is logged in, it just remains at 3.
It worked on index.php, all i did was to copy it and move it to user_panel.php which is what you see above ^ and i included the user_panel to where the old code was.