📄 search_result.php
字号:
<?php
function default_validate( )
{
global $connection;
global $customer_id;
global $customer_name;
global $manage_user;
global $id;
global $input_customer_name;
$query2 = "select up.* from user_priv as up, user as u where up.USER_PRIV=u.USER_PRIV and u.USER_ID='".$manage_user."'";
$cursor2 = exequery( $connection, $query2 );
if ( $row2 = mysql_fetch_array( $cursor2 ) )
{
$priv_no = $row2['PRIV_NO'];
}
$query3 = "select up.* from user_priv as up, user as u where up.USER_PRIV=u.USER_PRIV and u.USER_ID='".$_SESSION['LOGIN_USER_ID']."'";
$cursor3 = exequery( $connection, $query3 );
if ( $row3 = mysql_fetch_array( $cursor3 ) )
{
$login_priv_no = $row3['PRIV_NO'];
}
if ( $login_priv_no < $priv_no )
{
$purview_ses = "<a href=\"#\" id=\"".$id."\" onclick=\"customer_detail('".$customer_id."');\">".$customer_name."</a>";
}
else if ( $input_customer_name == $customer_name )
{
$purview_ses = "<span style=\"color:#FF0000;\">".$customer_name."</span>";
}
else
{
$purview_ses = "<span style=\"color:#999999;\">".$customer_name."</span>";
}
return $purview_ses;
}
function dept_validate( )
{
global $connection;
global $purview_dept;
if ( $purview_dept == "ALL_DEPT" )
{
return true;
}
$query2 = "select d.* from department as d, user as u where u.DEPT_ID=d.DEPT_ID and u.USER_ID='".$_SESSION['LOGIN_USER_ID']."'";
$cursor2 = exequery( $connection, $query2 );
if ( $row2 = mysql_fetch_array( $cursor2 ) )
{
$dept_id = $row2['DEPT_ID'];
}
if ( array_search( $dept_id, explode( ",", $purview_dept ) ) !== false )
{
return true;
}
else
{
return false;
}
}
function role_validate( )
{
global $connection;
global $purview_role;
$query2 = "select up.* from user_priv as up, user as u where up.USER_PRIV=u.USER_PRIV and u.USER_ID='".$_SESSION['LOGIN_USER_ID']."'";
$cursor2 = exequery( $connection, $query2 );
if ( $row2 = mysql_fetch_array( $cursor2 ) )
{
$login_priv_no = $row2['USER_PRIV'];
}
if ( array_search( $login_priv_no, explode( ",", $purview_role ) ) !== false )
{
return true;
}
else
{
return false;
}
}
function user_validate( )
{
global $connection;
global $purview_user;
if ( array_search( $_SESSION['LOGIN_USER_ID'], explode( ",", $purview_user ) ) !== false )
{
return true;
}
else
{
return false;
}
}
include_once( "inc/auth.php" );
echo "\r\n<html>\r\n<head>\r\n<title>客户查询 </title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n</head>\r\n";
echo "<s";
echo "tyle>\r\n#xx:link{color:#FF0000;}\r\n</style>\r\n\r\n<body topmargin=\"5\">\r\n";
$CUSTOMER_NAME = $_REQUEST['CUSTOMER_NAME'];
$CUSTOMER_NAME = iconv( "utf-8", "gb2312", $CUSTOMER_NAME );
$connection = openconnection( );
$query = "SELECT * FROM customer WHERE CUSTOMER_NAME LIKE '%".$CUSTOMER_NAME."%'";
$input_customer_name = $CUSTOMER_NAME;
$cursor = exequery( $connection, $query );
echo "<table >\r\n\t<tr>\r\n\t\t<td align=\"center\" style=\"font:bold;\">搜索结果</td>\r\n\t\t<td align=\"right\" style=\"font-size:12px;\">";
echo "<s";
echo "pan style=\"color:#0000FF;cursor:hand\" onClick=\"closediv();\">关闭</span></td>\r\n\t</tr>\r\n";
$count = 0;
while ( $row = mysql_fetch_array( $cursor ) )
{
unset( $id );
++$count;
$customer_id = $row['CUSTOMER_ID'];
$customer_name = $row['CUSTOMER_NAME'];
$manage_user = $row['MANAGE_USER'];
$purview = $row['PURVIEW'];
$purview_dept = $row['PURVIEW_DEPT'];
$purview_role = $row['PURVIEW_ROLE'];
$purview_user = $row['PURVIEW_USER'];
if ( $input_customer_name == $customer_name )
{
$id = "xx";
}
switch ( $purview )
{
case "1" :
$purview_ses = default_validate( );
break;
case "2" :
$purview_ses = "<a href=\"#\" id=\"".$id."\" onclick=\"customer_detail('".$customer_id."');\">".$customer_name."</a>";
break;
case "3" :
$dept_validate = dept_validate( );
$role_validate = role_validate( );
$user_validate = user_validate( );
if ( ( $dept_validate || $role_validate || $user_validate ) === false )
{
$purview_ses = default_validate( );
}
else
{
$purview_ses = "<a href=\"#\" id=\"".$id."\" onclick=\"customer_detail('".$customer_id."');\">".$customer_name."</a>";
}
}
if ( $_SESSION['LOGIN_USER_ID'] == $manage_user || $manage_user == "" )
{
$purview_ses = "<a href=\"#\" id=\"".$id."\" onclick=\"customer_detail('".$customer_id."');\">".$customer_name."</a>";
}
$show = $purview_ses;
echo "\t<tr>\r\n\t\t<td colspan=\"2\" title='";
echo $customer_name;
echo "'>";
echo $show;
echo "</td>\r\n\t</tr>\r\n";
}
echo "<center>";
if ( $count == 0 )
{
echo "<tr><td>";
echo "没有类似的客户名称";
echo "</td></tr>";
exit( );
}
echo "</center>";
echo "</table>\r\n</body>\r\n</html>\r\n";
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -