| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/hkosl.com/dirsignage_old/html/ |
Upload File : |
<?php
include_once("webadmin/configure.php");
$search_word = $_REQUEST["search_word"];
$action = $_REQUEST["action"];
$search_result = "";
if (!empty($search_word) && !empty($action)) {
if ($action == 4) { //company info
$sql = "select * from company where id = ? and status = ? and deleted = ?";
$parameters = array((int)$search_word, "1", "0");
if (!($sth = $dbh->prepare($sql))) {
throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
}
if (!$sth->execute($parameters)) {
throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
}
$company_info = $sth->fetch(PDO::FETCH_ASSOC);
ob_start();
?>
<div style="width: 25%; float: left;">
<?php if(!empty($company_info{"logo"})){ ?>
<img src="images/company_logo/<?=$company_info{"logo"}?>" style="width: 100%;"/>
<?php } else { echo " "; } ?>
</div>
<div style="width: 75%; float: left;">
<table style="margin-left: 20px;">
<tr>
<td style="width: 175px;"><?php if($_SESSION["langcode"] == 'en') echo 'Co.Name'; else echo '公司名稱'?> : </td>
<td>
<?=$company_info{"companyname_en"}?><br><br>
<?=$company_info{"companyname_tc"}?>
</td>
</tr>
<tr>
<td><?php if($_SESSION["langcode"] == 'en') echo 'Room'; else echo '單位'?> : </td>
<td>
<?=$company_info{"room_no"}?>
</td>
</tr>
<tr>
<td><?php if($_SESSION["langcode"] == 'en') echo 'Tel'; else echo '電話號碼'?> : </td>
<td>
<?=$company_info{"telephone"}?>
</td>
</tr>
<tr>
<td><?php if($_SESSION["langcode"] == 'en') echo 'Fax'; else echo '傳真號碼'?> : </td>
<td>
<?=$company_info{"fax"}?>
</td>
</tr>
<tr>
<td><?php if($_SESSION["langcode"] == 'en') echo 'Email'; else echo '電郵地址'?> : </td>
<td>
<?=$company_info{"email"}?>
</td>
</tr>
<tr>
<td><?php if($_SESSION["langcode"] == 'en') echo 'Website'; else echo '網頁'?> : </td>
<td>
<?=$company_info{"website"}?>
</td>
</tr>
<tr>
<td><?php if($_SESSION["langcode"] == 'en') echo 'Address'; else echo '地址'?> : </td>
<td style="word-wrap: break-word;">
<?=$company_info{"companyaddress_en"}?><br><br>
<?=$company_info{"companyaddress_tc"}?>
</td>
</tr>
</table>
</div>
<?php
$search_result = ob_get_contents();
ob_end_clean();
} else if ($action == 3) {
$sql = "select * from company where status = ? and deleted = ? ";
$parameters = array("1", "0");
$all_disable_floor = explode(",", $disable_floor);
foreach ($all_disable_floor as $this_disable_floor) {
$sql .= " and floor != ?";
$parameters[] = $this_disable_floor;
}
$sql .= " order by companyname_en ASC";
//var_dump($sql);
} else if ($action == 2) {
$sql = "select * from company where floor = ? and status = ? and deleted = ? order by floor ASC, companyname_en ASC";
$parameters = array($search_word, "1", "0");
} else {
$sql = "select * from company where (floor like ? || companyname_en like ? || companyname_tc like ?) and ( status = ? and deleted = ?) order by floor ASC, companyname_en ASC";
$parameters = array("%" . $search_word . "%", "%" . $search_word . "%", "%" . $search_word . "%", "1", "0");
}
if($action != 4){
if (!($sth = $dbh->prepare($sql))) {
throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
}
if (!$sth->execute($parameters)) {
throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
}
$i = 1;
while ($company_info = $sth->fetch(PDO::FETCH_ASSOC)) {
if ($i == 1) {
$search_result .= '<ul class="result_list letter_option" style="font-size: 33px;">';
}
$company_name = $company_info{"companyname_" . $_SESSION["langcode"]};
if($_SESSION["langcode"] == "en"){
if(empty($company_name)){
$company_name = $company_info{"companyname_tc"};
}
}else{
if(empty($company_name)){
$company_name = $company_info{"companyname_en"};
}
}
$search_result .= '<li class="rl_item" onclick="search_result('.$company_info{"id"}.',4)">
<div style="width: 90%; float: left;">
' . $company_name . '
</div>
<div style=" width: 2%;float: right;">
»
</div>
</li>';
$i++;
}
if ($i > 1) {
$search_result .= '</ul>';
}
}
}
echo $search_result;
?>