-
Aug 27th, 2015, 01:32 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] accessing page
Hello,
I use the code below to allow members that have the user level 2 to view the page but is there away so that i can allow people with user level 1 to view the page aswell?
PHP Code:
* <?php
* * * * if($user_level != 2){
* * * * * * echo "You dont have access to this page sorry!* Please register an account today to support the club <a href='register.php'>Click Here</a>.";
* * * * }
* * * else {
* * * *
* * * * $select_profile = "select * from team order by rand()";
* * * *
* * * * $run_profile = mysql_query($select_profile);
* * * *
* * * * while($row=mysql_fetch_array($run_profile)){
* * * * * * $id = $row['id'];
* * * * * * $fullname = $row['name'];
* * * * * * $fight_name = $row['fight_name'];
* * * * * * $age = $row['Age'];
* * * * * * $height = $row['Height'];
* * * * * * $weight = $row['Weight'];
* * * * * * $record = $row['Record'];
* * * * * * $image= $row['image'];
* * * * ?>
* * * *
* * * *<div id="images">
* * * * * * <a href="profile.php?id=<?php echo $id; ?>">
* * * * * * <img src="profile/<?php echo $image;* ?>" width="200" height="200" />
* * * * * * </a>
* * * *</div>
* * * *
* * * * <?php }} ?>
come back and mark your original post as resoved if your problem is fixed
Jamie Garland
-
Aug 27th, 2015, 08:03 AM
#2
Re: accessing page
Try...
if($user_level <= 2)
-tg
EDIT wait... I see the logic is backwards to what I expected...
try if($user_level > 2) instead... so 1 & 2 will fall into the Else, anything bigger than 2 will fall into the if and get the denied message.
-tg
-
Aug 27th, 2015, 08:24 AM
#3
Thread Starter
Frenzied Member
Re: accessing page
I tried both of them but it still lets everyone see the page?.
if($user_level != 2)
that lets people with user level 2 login to view the page but not level 1?
come back and mark your original post as resoved if your problem is fixed
Jamie Garland
-
Aug 27th, 2015, 08:54 AM
#4
Re: accessing page
right... thay says, if they are NOT EQUAL (!=) to 2 then deny them... so anyone with 1, 3,4,5 user level cannot see the page... so if you want to allow 1 & 2 to see the page, then you deny user level greater than 2 (>2)
You can also try
if( ($user_level != 1) && ($user_level != 2) )
so If they are (not user level 1) and (not user level 2) ... then deny access...
-tg
-
Aug 27th, 2015, 10:58 AM
#5
Thread Starter
Frenzied Member
Re: accessing page
Hello,
Thanks that sorted that problem.
im putting my usernames in to a table now my question is i have them displaying down the page hopw do i get it so they go along the page and not down?
Code:
<table border='1'>
<tr>
<td><?php echo $username; ?></td>
</tr>
</table>
come back and mark your original post as resoved if your problem is fixed
Jamie Garland
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|