Add a domain search tool

This commit is contained in:
Mark Crane 2014-07-23 04:24:57 +00:00
parent 6139fa02f1
commit c20f836d8c
1 changed files with 53 additions and 38 deletions

View File

@ -98,9 +98,12 @@ else {
require_once "resources/paging.php";
//get variables used to control the order
$order_by = $_GET["order_by"];
$order = $_GET["order"];
//get the http values and set them as variables
$search = check_str($_GET["search"]);
if (isset($_GET["order_by"])) {
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
}
//show the content
echo "<div align='center'>";
@ -109,10 +112,16 @@ else {
echo " <td align=\"center\">\n";
echo " <br />";
//show the header and the search
echo "<table width='100%' border='0'>\n";
echo " <tr>\n";
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['header-domains']."</b></td>\n";
echo " <td width='50%' align='right'>&nbsp;</td>\n";
echo " <form method='get' action=''>\n";
echo " <td width='50%' align='right'>\n";
echo " <input type='text' class='txt' style='width: 150px' name='search' value='$search'>";
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
echo " </td>\n";
echo " </form>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td align='left' colspan='2'>\n";
@ -146,6 +155,12 @@ else {
//get the list
$sql = "select * from v_domains ";
if (strlen($search) > 0) {
$sql .= "where (";
$sql .= " domain_name like '%".$search."%' ";
$sql .= " or domain_description like '%".$search."%' ";
$sql .= ") ";
}
if (strlen($order_by) == 0) {
$sql .= "order by domain_name asc ";
}