Location: PHPKode > projects > Fretsweb > fretsweb-1.2/fretsweb/admin/delforum.php
<?

/*
Fretsweb - A Frets on Fire chart server
Copyright (C) 2009, Daan Sprenkels

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

require_once "common.php";
require_once "log.php";

//Login Test
session_start();
if($_SESSION['in'] < 2)
{
	header('location: login.php?need=admin');
	die();
}

if($_POST['_submit_check'] == 1)
{
	mysql_query( "DROP TABLE IF EXISTS `contest_forum`" );
	//create the 'forum' table
	$sql = "CREATE TABLE `contest_forum` (
						`name` VARCHAR( 100 ) NOT NULL,
						`text` TEXT NOT NULL ,
						`time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
					)";
	mysql_query( $sql ) or die( "Cannot create table `contest_forum`: " . mysql_error() );
	$sql = "INSERT INTO `contest_forum` (`name`,`text`) VALUES ('Fretsweb','Hello everyone!\nIt seems that the forum has been deleted. So I\'ll explain the purpose of this forum. On this forum everyone can post his or her message. It\'s the main road to coming in contact with your Administrator, have fun!')";
	mysql_query( $sql ) or die('First forum post failed... Forum is created. But there was this error: '.mysql_error());
	$info = 'Forum deleted (and built again).';
	clog('FORUM RESET');
	cfeed('Forum reset', 'The forum is reset, all posts have been deleted. If you want to use the forum, click on forum at the extra panel at the bottom of the screen.', 'configchange');
}

?>
<html>
<head>
<title>Init forum</title>
<link href="../css.php" rel="stylesheet" type="text/css" />
<link href="../images/favicon.png" rel="icon">
</head>
<body><center>
<h2>Reset forum</h2>
<?php
include_once "log.php";

if(isset($info))
	echo '<p class="info">'.$info.'</p>';
else
	echo '<p>Do you really want to push that button? Are you sure, really sure, entirely sure?
Pushing it will remove the whole forum! Are you sure you made your backup? Don\'t do it. Really. Many lives depend on it.</p>
<form action="'.$_SERVER['PHP_SELF'].'" method="post">
	<input type="hidden" name="_submit_check" value="1" /> 
	<input type="submit" value="Do as I say! Reset the forum!">
</form>';
?>

<p><b><a href="index.php">Back to main administration panel</a></b><p>
</center></body>
</html>

<?php
	// close DB
	mysql_close( $db_link ); 
?>

Return current item: Fretsweb