Location: PHPKode > projects > Top site PHP script > topsite/reset.php
<?php
include('config.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link href="<?php echo $design; ?>/style.css" rel="stylesheet" title="Style" />
        <title>Reset the votes - Top site</title>
    </head>
    <body>
    	<div class="header">
        	<a href="<?php echo $url_topsite; ?>"><img src="<?php echo $design; ?>/images/logo.png" alt="Top site" /></a>
	    </div>
        <div class="content">
<?php
//We check if its an admin
if($_SESSION['logged']==true)
{
	//We check if the reset has been confirmed
	if(isset($_POST['confirmation']) and $_POST['confirmation']=='true')
	{
		//We reset the votes
		if(mysql_query('update topsite set votes="0"'))
		{
			echo '<strong>The top site has successfully been reset.</strong>';
		}
		else
		{
			echo '<strong>An error occurred while reset the top site.</strong>';
		}
	}
	else
	{
		//We display the confirmation form
?>
<form action="reset.php" method="post">
    <input type="hidden" name="confirmation" value="true" />
    Are you sure that you want to reset the votes?<br />
    <input type="submit" value="Yes" /> <input type="button" value="No" onclick="javascript:history.back();" />
</form>
<?php
	}
}
?>
        </div>
        <div class="foot">
            <a href="<?php echo $url_topsite; ?>">Return to the Top site</a> - <a href="http://www.webestools.com/">Webestools</a>
        </div>
    </body>
</html>
Return current item: Top site PHP script