PHP expert |
|
heb hier een script dat je rank checkt en dan wel of niet toegang verleent, alleen als ik het toepas en ben niet ingelogd staat er keurig van dat je moet inloggen om te pagina te bezichten alleen de inhoud vna de pagina word ook geshowd
statuscheck.php
<?php
if(empty($_COOKIE['username']) AND (empty($_COOKIE['password']) AND (empty($_COOKIE['hash'])))) {
function secure($rights){
if($rights == "2" || $rights == "3" || $rights == "4" || $rights == "5"){
echo ("You need to login to view this page");
}
else{}
}
}
else{
$query = mysql_query("SELECT * FROM members WHERE username='" . $_COOKIE['username'] . "' AND pass='" . $_COOKIE['password'] . "'") OR die(mysql_error());
$list = mysql_fetch_object($query);
$rank = "$list->rank";
$query_rank = mysql_query("SELECT * FROM ranks WHERE id='" . $rank . "'") OR die(mysql_error());
$list_rank = mysql_fetch_object($query_rank) OR die(mysql_error());
$rank_rights = "$list_rank->rights";
$rank_color = "$list_rank->color";
$rank = "$list_rank->rank";
if($rank_rights == "0"){
echo ("<strong>You have been banned form this site!</strong><br><br>");
}else{}
function secure($rights){
global $rank_rights;
if($rights == "5"){
if($rank_rights == "5") {}
else{
echo ("You don't have permission to view this page");}
}
if($rights == "4"){
if($rank_rights == "4" || $rank_rights == "5") {}
else{
echo ("You don't have permission to view this page"); }
}
if($rights == "3"){
if($rank_rights == "3" || $rank_rights == "4" || $rank_rights == "5"){}
else{
echo ("You don't have permission to view this page");}
}
if($rights == "2"){
if($rank_rights == "2" || $rank_rights == "3" || $rank_rights == "4" || $rank_rights == "5"){}
else{
echo ("You don't have permission to view this page"); }
}
if($rights == "1"){}
else{}
}
}
?>
<?php if(empty($_COOKIE['username']) AND (empty($_COOKIE['password']) AND (empty($_COOKIE['hash'])))) { function secure($rights){ if($rights == "2" || $rights == "3" || $rights == "4" || $rights == "5"){ echo ("You need to login to view this page"); } else{} } } else{ $query = mysql_query("SELECT * FROM members WHERE username='" . $_COOKIE['username'] . "' AND pass='" . $_COOKIE['password'] . "'") OR die(mysql_error()); $rank = "$list->rank"; $rank_rights = "$list_rank->rights"; $rank_color = "$list_rank->color"; $rank = "$list_rank->rank"; if($rank_rights == "0"){ echo ("<strong>You have been banned form this site!</strong><br><br>"); }else{} function secure($rights){ if($rights == "5"){ if($rank_rights == "5") {} else{ echo ("You don't have permission to view this page");} } if($rights == "4"){ if($rank_rights == "4" || $rank_rights == "5") {} else{ echo ("You don't have permission to view this page"); } } if($rights == "3"){ if($rank_rights == "3" || $rank_rights == "4" || $rank_rights == "5"){} else{ echo ("You don't have permission to view this page");} } if($rights == "2"){ if($rank_rights == "2" || $rank_rights == "3" || $rank_rights == "4" || $rank_rights == "5"){} else{ echo ("You don't have permission to view this page"); } } if($rights == "1"){} else{} } } ?>
en dan op mijn pagina doe ik dit:
secure.php
<?php
include("config.php");
include("statuscheck.php");
secure("3");
echo "secure3";
?>
<?php include("config.php"); include("statuscheck.php"); secure("3"); ?>
even simple secure pagina gemaakt anders krijg je van die lappen text
maar als ik niet ben ingelogd en ga naar secre.php moet er komen te staan:
Citaat: You need to login to view this page
alleen ik krijg
Citaat: You need to login to view this pagesecure3
ook de inhoud van secure3.php
|