Access Pages
4 posts
Page 1 of 1
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?
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?
Code: Select all
<?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 }} ?>
Just woke up but couldn't you just use something like:
Code: Select all
dunnno;if($user_level >= 1)
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
Hello Codenstuff,
I tried what you said and it didnt work lets everyone view the page
if i put this code
if($user_level != 2)
it lets people with user_level 2 view it but not with people with user_level 1?
I tried what you said and it didnt work lets everyone view the page
if i put this code
if($user_level != 2)
it lets people with user_level 2 view it but not with people with user_level 1?
Hello,
Got that sorted thanks.
One more thing how do i get this in to a table so it displays the records along the way?
Got that sorted thanks.
One more thing how do i get this in to a table so it displays the records along the way?
Code: Select all
<?php
if( ($user_level != 1) && ($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 {
$query = "select * from users";
$run = mysql_query($query);
while ($row=mysql_fetch_array($run)){
$username = $row['username'];
?>
<?php
echo $username ?><br />
<?php
}
}
?>
4 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023