📄 10.php
字号:
<?php
function is_priview10( $str, $priview )
{
$str_array = explode( ",", $str );
$priview = explode( ",", $priview );
$i = 0;
for ( ; $i < sizeof( $priview ); ++$i )
{
if ( in_array( $str_array[$i], $priview ) )
{
return true;
}
else
{
return false;
}
}
}
function default_validate( )
{
global $connection;
global $customer_id;
global $customer_name;
global $manage_user;
$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=\"#\" onclick=\"customer_detail('".$customer_id."');\">".$customer_name."</a>";
}
else
{
$purview_ses = false;
}
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;
}
}
$strlink = $_SERVER['PHP_SELF'];
if ( strpos( $strlink, "block_02.php" ) === false )
{
$isimg = true;
}
$sql = "SELECT UP.FUNC_ID_STR FROM user AS U,user_priv AS UP WHERE U.USER_ID='".$_SESSION['LOGIN_USER_ID']."' AND U.USER_PRIV=UP.USER_PRIV";
$cursor = exequery( $connection, $sql );
if ( $row = mysql_fetch_array( $cursor ) )
{
$u_priv = $row['FUNC_ID_STR'];
}
if ( $isimg == true )
{
$imgurl01 = "background=\"/theme/4/bg_mt_line_.gif\"";
$imgurl02 = "background=\"/theme/1/newsbg.gif\"";
$imgurl04 = "";
$strimg = "<img src=\"/theme/1/gray_up_arrow.gif\" width=\"30\" height=\"22\" border=\"0\" id=\"imgarrow10\" title=\"展开/收缩\" >";
$td04width = "30";
$tdbgcolor = "#EBEBEB";
$fontstyle = "a";
$jscontrolu = "/theme/1/gray_up_arrow.gif";
$jscontrold = "/theme/1/gray_down_arrow.gif";
}
else
{
$imgurl01 = "background=\"/theme/1/darkheadleft.gif\"";
$imgurl02 = "background=\"/theme/1/darkheadbg.gif\"";
$imgurl04 = "/theme/1/darkheadbg.gif\"";
$strimg = "<img src=\"/theme/1/black_up_arrow.gif\" width=\"19\" height=\"28\" border=\"0\" id=\"imgarrow10\" title=\"展开/收缩\" >";
$td04width = "19";
$tdbgcolor = "#ABABAB";
$fontstyle = "b";
$jscontrolu = "/theme/1/black_up_arrow.gif";
$jscontrold = "/theme/1/black_down_arrow.gif";
}
echo "<s";
echo "tyle type=\"text/css\">\r\n<!--\r\n.style2 {\r\n\tfont-size: 10px;\r\n\tfont-family: Arial, Helvetica, sans-serif;\r\n\tfont-style: italic;\r\n}\r\n.style5 {font-size: 12px;\r\nfont-style: italic;\r\n}\r\n.style7 {\r\n\tfont-size: 12px;\r\n\tcolor: #000000;\r\n}\r\n-->\r\n</style>\r\n";
echo "<S";
echo "CRIPT language=javascript>\r\n<!--\r\nfunction left_menu10(meval)\r\n{\r\n var left_n=eval(meval);\r\n if (left_n.style.display==\"none\")\r\n { eval(meval+\".style.display='';\"); \r\n imgarrow10.src = '";
echo $jscontrolu;
echo "';\r\n }\r\n else\r\n { eval(meval+\".style.display='none';\"); \r\n imgarrow10.src = '";
echo $jscontrold;
echo "';\r\n }\r\n}\r\n\r\nfunction customer_detail(customer_id)\r\n{\r\n\tvar url\t= \"/general/crm/customer/detail.php?CUSTOMER_ID=\"+customer_id;\r\n\twindow.open(url,\"\",\"height=650,width=900,status=1,toolbar=no,menubar=no,location=no,scrollbars=yes,top=30,left=30,resizable=yes\");\r\n}\r\n//document.all.left_sys.style.display='';\r\n//document.all.left_bm.style.display='none'\r\n-->\r\n</SCRIPT>\r\n<table width=\"100%\" border=\"0\" ce";
echo "llpadding=\"0\" cellspacing=\"0\" background=\"/theme/1/newsbg.gif\" align=\"center\">\r\n <tr>\r\n <td width=\"88\" ";
echo $imgurl01;
echo "><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n <tr>\r\n <td width=\"15%\"> </td>\r\n <td height=\"18\">";
if ( !is_priview10( "45,", $u_priv ) )
{
echo "<span style=\"font:bold;\">最新客户</span>";
}
else
{
echo "<a href=\"/general/crm/customer/query/list.php\" target=\"main\" class=\"".$fontstyle."\">最新客户</a>";
}
echo "</td>\r\n </tr>\r\n </table></td>\r\n <td ";
echo $imgurl02;
echo "> </td>\r\n <td width=\"";
echo $td04width;
echo "\" align=\"right\" ";
echo $imgurl04;
echo "><a href=\"#\" onclick=\"javascript:left_menu10('left_10');\" onFocus=\"this.blur()\" >\r\n ";
echo $strimg;
echo " </a></td>\r\n </tr>\r\n</table>\r\n<div class=\"small\">\r\n <table width=\"100%\" id=\"left_10\" style=\"DISPLAY: \" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"darkbord\">\r\n ";
if ( !is_priview10( "45,", $u_priv ) )
{
echo " <tr>\r\n <td>";
message( "", "无权查看此栏目!" );
echo "</td>\r\n </tr>\r\n <tr>\r\n <td bgcolor=\"";
echo $tdbgcolor;
echo "\" height=\"1\"></td>\r\n </tr>\r\n ";
}
else
{
$connection = openconnection( );
$query = "SELECT c.*, u.USER_NAME FROM customer as c, USER as u WHERE 1 group by c.CUSTOMER_NAME";
switch ( $_REQUEST['order'] )
{
case "customer_name" :
$query .= " order by c.CUSTOMER_NAME";
break;
case "tel_no" :
$query .= " order by c.TEL_NO";
break;
default :
$query .= " order by c.CUSTOMER_ID";
break;
}
$query .= $_REQUEST['sens'] ? " ASC" : " DESC";
$cursor = exequery( $connection, $query );
while ( $row = mysql_fetch_array( $cursor ) )
{
$customer_id = $row['CUSTOMER_ID'];
$old_customer_name = $row['CUSTOMER_NAME'];
$tel_no = $row['TEL_NO'];
$fax_no = $row['FAX_NO'];
$customer_www = $row['CUSTOMER_WWW'];
$email = $row['EMAIL'];
$customer_add = $row['CUSTOMER_ADD'];
$postalcode = $row['POSTALCODE'];
$memo = $row['MEMO'];
$manage_user = $row['MANAGE_USER'];
$customer_type = $row['CUSTOMER_TYPE'];
$purview = $row['PURVIEW'];
$purview_dept = $row['PURVIEW_DEPT'];
$purview_role = $row['PURVIEW_ROLE'];
$purview_user = $row['PURVIEW_USER'];
$user_name = $row['USER_NAME'];
$query2 = "select LINKMAN_ID, LINKMAN_NAME from linkman where CUSTOMER_ID=".$customer_id;
$cursor2 = exequery( $connection, $query2 );
if ( $row2 = mysql_fetch_row( $cursor2 ) )
{
$linkman_id = $row2[0];
$linkman_name = $row2[1];
}
switch ( $purview )
{
case "1" :
$purview_ses = default_validate( );
break;
case "2" :
$purview_ses = "<a href=\"#\" 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=\"#\" onclick=\"customer_detail('".$customer_id."');\">".$customer_name."</a>";
}
}
if ( $manage_user == $_SESSION['LOGIN_USER_ID'] || $manage_user == "" )
{
$purview_ses = "<a href=\"#\" onclick=\"customer_detail('".$customer_id."');\">".$customer_name."</a>";
}
if ( $purview_ses == false )
{
}
else
{
$str_customer_id .= $customer_id.",";
}
}
$str_customer_id = substr( $str_customer_id, 0, -1 );
$str_customer_id = $str_customer_id == "" ? 0 : $str_customer_id;
$query = "SELECT c.*, u.USER_NAME FROM customer as c, USER as u WHERE 1 and c.CUSTOMER_ID IN(".$str_customer_id.") group by c.CUSTOMER_NAME";
switch ( $_REQUEST['order'] )
{
case "customer_name" :
$query .= " order by c.CUSTOMER_NAME";
break;
case "tel_no" :
$query .= " order by c.TEL_NO";
break;
default :
$query .= " order by c.CUSTOMER_ID";
break;
}
$query .= $_REQUEST['sens'] ? " ASC" : " DESC";
$query .= " LIMIT 0,5";
$cursor = exequery( $connection, $query );
$count = 0;
while ( $row = mysql_fetch_array( $cursor ) )
{
++$count;
$customer_id = $row['CUSTOMER_ID'];
$old_customer_name = $row['CUSTOMER_NAME'];
$tel_no = $row['TEL_NO'];
$fax_no = $row['FAX_NO'];
$customer_www = $row['CUSTOMER_WWW'];
$email = $row['EMAIL'];
$customer_add = $row['CUSTOMER_ADD'];
$postalcode = $row['POSTALCODE'];
$memo = $row['MEMO'];
$manage_user = $row['MANAGE_USER'];
$customer_type = $row['CUSTOMER_TYPE'];
$purview = $row['PURVIEW'];
$purview_dept = $row['PURVIEW_DEPT'];
$purview_role = $row['PURVIEW_ROLE'];
$purview_user = $row['PURVIEW_USER'];
$user_name = $row['USER_NAME'];
$query2 = "select LINKMAN_ID, LINKMAN_NAME from linkman where CUSTOMER_ID=".$customer_id." ORDER BY MOSTLY_LINKMAN DESC LIMIT 0,1";
$cursor2 = exequery( $connection, $query2 );
if ( $row2 = mysql_fetch_row( $cursor2 ) )
{
$linkman_id = $row2[0];
$linkman_name = $row2[1];
}
$customer_name = strlen( $old_customer_name ) <= 35 ? $old_customer_name : substr( $old_customer_name, 0, 35 ).chr( 0 )."...";
if ( $count % 2 == 1 )
{
$TableLine = "TableLine1";
}
else
{
$TableLine = "TableLine2";
}
switch ( $customer_type )
{
case "1" :
$c_title = "正式客户";
$c_img = "<img src='../../../../images/littlegif/1-formal.gif' border='0'>";
break;
case "2" :
$c_title = "重要客户";
$c_img = "<img src='../../../../images/littlegif/2-emphasis.gif' border='0'>";
break;
case "3" :
$c_title = "潜在客户";
$c_img = "<img src='../../../../images/littlegif/3-latent.gif' border='0'>";
break;
case "4" :
$c_title = "无效客户";
$c_img = "<img src='../../../../images/littlegif/4-useless.gif' border='0'>";
break;
default :
$c_title = "无状态";
$c_img = "";
break;
}
switch ( $purview )
{
case "1" :
$purview_ses = default_validate( );
break;
case "2" :
$purview_ses = "<a href=\"#\" 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=\"#\" onclick=\"customer_detail('".$customer_id."');\">".$customer_name."</a>";
}
}
if ( $manage_user == $_SESSION['LOGIN_USER_ID'] || $manage_user == "" )
{
$purview_ses = "<a href=\"#\" onclick=\"customer_detail('".$customer_id."');\">".$customer_name."</a>";
}
if ( $manage_user != "" )
{
$sqlus = "SELECT USER_NAME FROM user WHERE USER_ID='".$manage_user."'";
$rsus = exequery( $connection, $sqlus );
$rowus = mysql_fetch_array( $rsus );
$user_name = $rowus['USER_NAME'];
}
else
{
$user_name = "";
}
if ( $purview_ses == false )
{
}
else
{
echo " <tr>\r\n <td width=\"2%\"> </td>\r\n <td><a href=\"#\" onclick=\"customer_detail('";
echo $customer_id;
echo "');\">客户名称:\r\n ";
echo $customer_name;
echo " <br>\r\n 联系电话:\r\n ";
echo $tel_no;
echo " </A></td>\r\n </tr>\r\n <tr>\r\n <td colspan=\"2\" bgcolor=\"";
echo $tdbgcolor;
echo "\" height=\"1\"></td>\r\n </tr>\r\n ";
}
}
if ( $count < 1 )
{
echo " <tr>\r\n <td width=\"2%\"> </td>\r\n <td>没有客户</td>\r\n </tr>\r\n <tr>\r\n <td colspan=\"2\" bgcolor=\"";
echo $tdbgcolor;
echo "\" height=\"1\"></td>\r\n </tr>\r\n ";
}
}
echo " </table>\r\n</div>\r\n<br>\r\n";
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -