 |
|
Code (PHP)
<?php
header ('Content-Type: text/html; charset=windows-874');
header('Cache-Control: no-cache');
header('Pragma: no-cache');
session_start();
include "config/config.php";
include "class/functions.php";
include "theme/default.php";
?>
<html>
<head>
<title>ASIA PLUS SECURITIES PHONEBOOK</title>
<style>
BODY {font-family: "MS Sans Serif"; }
DIV, TD, INPUT, SELECT {font-size: 8pt;
font-color: #6F0000;
font-family: "MS Sans Serif";
text-decoration: none;
white-space:nowrap;}
A {text-decoration: none;
color: white }
.style2 {
font-size: 9px;
font-weight: bold;
}
</style>
<script language=JavaScript>
function swap_search() {
if(detail_search.style.display == "") {
hidesearch();
}
else {
showsearch();
}
}
function hidesearch() {
title_search_img.src = "images/search2.jpg";
detail_search.style.display = "none";
}
function showsearch() {
title_search_img.src = "images/search1.jpg";
detail_search.style.display = "";
}
function swap_branch() {
if(detail_branch.style.display == "") {
hidebranch();
}
else {
showbranch();
}
}
function hidebranch() {
title_branch_img.src = "images/branchphone2.jpg";
detail_branch.style.display = "none";
}
function showbranch() {
title_branch_img.src = "images/branchphone1.jpg";
detail_branch.style.display = "";
}
function clearform() {
document.all.staffid.value = "";
document.all.name.value = "";
document.all.nickname.value = "";
document.all.departmentkey.value = "";
document.all.directline.value = "";
document.all.internalline.value = "";
document.all.UID.value = "";
document.all.PWD.value = "";
}
</script>
</head>
<body leftmargin=0 topmargin=0 rightmargin=0 bottommargin=0 bgcolor=<?php echo $BGCOLOR ?> onLoad="hidesearch(); hidebranch();">
<center>
<!-- //Title bar -->
<table width=100% height=80 border=0 cellpadding=0 cellspacing=0>
<tr bgcolor=<?php echo $TOPBAR ?>>
<td align=right>
<img src="images/aspphone.jpg" width=40%>
</td>
</tr>
</table>
<table width=100% height=20 border=0 cellpadding=0 cellspacing=0>
<tr bgcolor=<?php echo $MENUBAR ?>>
<td width="547" align=center> <br>
</td>
<td width=201 align=center><div align="right"><a href="contact.php"><strong>˹éÒËÅÑ¡ </strong></a><strong>|</strong><a href="help/web-phone.pdf"><strong> ÇÔ¸Õ¡ÒÃãªéàÇçºä«µ ì</strong></a><strong> | </strong><a href="help.php"><strong>à·¤¹Ô¤¾ÔàÈÉ</strong></a></div></td>
</tr>
</table>
<!-- //Find Form -->
<!-- table bgcolor=#F97722 width=406 height=30 style="filter: alpha(opacity=90); -moz-opacity: 0.9;" -->
<div id="floating_ads_title" style="position:absolute; left:27px; top:22px; width:420px; z-index:5; visibility: visible">
<table bgcolor=#5C8ED7 width=420 style="filter: alpha(opacity=90); -moz-opacity: 0.9;" border=0 cellpadding=0 cellspacing=1>
<tr id="title_search" name="title_search">
<td align=center>
<table width=406 height=22 style="filter: alpha(opacity=90); -moz-opacity: 0.9;" border=0 cellpadding=0 cellspacing=1>
<tr>
<td align=center onClick="swap_search()" style="cursor:hand"><img src="images/search1.jpg" name="title_search_img"><br all=clear> </td>
</tr>
</table>
</td>
</tr>
<tr id="detail_search">
<td align=center>
<table bgcolor=#5C8ED7 width=406 border=0 cellpadding=0 cellspacing=3>
<tr bgcolor=#DEEBF3>
<td align=center valign=top>
<form action="contact.php" method=post>
<table border=0 cellpadding=0 cellspacing=0>
<tr>
<td align=center>
<table border=0 cellpadding=0 cellspacing=2>
<tr>
<td width=40 align=center valign=top>
<img src="images/id.gif">
</td>
<td>
<b>Staff ID : </b><br>
<input type=text name=staffid <?php if($_POST[staffid]) echo "value=\"$_POST[staffid]\""; ?> size=40>
<input type=hidden name=action value="FIND">
</td>
</tr>
<tr>
<td width=40 align=center valign=top>
<img src="images/name.gif">
</td>
<td>
<b>Name : </b><br>
<input type=text name=name <?php if($_POST[name]) echo "value=\"$_POST[name]\""; ?> size=40>
</td>
</tr>
<tr>
<td width=40 align=center valign=top>
</td>
<td>
<b>Nickname : </b><br>
<input type=text name=nickname <?php if($_POST[nickname]) echo "value=\"$_POST[nickname]\""; ?> size=20>
</td>
</tr>
<tr>
<td width=40 align=center valign=top>
<img src="images/dprt.gif">
</td>
<td valign=top>
<b>Department : </b><br>
<input type=radio name=departmenttype value="KEY" <?php if($_POST[departmenttype]=="KEY") echo " checked"; ?>>
<input type=text name=departmentkey <?php if($_POST[departmentkey]) echo "value=\"$_POST[departmentkey]\""; ?> size=45 onClick="document.all.departmenttype[0].checked = true"><br>
<input type=radio name=departmenttype value="SELECT" <?php if($_POST[departmenttype]!="KEY") echo " checked"; ?>>
<select name=department onclick="document.all.departmenttype[1].checked = true">
<option value="0">ALL</option>
<?php
$flink = dbconnect($dbhost,$dbname,$dbuser,$dbpasswd); //SELECT op_div_dep_sec, unit
$fquery = " SELECT DISTINCT unit
FROM department
WHERE status IS NULL
ORDER BY order_dep";
$fresult = mysql_query($fquery);
while($frow = mysql_fetch_array($fresult)) {
echo "<option value=\"$frow[unit]\"";
if($_POST[department]==$frow[unit])
echo " selected";
echo ">$frow[unit]</option>\n";
}
$MobileAuth = false;
if(!session_is_registered(session_id())) {
$auquery = "SELECT u.user_id
FROM user_auth u, staff s, position_level p
WHERE s.staff_id = u.user_id
AND s.pos_level = p.pos_level
AND p.level_no <= 7
AND u.user_id = $_POST[UID]
AND u.user_pw = password('$_POST[PWD]')";
$auresult = mysql_query($auquery);
if($auresult)
if(mysql_fetch_array($auresult)) {
$MobileAuth = true;
session_register(session_id());
}
}
else {
$MobileAuth = true;
}
dbclose($flink);
?>
</select>
</td>
</tr>
<tr>
<td width=40 align=center valign=top>
<img src="images/phone.gif">
</td>
<td>
<b>Direct Line : </b><br>
<input type=text name=directline <?php if($_POST[directline]) echo "value=\"$_POST[directline]\""; ?> size=30>
</td>
</tr>
<tr>
<td width=40 align=center>
</td>
<td>
<b>Internal Line : </b><br>
<input type=text name=internalline <?php if($_POST[internalline]) echo "value=\"$_POST[internalline]\""; ?> size=30>
</td>
</tr>
<?php if(!session_is_registered(session_id())) { ?>
<tr>
<td width=40 align=center>
</td>
<td>
<b>Mobile Phone (Password) </b><br>
ID : <input type=text name=UID size=15>
PWD : <input type=password name=PWD size=15>
</td>
</tr>
<?php } ?>
<tr>
<td width=40 align=center>
</td>
<td valign=middle>
<input type=radio name=style value=1 checked><img src="images/1.jpg">
<input type=radio name=style value=2><img src="images/2.jpg">
<input type=radio name=style value=3><img src="images/3.jpg">
</td>
</tr>
<tr>
<td width=40 align=center>
</td>
<td>
<input type=submit value=" Find ">
<input type=button value=" Clear " onClick="clearform()">
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
<tr id="title_branch" name="title_branch">
<td align=center>
<table width=406 height=44 style="filter: alpha(opacity=90); -moz-opacity: 0.9;" border=0 cellpadding=0 cellspacing=1>
<tr>
<td height="42" align=center style="cursor:hand" onClick="swap_branch()">
<img src="images/branchphone1.jpg" name="title_branch_img"><br all=clear>
</td>
</tr>
</table>
</td>
</tr>
<tr id="detail_branch" name="detail_branch">
<td align=center> <><><>
</td>
</tr>
</table>
<table bgcolor=#5C8ED7 width=406 border=0 cellpadding=0 cellspacing=3>
<tr bgcolor=#DEEBF3>
<td id="br_phone_list" name="br_phone_list"></td>
</tr>
</table>
</div>
<!-- End Find Form -->
<?php
if($_POST[action] == "FIND") {
if(($_POST[style] != "1") && ($_POST[style] != "2")){
echo "
<!-- //List Contact -->
<br>
<table width=90% border=1 cellpadding=0 cellspacing=0>
<tr height=25 bgcolor=#0000CC>
<td width=80 align=center>
<font color=#FFFF00 size=2>
<b>Staff ID</b>
</font>
</td>
<td width=15% align=center>
<font color=#FFFF00 size=2>
<b>Name</b>
</font>
</td>
<td width=20% align=center>
<font color=#FFFF00 size=2>
<b>Department</b>
</font>
</td>
<td width=25% align=center>
<font color=#FFFF00 size=2>
<b>Direct Line</b>
</font>
</td>
<td width=10% align=center>
<font color=#FFFF00 size=2>
<b>Internal Line</b>
</font>
</td>
<td width=20% align=center>
<font color=#FFFF00 size=2>
<b>E-Mail</b>
</font>
</td>
</tr>";
}
$link = dbconnect($dbhost,$dbname,$dbuser,$dbpasswd);
$query = " SELECT DISTINCT s.staff_id, s.th_name, s.nick_name, d.unit, d.br_id
FROM staff s, phone p, department d
WHERE s.staff_id=p.staff_id AND ((s.emp_end Is Null) OR (s.emp_end >Now()))
AND d.op_div_dep_sec=s.op_div_dep_sec2 ";
// AND s.emp_end != NULL
//SELECT DISTINCT s.staff_id,s.prefix,s.th_name,s.birthday
//FROM staff s, phone p, department d
if($_POST[staffid])
$query .= "AND s.staff_id LIKE '%$_POST[staffid]%' ";
if($_POST[name]) {
$s_name = str_replace(" ","%",$_POST[name]);
$query .= "AND s.th_name LIKE '%$s_name%' ";
}
if($_POST[nickname])
$query .= "AND s.nick_name LIKE '%$_POST[nickname]%' ";
if($_POST[departmenttype] == "KEY")
$query .= "AND d.unit LIKE '%$_POST[departmentkey]%' ";
else if($_POST[department] == '0')
$query .= "AND d.unit LIKE '%' ";
else
$query .= "AND unit = '$_POST[department]' ";
if($_POST[directline])
$query .= "AND p.phone_no LIKE '%$_POST[directline]%' AND p.phone_type = '2' ";
if($_POST[internalline])
$query .= "AND p.phone_no LIKE '%$_POST[internalline]%' AND p.phone_type = '1' ";
$query .= "ORDER BY s.th_name";
//echo $query;
$br_id_count = 0;
echo "<tr><td>";
$lresult = mysql_query($query);
if($lresult) {
if($_POST[style] == "1") {
//echo "Found ".mysql_num_rows($lresult)." Record(s)";
while($lrow = mysql_fetch_array($lresult)) {
$br_id_list[$br_id_count++] = $lrow[br_id];
echo "
<br>
<table bgcolor=#CFDFEF width=90% border=0 cellpadding=0 cellspacing=1>
<tr bgcolor=#CFDFEF>
<td width=120 align=center>
<font face=\"MS Sans Serif\" size=2>
<b>$lrow[staff_id]</b>
</font>
</td>
<td>
<font face=\"MS Sans Serif\" size=2>
$lrow[th_name] ";
if($lrow[nick_name] != '-')
echo "($lrow[nick_name])";
echo "
</font>
</td>
</tr>
<tr bgcolor=#DFEFDF>
<td>Dept.</td>
<td>
<font face=\"MS Sans Serif\" size=2>
$lrow[unit]
</font>
</td>
</tr>
<tr bgcolor=#DFEFDF>
<td>Direct</td>
<td>
<font face=\"MS Sans Serif\" size=2>";
$diquery = "SELECT phone_no, phone_type FROM phone WHERE status = '1' AND staff_id = '$lrow[staff_id]' AND phone_type = '2'";
$diresult = mysql_query($diquery);
if($diresult) {
while($dirow = mysql_fetch_array($diresult)) {
//if($dirow[phone_type] == 2)
echo $dirow[phone_no].", ";
}
}
echo "
</font>
</td>
</tr>
<tr bgcolor=#DFEFDF>
<td>Internal</td>
<td>
<font face=\"MS Sans Serif\" size=2>";
$inquery = "SELECT phone_no, phone_type FROM phone WHERE status = '1' AND staff_id = '$lrow[staff_id]' AND phone_type = '1'";
$inresult = mysql_query($inquery);
if($inresult) {
while($inrow = mysql_fetch_array($inresult)) {
//if($dirow[phone_type] == 2)
echo $inrow[phone_no].", ";
}
}
echo "
</font>
</td>
</tr>";
if($MobileAuth) {
echo "
<tr bgcolor=#DFEFDF>
<td>Home/Mobile</td>
<td>
<font face=\"MS Sans Serif\" size=2>";
$inquery = "SELECT phone_no, phone_type FROM phone WHERE status = '1' AND staff_id = '$lrow[staff_id]' AND (phone_type = '3' OR phone_type = '4')";
$inresult = mysql_query($inquery);
if($inresult) {
while($inrow = mysql_fetch_array($inresult)) {
//if($dirow[phone_type] == 2)
echo $inrow[phone_no].", ";
}
}
echo "
</font>
</td>
</tr>";
}
echo "
<tr bgcolor=#DFEFDF>
<td>E-Mail</td>
<td>
<font face=\"MS Sans Serif\" size=2>";
$mlquery = "SELECT email_desc FROM email WHERE staff_id = '$lrow[staff_id]'";
$mlresult = mysql_query($mlquery);
if($mlresult) {
while($mlrow = mysql_fetch_array($mlresult)) {
echo $mlrow[email_desc]." ";
}
}
//$lrow[birthday]
echo "
</font>
</td>
</tr>
</table>";
}
}
else if($_POST[style] == "2") {
//echo "Found ".mysql_num_rows($lresult)." Record(s)";
$columncount = 0;
while($lrow = mysql_fetch_array($lresult)) {
$br_id_list[$br_id_count++] = $lrow[br_id];
if(($columncount % 2) == 0)
echo "
<br>
<table width=90% border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=48%>";
echo "
<table bgcolor=$BLOCKAREACOLOR width=100% border=1 cellpadding=0 cellspacing=0>
<tr bgcolor=$BLOCKTITLEBAR>
<td width=100 align=center>
<font face=\"MS Sans Serif\" size=2>
<b>$lrow[staff_id]</b>
</font>
</td>
<td>
<font face=\"MS Sans Serif\" size=2>
$lrow[th_name] ";
if($lrow[nick_name] != '-')
echo "($lrow[nick_name])";
echo "
</font>
</td>
</tr>
<tr>
<td>Dept.</td>
<td>
<font face=\"MS Sans Serif\" size=2>
$lrow[unit]
</font>
</td>
</tr>
<tr>
<td>Direct</td>
<td>
<font face=\"MS Sans Serif\" size=2>";
$diquery = "SELECT phone_no, phone_type FROM phone WHERE status = '1' AND staff_id = '$lrow[staff_id]' AND phone_type = '2'";
$diresult = mysql_query($diquery);
if($diresult) {
while($dirow = mysql_fetch_array($diresult)) {
//if($dirow[phone_type] == 2)
echo $dirow[phone_no].", ";
}
}
echo "
</font>
</td>
</tr>
<tr>
<td>Internal</td>
<td>
<font face=\"MS Sans Serif\" size=2>";
$inquery = "SELECT phone_no, phone_type FROM phone WHERE status = '1' AND staff_id = '$lrow[staff_id]' AND phone_type = '1'";
$inresult = mysql_query($inquery);
if($inresult) {
while($inrow = mysql_fetch_array($inresult)) {
//if($dirow[phone_type] == 2)
echo $inrow[phone_no].", ";
}
}
echo "
</font>
</td>
</tr>";
if($MobileAuth) {
echo "
<tr>
<td>Home/Mobile</td>
<td>
<font face=\"MS Sans Serif\" size=2>";
$inquery = "SELECT phone_no, phone_type FROM phone WHERE status = '1' AND staff_id = '$lrow[staff_id]' AND (phone_type = '3' OR phone_type = '4')";
$inresult = mysql_query($inquery);
if($inresult) {
while($inrow = mysql_fetch_array($inresult)) {
//if($dirow[phone_type] == 2)
echo $inrow[phone_no].", ";
}
}
echo "
</font>
</td>
</tr>";
}
echo "
<tr>
<td>E-Mail</td>
<td>
<font face=\"MS Sans Serif\" size=2>";
$mlquery = "SELECT email_desc FROM email WHERE staff_id = '$lrow[staff_id]'";
$mlresult = mysql_query($mlquery);
if($mlresult) {
while($mlrow = mysql_fetch_array($mlresult)) {
echo $mlrow[email_desc]." ";
}
}
//$lrow[birthday]
echo "
</font>
</td>
</tr>
</table>";
if(($columncount % 2) == 0)
echo "
</td>
<td width=20>
</td>
<td width=48%>";
else
echo "
</tr>
</table>";
$columncount++;
}
}
else {
//echo "Found ".mysql_num_rows($lresult)." Record(s)";
while($lrow = mysql_fetch_array($lresult)) {
$br_id_list[$br_id_count++] = $lrow[br_id];
echo "
<tr bgcolor=#DFDFDF>
<td align=center>
<font face=\"MS Sans Serif\" size=2>
<b>$lrow[staff_id]</b>
</font>
</td>
<td>
<font face=\"MS Sans Serif\" size=2>
$lrow[th_name] ";
if($lrow[nick_name] != '-')
echo "($lrow[nick_name])";
echo "
</font>
</td>
<td>
<font face=\"MS Sans Serif\" size=2>
$lrow[unit]
</font>
</td>
<td>
<font face=\"MS Sans Serif\" size=2>";
$diquery = "SELECT phone_no, phone_type FROM phone WHERE status = '1' AND staff_id = '$lrow[staff_id]' AND phone_type = '2'";
$diresult = mysql_query($diquery);
if($diresult) {
while($dirow = mysql_fetch_array($diresult)) {
//if($dirow[phone_type] == 2)
echo $dirow[phone_no].", ";
}
}
if($MobileAuth) {
$inquery = "SELECT phone_no, phone_type FROM phone WHERE status = '1' AND staff_id = '$lrow[staff_id]' AND (phone_type = '3' OR phone_type = '4')";
$inresult = mysql_query($inquery);
if($inresult) {
while($inrow = mysql_fetch_array($inresult)) {
//if($dirow[phone_type] == 2)
echo "( ".$inrow[phone_no]." )";
}
}
}
echo "
</font>
</td>
<td align=center>
<font face=\"MS Sans Serif\" size=2>";
$inquery = "SELECT phone_no, phone_type FROM phone WHERE status = '1' AND staff_id = '$lrow[staff_id]' AND phone_type = '1'";
$inresult = mysql_query($inquery);
if($inresult) {
while($inrow = mysql_fetch_array($inresult)) {
//if($dirow[phone_type] == 2)
echo $inrow[phone_no].", ";
}
}
echo "
</font>
</td>
<td>
<font face=\"MS Sans Serif\" size=2>";
$mlquery = "SELECT email_desc FROM email WHERE staff_id = '$lrow[staff_id]'";
$mlresult = mysql_query($mlquery);
if($mlresult) {
while($mlrow = mysql_fetch_array($mlresult)) {
echo $mlrow[email_desc]." ";
}
}
//echo $lrow[birthday]." ";
echo "
</font>
</td>
</tr>";
}
}
}
if(($_POST[style] != "1") && ($_POST[style] != "2")) {
echo "</table>";
}
echo "<br><br>";
echo "<!-- br_id_count : $br_id_count -->";
$br_phone_list = "";
if($br_id_count > 0) {
$brquery = "SELECT DISTINCT b.machine_name, c.phone_no_direct, c.hotline, c.fax FROM branch b, center c ";
for($i=0;$i<$br_id_count;$i++) {
//echo $br_id_list[$i];
if($i == 0) {
$brquery .= "WHERE (b.machine_id = '$br_id_list[$i]' AND c.br_id = '$br_id_list[$i]') ";
}
else {
$brquery .= "OR (b.machine_id = '$br_id_list[$i]' AND c.br_id = '$br_id_list[$i]') ";
}
}
//echo $brquery;
$br_phone_list = "<table width=100% bgcolor=#7CAEF7 border=0 cellpadding=0 cellspacing=1><tr><td align=center><b>Branch</b></td><td align=center><b>Phone</b></td><td align=center><b>Hotline</b></td><td align=center><b>Fax</b></td></tr>";
$brresult = mysql_query($brquery);
if($brresult) {
while($brrow = mysql_fetch_array($brresult)) {
//echo "\n".$brrow[machine_name]." ".$brrow[phone_no_direct]." ".$brrow[hotline]." ".$brrow[fax]." \n";
$br_phone_list .= "<tr bgcolor=#DEEBF3><td>".$brrow[machine_name]."</td><td>".$brrow[phone_no_direct]."</td><td>".$brrow[hotline]."</td><td>".$brrow[fax]."</td></tr>";
}
}
$br_phone_list .= "</table>";
}
dbclose($link);
}
?>
<!--<script language=JavaScript>
br_phone_list.innerHTML = '<?/*php echo $br_phone_list */?>';
</script>-->
</center>
</body>
</html>

Tag : - - - -
|
|
 |
 |
 |
 |
Date :
2010-06-09 16:12:12 |
By :
RAT |
View :
932 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |