Menu

[2eb2a2]: / search_edit.php  Maximize  Restore  History

Download this file

69 lines (57 with data), 1.8 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php session_start(); ?>
<html>
<head>
<title>deltasql - Edit Search Query</title>
<link rel="stylesheet" type="text/css" href="deltasql.css">
<link rel="shortcut icon" href="pictures/favicon.ico" />
</head>
<body>
<?php
include("head.inc.php");
include("utils/utils.inc.php");
include("utils/constants.inc.php");
if (!file_exists($configurationfile)) die("<h2><a href=\"install.php\">$installmessage</a></h2>");
show_user_level();
$rights = $_SESSION["rights"];
if ($rights<1) die("<b>Not enough rights to edit search queries</b>");
?>
<?php
include("conf/config.inc.php");
if (isset($_GET['id'])) $id=$_GET['id']; else $id="";
if ($id!="") {
// on the second call ID is empty
mysql_connect($dbserver, $username, $password);
@mysql_select_db($database) or die("Unable to select database");
$query="SELECT queryname from `tbsearchquery` WHERE id=$id";
$result7=mysql_query($query);
$queryname=mysql_result($result7,0,"queryname");
mysql_close();
} else {
$queryname="";
}
?>
<h2>Edit Search Query</h2>
<form action="search_edit.php" method="post">
Query Name:<br>
<textarea name="queryname" rows="4" cols="70">
<?php echo "$queryname"; ?>
</textarea>
<br>
<?php
echo "<input type=\"hidden\" name=\"queryid\" value=\"$id\">";
?>
<input type="Submit" value="Save Query Name">
</form>
<?php include("bottom.inc.php"); ?>
<?php
if (isset($_POST['queryid'])) $queryid=$_POST['queryid']; else exit;
$frm_queryname=$_POST['queryname'];
mysql_connect($dbserver, $username, $password);
@mysql_select_db($database) or die("Unable to select database");
$query2="UPDATE tbsearchquery SET queryname='$frm_queryname' WHERE id=$queryid;";
mysql_query($query2);
mysql_close();
js_redirect("search_scripts.php");
?>
</body>
</html>