winmastergames Posted June 14, 2008 Share Posted June 14, 2008 What i want to be able to do is If someone goes to a webpage it checks MYSQL to see if it is enabled if not it Displays a message "Sorry This Service has been disabled by the Administrator" Anyone Know how to do this Thanks Link to comment https://forums.phpfreaks.com/topic/110170-disable-webpages-using-mysql-and-php/ Share on other sites More sharing options...
schme16 Posted June 14, 2008 Share Posted June 14, 2008 function webPageActive($url) { $checkingState = @mysql_fetch_array(@mysql_query("select * from `table_of_urls` where `url`='$url'")) if($checkingState['site_active'] != 'TRUE') { exit("Sorry, this website is innactive at the moment"); } } function selfURL() { $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s; $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]); return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI']; } function strleft($s1, $s2) { return substr($s1, 0, strpos($s1, $s2)); } put this at the top of the pages to be checked: webPageActive(selfURL()); Just edit the sql and you should be right... pm me if you have any problems. Link to comment https://forums.phpfreaks.com/topic/110170-disable-webpages-using-mysql-and-php/#findComment-565516 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.