Location: PHPKode > projects > Fretsweb > fretsweb-1.2/fretsweb/admin/delscores.php
<?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";

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

?>
<html>
<head>
<title>Delete scores</title>
<link href="../css.php" rel="stylesheet" type="text/css" />
<link href="../images/favicon.png" rel="icon">
</head>
<body><center>
<h2>Clear scores</h2>

<?php
include_once "log.php";
include_once "backup.php";

// called after a form submission?
if( array_key_exists('_submit_check', $_POST) ) 
{	
	$res = mysql_query( "DELETE FROM `contest_scores`" );
	if( ! $res )
		echo "<p>Cannot delete scores!</p>";
	else {
		clog("Scores deleted");
		cfeed("Scores deleted", "All the scores have been deleted, everything will start over again.", 'special');
		echo "<p>Scores deleted</p>";
	}
}
?>

<p>Do you really want to push that button? Are you sure, really sure, entirely sure?
Pushing it will remove all the data from the database! Are you sure you made your backup? Don't do it. Really. Many lives depend on it.</p>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
	<input type="hidden" name="_submit_check" value="1"/> 
	<input type="submit" value="Do as I say! Delete all the existing scores!">
</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