Hey guys here is where i'm stuck:
i have adverts on the site but i have set permission on the adverts to be either 'public' or 'restricted' so based on that i want to create a statement with three possible outcomes, it should check the values of the columns and if the is an advert it will check the permission if the permission 0 (public) it shows the ad if permission 1 (restricted) it will direct the user to a log-in page however if the user is logged on then it will just show all the adverts.
These is the code i'm using but it is only executing the else line (so when the user clicks on the ad it takes them straight to the login page even if the ad is set to '0')....i checked the error log and i get the msg 😛HP Notice: Undefined variable: SiteDir in
code:
<?php
$qry_getAdverts = mysql_query("SELECT advertID,accesslevelID FROM adverts_adverts");
$row_getAdvert = mysql_fetch_assoc($qry_getAdverts);
if($qry_getAdverts["AdvertID"] > 0 && ($qry_getAdverts["accesslevelID"] == 0 )) {
echo($row_getAdvert["Content"]);
}
else {
echo '<script type="text/javascript">window.location.href=\'' . $SiteURL . '/my-account/login.php\';</script>' ;
}
?>
I tried put it as an array and use a while loop but still it didn't work
Any tips much appreciated!
Thanks