Jump to content

Steve2000

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Steve2000's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Wow, you certainly know your PHP! All this seemed beyond me when I was trying it. Thanks for the help wildteen!
  2. Thanks for the quick reply wildteen88, that works prefectly! But one more question. I want to do the same thing with user levels. At the moment, the user levels are 1,2,3 and 4 - the actual ranks for these are user, staff, moderator and admin respectively. If I did the same thing here, instead of showing 1,2,3 and 4 as the options in the menu, could I have user, staff, moderator and admin as the values? Kind of like <option value="1">User</option>. Would that be possible? Thanks again.
  3. Hi all, I'm fairly new to PHP, and as my first project I'm creating a member site, and I'm currently in the process of making an update profile page. I've got everything like username, password, email etc working, but I have become stuck on the user status. Basically, I have two status options that the user can choose from a drop down menu, Active and Inactive. I want the page to detect which status the current user is, and make that the default selected option in the list. So for example, if a user is active, and they go to the update profile page, the active option is selected for them in the menu. They should be able to change it also. I have no real idea how to do this. I suppose it's a matter of just <? echo $status; ?>, but I don't know how to put this into a drop down menu. Any help on this would be very much appreciated. Thanks.
  4. OK got it sorted now, thanks for the help guys!
  5. Would it matter if the 0 is a user level? The user levels go from 0 to 4, so would it be better to make them 1 to 5?
  6. Hi, I'm fairly new to PHP, and have just started creating a very basic PHP login system for my site, and have gotten stuck on the login page. I want it to check to see if you're already logged in, and if you are, display a message saying you're already logged in. If you aren't logged in already, it will display the login form. Here's the code: <?php session_start(); if($_SESSION['user_level'] == 4){ echo "You are already logged in as ". $_SESSION['username'] ."!"; } if($_SESSION['user_level'] == 3){ echo "You are already logged in as ". $_SESSION['username'] ."!"; } if($_SESSION['user_level'] == 2){ echo "You are already logged in as ". $_SESSION['username'] ."!"; } if($_SESSION['user_level'] == 1){ echo "You are already logged in as ". $_SESSION['username'] ."!"; } if($_SESSION['user_level'] == 0){ echo "You are already logged in as ". $_SESSION['username'] ."!"; } else { include 'loginform.php'; } ?> This works if you're logged in, but if you aren't then it still shows the "already logged on" message anyway. My second question is instead of using those 5 seperate terms, could I just use one to check whether or not you're logged in? Any help would be very much appreciated. Thanks.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.