/var/www/globavet.com/en/search.php


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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<?php require_once('../webadmin/configure.php');

// Set up our error check and result check array
$error = array();
$results = array();

// Since this is a search we will use $_GET
$searchTerms trim($_GET['s']);
if (isset(
$_GET['s'])  && $searchTerms) {

    
//echo "searching $searchTerms <br/>";
    
$searchTerms mysql_real_escape_string(strip_tags($searchTerms)); // remove any html/javascript.

    
$searchSQL "SELECT
aboutus.aboutusid,
aboutus.title_en as TitleEN,
aboutus.desc_en as DescEN,
aboutus.title_tc as TitleTC,
aboutus.desc_tc as DescTC,
aboutus.sort,
aboutus.lastupdate,
CONCAT('aboutus.php?aboutusid=',aboutusid) as Href
FROM aboutus
WHERE title_en LIKE '%
$searchTerms%' OR desc_en LIKE '%$searchTerms%'
OR title_tc LIKE '%
{$searchTerms}%' OR desc_tc LIKE '%{$searchTerms}%'
UNION SELECT
services.servicesid,
services.title_en,
services.desc_en,
services.title_tc,
services.desc_tc,
services.sort,
services.lastupdate,
CONCAT('services.php?servicesid=',servicesid) as Href
FROM
services
WHERE title_en LIKE '%
{$searchTerms}%' OR desc_en LIKE '%{$searchTerms}%'
OR title_tc LIKE '%
{$searchTerms}%' OR desc_tc LIKE '%{$searchTerms}%'
UNION SELECT
clinic_spec.clinic_specid,
clinic_spec.title_en,
clinic_spec.desc_en,
clinic_spec.title_tc,
clinic_spec.desc_tc,
clinic_spec.sort,
clinic_spec.lastupdate,
CONCAT('clinic_spec.php?clinic_specid=',clinic_specid) AS Href
FROM
clinic_spec
WHERE title_en LIKE '%
{$searchTerms}%' OR desc_en LIKE '%{$searchTerms}%'
OR title_tc LIKE '%
{$searchTerms}%' OR desc_tc LIKE '%{$searchTerms}%'
UNION SELECT
cinfo.cinfoid,
cinfo.title_en,
cinfo.desc_en,
cinfo.title_tc,
cinfo.desc_tc,
cinfo.sort,
cinfo.lastupdate,
CONCAT('info.php?infoid=',cinfoid) AS Href
FROM
cinfo
WHERE title_en LIKE '%
{$searchTerms}%' OR desc_en LIKE '%{$searchTerms}%'
OR title_tc LIKE '%
{$searchTerms}%' OR desc_tc LIKE '%{$searchTerms}%'
UNION SELECT
News.NewsId,
News.TitleEN,
News.DescEN,
News.TitleTC,
News.DescTC,
News.Sort,
News.Timestamp,
News.Href
FROM News
WHERE TitleEN LIKE '%
{$searchTerms}%' OR DescEN LIKE '%{$searchTerms}%'
OR TitleTC LIKE '%
{$searchTerms}%' OR DescTC LIKE  '%{$searchTerms}%'
ORDER BY lastupdate DESC"
;

    
//echo "SQL $searchSQL <br/>";

    
$searchResult mysql_query($searchSQL) or trigger_error("There was an error.<br/>" mysql_error() . "<br />SQL Was: {$searchSQL}");

    if (
mysql_num_rows($searchResult) < 1) {
         
$error[] = "The search term provided {$searchTerms} yielded no results.";
    }else {
         
$results = array(); // the result array
         
$i 1;
         while (
$row mysql_fetch_assoc($searchResult)) {

            
$tempResult "{$i}: <strong>{$row['TitleEN']}&nbsp;&nbsp;{$row['TitleTC']}</strong><br />";

            
$strTitleEN stristr(strip_tags($row['TitleEN']), $searchTerms);
            
$strTitleTC stristr(strip_tags($row['TitleTC']), $searchTerms);
            
$strDescEN stristr(strip_tags($row['DescEN']), $searchTerms);
            
$strDescEN mb_substr($strDescEN0500);
            
$strDescTC stristr(strip_tags($row['DescTC']), $searchTerms);
            
$strDescTC mb_substr($strDescTC0500);

            if (
$strDescEN) {
                
$tempResult .= $strDescEN"<br />";
            }
            elseif (
$strDescTC) {
                
$tempResult .= $strDescTC"<br />";
            }
            
$tempResult .=  "<a href='{$row['Href']}'>Read more... </a><br /><hr /><br />";

            
$results[] = $tempResult;
            
$i++;
         }
    }
}


