<?php session_start(); ?>
<html>
<head>
<title>deltasql - Delete Search Queries</title>
<link rel="stylesheet" type="text/css" href="deltasql.css">
</head>
<body>
<?php
include_once('utils/compatibility.inc.php');
setCompatibility(0);
include("head.inc.php");
include("conf/config.inc.php");
include("utils/utils.inc.php");
$rights = $_SESSION["rights"];
$user = $_SESSION["username"];
$userid = $_SESSION["userid"];
$anon = $_GET['anon'];
if (($anon==1) && ($rights<2)) die("<b>Not enough rights to delete search queries for the anonymous user.</b>");
if ($anon==1) $userfilter="WHERE user_id IS NULL"; else $userfilter="WHERE user_id=$userid and (isfavourite=0 or isfavourite is null)";
mysql_connect($dbserver, $username, $password);
@mysql_select_db($database) or die("Unable to select database");
$query="DELETE FROM tbsearchquery $userfilter";
mysql_query($query);
mysql_close();
//js_redirect("preferences.php");
?>
<?php
if ($anon=="1")
echo "<h3>All search queries are now deleted for the anonymous user!</h3>";
else
echo "<h3>All your search queries are deleted now!</h3>";
?>
<a href="preferences.php">Back to Preferences...</a>
</body>
</html>