View Full Version : Quick PHP [HELP] V2!!
Assassinator
04-11-2007, 01:47 PM
Ok lmao so i got this code, but how would i make it so it only shows for userlevel 4?
<?php
if($fetch->ghostmode == "1")
{
echo("Ghostmode[<font color=\"green\">ON</font>]");
}
elseif($fetch->ghostmode == "0")
{
echo("Ghostmode[<font color=\"red\">OFF</font>]");
}
?>
lolwut
04-11-2007, 03:48 PM
Assuming that your userlevel variable is $fetch->level...:
<?php
if($fetch->level <= "4"){
if($fetch->ghostmode == "1") {
echo("Ghostmode[<font color=\"green\">ON</font>]");
}elseif($fetch->ghostmode == "0"){
echo("Ghostmode[<font color=\"red\">OFF</font>]");
}
}
?>
MrCraig
04-11-2007, 03:51 PM
wouldnt that make it so the userlevel has to be less than or equal to 4?
<?php
if($fetch->userlevel == "4"){
if($fetch->ghostmode == "1")
{
echo("Ghostmode[<font color=\"green\">ON</font>]");
}
elseif($fetch->ghostmode == "0")
{
echo("Ghostmode[<font color=\"red\">OFF</font>]");
}
}
?>
I think..
lolwut
04-11-2007, 03:53 PM
No, I did it if userlevel is greater than 4. :rolleyes:
MrCraig
04-11-2007, 04:05 PM
:S
doesnt
<?php
if($fetch->level <= "4"){
indicate less than or equal to?
== is equal to
!= is not equal to
>= is more than or equal to
<= is less than or equal to
> is more than
< is less than
Assassinator
04-11-2007, 04:20 PM
None of them are coming up lol.
<?php
if ($fetch->level != '4'){
die('You do not have the correct user level to enter.');
}
if($fetch->ghostmode == "1"){
echo("Ghostmode[<font color=\"green\">ON</font>]");
}elseif($fetch->ghostmode == "0")
{
echo("Ghostmode[<font color=\"red\">OFF</font>]");
}
?>
You're trying to use integar statements with strings... Don't quote the numbers.
<?php
if ($fetch->level != 4){
die('You do not have the correct user level to enter.');
}
if($fetch->ghostmode == 1){
echo("Ghostmode[<font color=\"green\">ON</font>]");
}elseif($fetch->ghostmode == 0)
{
echo("Ghostmode[<font color=\"red\">OFF</font>]");
}
?>
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.