Every page should have an ID. You will take that ID and compare it against the database. Your database will have a column which will tell your script if that page is online or not. I've done plenty of things like this in the past few years.. Here's a small example -
Code:
MySQL TABLE - Pages
page_id page_name show_page reason_offline
1 news 1
2 forums 0 Because our forums suck
PHP Code:
PAGE BEING DISPLAYED - news.php
$page_id = $_GET['page_id']; // What page is this? $query = "SELECT * FROM pages WHERE page_id=`$page_id`"; // Grab page DB info $result = mysql_query($query) or die ('Error in query: ' . mysql_error()); // Grab MySQL result $row = mysql_fetch_object($result); // Put result into an object if ($row->show_page == 0) { // Page is offline. Let em know.. print "This page is currently offline. Please check back later. Reason: $row->reason_offline"; die; // Kill the page.. Make sure to display the rest of your HTML though. }
To explain.. You have 4 columns in the table "pages". The columns identify page_id, name, if it's offline or not, and why it's offline.
Your code on all of your pages grabs that specific pages row in the database based on the page id provided using the get method. You sound new so in case you don't know you pass information via the url ( www.something.com/index.php?page_id=1) to your script by using $_get['page_id'].
This is all EXTREMELY basic. If you don't understand what I've said here you really need to hit the books much harder. PHP is easy once you get the hang of it.
Good luck. Let me know if you need more help.
__________________
PHP Code:
$talkupation++;
Please login or register to view this content. Registration is FREE - Free IPB forum hosting (releasing today!!!), no ads, free modifications
|