SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist
    Join Date
    Jul 2004
    Location
    USA
    Posts
    594
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    if($level == User)

    Im trying to use this code to show something on the menu navigation for certain usergroups only, i got it working good right now with this:

    PHP Code:
     <?php
    if($level == Admin)
    {
    ?>

      
      <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
        <tr>
          <td width="7%">&nbsp;</td>
          <td width="81%">&nbsp;</td>
        </tr>
        <tr>
          <td width="88%" colspan="2" bgcolor="#032241">
          <p align="center">
          <img border="0" src="images/nav_admin.gif" width="134" height="37"></td>
        </tr>
        <tr>
          <td width="7%" bgcolor="#032547">&nbsp;</td>
          <td width="81%" bgcolor="#032547">&nbsp;</td>
        </tr>
        <tr>
          <td width="7%" bgcolor="#032547">&nbsp;</td>
          <td width="81%" bgcolor="#032547">  <b><font face="Verdana" size="1">  <a href="index.php?page=addstory">Add Story</a></font></b></td>
        </tr>
        <tr>
          <td width="7%" bgcolor="#032547">&nbsp;</td>
          <td width="81%" bgcolor="#032547"><b><font face="Verdana" size="1"><a href="index.php?page=editstory">Edit Story</a></font></b></td>
        </tr>
        <tr>
          <td width="7%" bgcolor="#032547">&nbsp;</td>
          <td width="81%" bgcolor="#032547"><b><font face="Verdana" size="1">
          <a href="index.php?page=memberslist">Users List</a></font></b></td>
        </tr>
        <tr>
          <td width="7%" bgcolor="#032547">&nbsp;</td>
          <td width="81%" bgcolor="#032547"><b><font face="Verdana" size="1">
          <a href="index.php?page=viewapps">View Applications</a></font></b></td>
        </tr>
      </table>
      
    <?php 

    ?>
    What i want to do differently though now is changed it so if $level is unset, to display something, so basically if the member was not signed in, it would show a login form.

    How could i do this?
    BKerr

  2. #2
    SitePoint Evangelist Aska's Avatar
    Join Date
    Aug 2003
    Location
    Melbourne, Australia
    Posts
    454
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Something like this...?
    PHP Code:
    if( !isset($level) )
    {
      
    // display login form
    }
    elseif( 
    $level == Admin )
    {
      
    // show admin stuff


  3. #3
    SitePoint Evangelist
    Join Date
    Jul 2004
    Location
    USA
    Posts
    594
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Should this work?

    PHP Code:
    <?php 
    if( !isset($level) ) 

      
    // nothing here
    }
    else
    {
    ?>
      <tr>
        <td width="7%" bgcolor="#032547">&nbsp;</td>
        <td width="81%" bgcolor="#032547"> <b><a href="index.php?page=settings">
        <font size="1" face="Verdana">Edit Settings</font></a></b></td>
      </tr>
      <tr>
        <td width="7%" bgcolor="#032547">&nbsp;</td>
        <td width="81%" bgcolor="#032547"> <b><a href="index.php?page=profile&regid=<?php echo $id?>">
        <font size="1" face="Verdana">Your Profile</font></a></b></td>
      </tr>
     <?php
     
    }
    ?>
    BKerr

  4. #4
    SitePoint Evangelist Aska's Avatar
    Join Date
    Aug 2003
    Location
    Melbourne, Australia
    Posts
    454
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Looks fine to me

  5. #5
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,653
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Also, remember to check user level on the pages you link through. If someone guesses a URL, you could be screwed.


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
  •