Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2007
    Location
    Kent, England
    Posts
    149
    Tokens
    0

    Default Need Help with DJ Panel.

    Hey guys,

    Right ok what i need is the code strips in "The Housekeeping Guy" panel for:

    DJs: ( Shows number of DJ's in the panel )
    Your Level ( Shows the user level )
    Logged in as: ( Shows the username )

    If you could help me out that would be fantastic!

    Thanks,
    Josh.
    Joshyy

  2. #2
    Join Date
    Jul 2008
    Location
    Hastings, UK.
    Posts
    2,050
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by koolkid View Post
    Hey guys,

    Right ok what i need is the code strips in "The Housekeeping Guy" panel for:

    DJs: ( Shows number of DJ's in the panel )
    Your Level ( Shows the user level )
    Logged in as: ( Shows the username )

    If you could help me out that would be fantastic!

    Thanks,
    Josh.
    PHP Code:
    <?php
    $shortname 
    $_SESSION['session_username'];
    $query-for-djs mysql_query"SELECT * FROM `staff` WHERE username = '$shortname'" );
    $number-of-djs mysql_num_rows($query-for-djs);

    $object mysql_fetch_object($query-for-djs);

    echo 
    $number-of-djs;
    echo 
    $shortname;
    echo 
    $object->level;
    ?>
    Not sure if it works, but I think that's the old database structure from the old Housekeeping, hopefully it works. I grabbed the session var from guy's panel, if it doesn't work I'll try again and get other things from the panel.

  3. #3
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default

    i dont think that will work :S

    the "for" is a reserved command and i dont think it can be used in variables..
    Correct me if im wrong though.
    Coming and going...
    Highers are getting the better of me

  4. #4
    Join Date
    Nov 2007
    Location
    London
    Posts
    1,577
    Tokens
    36

    Latest Awards:

    Default

    Quote Originally Posted by Calon View Post
    PHP Code:
    <?php
    $shortname 
    $_SESSION['session_username'];
    $query-for-djs mysql_query"SELECT * FROM `staff` WHERE username = '$shortname'" );
    $number-of-djs mysql_num_rows($query-for-djs);

    $object mysql_fetch_object($query-for-djs);

    echo 
    $number-of-djs;
    echo 
    $shortname;
    echo 
    $object->level;
    ?>
    Not sure if it works, but I think that's the old database structure from the old Housekeeping, hopefully it works. I grabbed the session var from guy's panel, if it doesn't work I'll try again and get other things from the panel.
    PHP Code:
    <?php
    $shortname 
    $_SESSION['session_username'];
    if(
    $_SESSION['session_level'] == "1") {
    $level "Admin";
    }
    else {
    $level "DJ";
    }
    $querydjs mysql_query"SELECT * FROM `staff`" );
    $numberofdjs mysql_num_rows($querydjs);

    echo 
    'DJs: ' $numberofdjs '';
    echo 
    'Your Level: ' $level '';
    echo 
    'Logged in as: ' $shortname '';
    ?>
    Should work?
    Kind Regards,

    Guy
    __________________

    Since 2007. Unbelievable Uptime. Web hosting, resellers, master resellers, linux VPS, windows VPS, shoutcasts, at the lowest prices on the net.
    Tech-Hosts.co.uk.


  5. #5
    Join Date
    Sep 2008
    Location
    UK
    Posts
    3,670
    Tokens
    0

    Latest Awards:

    Default

    Would work but why don't you just echo the session level?
    $_SESSION['session_level']?
    Back for a while.

  6. #6
    Join Date
    Sep 2005
    Location
    East London
    Posts
    3,028
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Excellent2 View Post
    Would work but why don't you just echo the session level?
    $_SESSION['session_level']?
    Because the user could be promoted/demoted whilst logged in.

    I think its bad to set username and details as sessions because if the user changes them it will have the wrong session.

    I think its best to get stuff from table with id, as that is extremely unlikely to change ;P

  7. #7
    Join Date
    Jul 2008
    Location
    Hastings, UK.
    Posts
    2,050
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by MrCraig View Post
    i dont think that will work :S

    the "for" is a reserved command and i dont think it can be used in variables..
    Correct me if im wrong though.
    Ah, your right. ;D

  8. #8
    Join Date
    Nov 2007
    Location
    London
    Posts
    1,577
    Tokens
    36

    Latest Awards:

    Default

    Quote Originally Posted by Excellent2 View Post
    Would work but why don't you just echo the session level?
    $_SESSION['session_level']?
    Because the session level is either 1 or 0. I'm not silly enough to not realise I could do that if I could...

    Quote Originally Posted by Jackboy View Post
    Because the user could be promoted/demoted whilst logged in.

    I think its bad to set username and details as sessions because if the user changes them it will have the wrong session.

    I think its best to get stuff from table with id, as that is extremely unlikely to change ;P
    It's based off the original housekeeping, that's how it was done. I only tweaked things like that slightly to make it more secure.
    Kind Regards,

    Guy
    __________________

    Since 2007. Unbelievable Uptime. Web hosting, resellers, master resellers, linux VPS, windows VPS, shoutcasts, at the lowest prices on the net.
    Tech-Hosts.co.uk.


Posting Permissions

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