?>
<!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" />
<title>Search - Victory Animal Hospital</title>
<meta name="keywords" content="Victory Animal Hospital,獸醫,獸醫診所,動物醫院,veterinary,animal hospital,veterinary clinic,Vet,動物診所,Animal hospitals,Veterinarian,Vet clinic,Vet specialist,Vet Hospital">
<meta name="description" content="Victory Animal Hospital " />
<link rel="stylesheet" type="text/css" href="../css/style.css" />
<link rel="stylesheet" type="text/css" href="../css/jqueryslidemenu.css" />

<!--[if lte IE 7]>
<style type="text/css">
html .jqueryslidemenu{height: 1%;} /*Holly Hack for IE7 and below*/
</style>
<![endif]-->

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript" src="../js/jqueryslidemenu.js"></script>
</head>
<body>
<table width="1000" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td height="400" align="left" valign="top" style="background-image:url(../images/banner.jpg)">
    <div id="headerlogo"><a href="#"><img src="../images/blank.png" width="330" height="100" /></a></div>
    <table border="0" cellpadding="0" cellspacing="0" class="headerlang" id="headerlangtable">
      <tr>
        <td><a href="../en/<?=basename($_SERVER['PHP_SELF'])."?".$_SERVER['QUERY_STRING'];?>">ENGLISH</a> &nbsp;&nbsp; <a href="../tc/<?=basename($_SERVER['PHP_SELF'])."?".$_SERVER['QUERY_STRING'];?>">中文</a> </td>
      </tr>
    </table>
    <div id="mapsearch-codesearch">
      <form action="search.php">
          <input type="text" class="codesearchbox" name="s" value="" />
          <input name="image" type="image" class="codesearchbox_submit" value="" src="../images/blank.png" />
        </form>
    </div></td>
  </tr>
  <tr>
    <td align="left" valign="top"><div id="myslidemenu" class="jqueryslidemenu">
        <ul>
        <li><a href="home.php">Home</a></li>
        <li><a href="news.php">News</a></li>
        <li><a href="aboutus.php">About Us</a></li>
        <li><a href="services.php">Our Services</a></li>
        <li><a href="clinic_spec.php">Clinic Specialities</a></li>
        <li><a href="info.php">Client & Pet Information</a></li>
        <li><a href="https://eshop.victoryanimalhospital.com" target="_blank">Food Delivery</a></li>
        <li><a href="contactus.php">Contact Us</a></li>
        </ul>
        <br style="clear: left" />
    </div></td>
  </tr>
  <tr>
    <td width="235" align="left" valign="top" class="pagetitlebg"><table width="970" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="235" class="pagetitle1">Search</td>
        <td width="22" class="pagetitle1"><img src="../images/icon_title.jpg" width="22" height="24" /></td>
        <td width="713" class="pagetitle2"><?="Your search term '{$searchTerms}' returned:"?></td>
      </tr>

    </table></td>
  </tr>
  <tr>
    <td align="left" valign="top" bgcolor="#FFFFFF" class="pagecontentbg"><table width="700" border="0" cellpadding="0" cellspacing="0"id="pagecontent">
      <tr>
        <td align="left" valign="top" class="pagecontenttxt">
        <?php echo (count($error) > 0)?"The following had errors:<br /><span id=\"error\">" implode("<br />"$error) . "</span><br /><br />":""?>
        <?php echo (count($results) > 0)?"" implode(""$results):""?>
        <!-- End Page Content --></td>
      </tr>
    </table>
      <table width="210" border="0" cellpadding="0" cellspacing="0" id="submenu">

      </table></td>
  </tr>
  <tr>
    <td align="center" valign="middle" class="footer">Copyright © 2017 Globavet Limited. All rights reserved. |  Powered by <a href="http://www.onesolution.com.hk" target="_blank">One Solution Limited</a>. </td>
  </tr>
</table>
</body>
</html>