//以面向对象的思想连接数据库
<?php
class Oracle {
var $db="(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.136.13)(PORT=1521))(CONNECT_DATA= (SID=orcl)))";
var $dbname="crm";//连接数据库的用户名
var $dbpwd="crm";//连接数据库的用户名密码
var $dblink="";//连接数据库
function Oracle() {
$this->dblink=oci_connect($this->dbname,$this->dbpwd,$this->db);
}
}
?>
<?php
session_start();
$username = $_SESSION['USERNAME'];
/*if(!isset($username)){
header("Location:http://".$_SERVER["SERVER_NAME"]."/ibm2crm/index.php");
exit;
}*/
?>
<?php
require_once("../../../web/include/page.php");
?>
<?php
require_once("../../../lib/db/Oracle.class.php");
$db = new Oracle();
$sql ="begin userPKG.pageUser(:pageno,:pagesize,:depcur,:totalrecore);end;";
$stmt = oci_parse($db->dblink,$sql);
$cur=oci_new_cursor($db->dblink);
oci_bind_by_name($stmt,"pageno",$pageno,3);
oci_bind_by_name($stmt,"pagesize",$pagesize,3);
oci_bind_by_name($stmt,"depcur",$cur,-1,OCI_B_CURSOR);
oci_bind_by_name($stmt,"totalrecore",$totalrecord,2);
oci_execute($stmt);
oci_execute($cur);
$a=1;
//$color="this.bgColor = '#C2E9FC'";
//$color2="this.bgColor = 'FFFFFF'";
if($cur!=null)
{ if($_SESSION['USER_ISMANAGER'])
{
while($row=oci_fetch_array($cur))
{
$stmt = ociparse($db->dblink, "select dname from crm_department where deptno='$row[2]'");
OCIDefineByName($stmt,"DNAME",&$dname);
ociexecute($stmt);
while(ocifetch($stmt))
echo "<tr bgColor=#ffffff>";
echo "<td style='PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; LINE-HEIGHT: 20px; PADDING-TOP: 2px; BORDER-BOTTOM: #e0e0e0 1px solid; BORDER-RIGHT: #e0e0e0 1px solid; HEIGHT: 20px' align=middle width='5%'>".(($pageno-1)*$pagesize+$a++)."</td>";
echo "<td style='PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; LINE-HEIGHT: 20px; PADDING-TOP: 2px; BORDER-BOTTOM: #e0e0e0 1px solid; BORDER-RIGHT: #e0e0e0 1px solid; HEIGHT: 20px'>".$row[0]."</td>";
echo "<td style='PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; LINE-HEIGHT: 20px; PADDING-TOP: 2px; BORDER-BOTTOM: #e0e0e0 1px solid; BORDER-RIGHT: #e0e0e0 1px solid; HEIGHT: 20px'>".$row[5]."</td>";
echo "<td style='PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; LINE-HEIGHT: 20px; PADDING-TOP: 2px; BORDER-BOTTOM: #e0e0e0 1px solid; BORDER-RIGHT: #e0e0e0 1px solid; HEIGHT: 20px'>".$row[6]."</td>";
if($row[7]==1)
{
echo "<td style='PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; LINE-HEIGHT: 20px; PADDING-TOP: 2px; BORDER-BOTTOM: #e0e0e0 1px solid; BORDER-RIGHT: #e0e0e0 1px solid; HEIGHT: 20px'>".$row[8]."/".$dname."<font color=red>[负责]</font></td>";
}
else
{
echo "<td style='PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; LINE-HEIGHT: 20px; PADDING-TOP: 2px; BORDER-BOTTOM: #e0e0e0 1px solid; BORDER-RIGHT: #e0e0e0 1px solid; HEIGHT: 20px'>".$row[8]."/".$dname."</td>";
}
echo "<td style='PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; LINE-HEIGHT: 20px; PADDING-TOP: 2px; BORDER-BOTTOM: #e0e0e0 1px solid; BORDER-RIGHT: #e0e0e0 1px solid; HEIGHT: 20px'>".$row[9]."</td>";
echo "<td style='PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; LINE-HEIGHT: 20px; PADDING-TOP: 2px; BORDER-BOTTOM: #e0e0e0 1px solid; BORDER-RIGHT: #e0e0e0 1px solid; HEIGHT: 20px'><a href='queryEmpById.php?user_id=".$row[0]."'>修改 <a href='/ibm2crm/lib/action/users/toDelete.php?user_id=";
echo $row[0];
echo "'>删除</a></td>";
echo "</tr>";
}
}else
{
echo "<tr bgColor=#ffffff>";
echo "<td style='PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; LINE-HEIGHT: 20px; PADDING-TOP: 2px; BORDER-BOTTOM: #e0e0e0 1px solid; BORDER-RIGHT: #e0e0e0 1px solid; HEIGHT: 20px' align=middle width='5%'>".(($pageno-1)*$pagesize+$a++)."</td>";
echo "<td style='PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; LINE-HEIGHT: 20px; PADDING-TOP: 2px; BORDER-BOTTOM: #e0e0e0 1px solid; BORDER-RIGHT: #e0e0e0 1px solid; HEIGHT: 20px'>".$_SESSION['USERS_ID']."</td>";
echo "<td style='PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; LINE-HEIGHT: 20px; PADDING-TOP: 2px; BORDER-BOTTOM: #e0e0e0 1px solid; BORDER-RIGHT: #e0e0e0 1px solid; HEIGHT: 20px'>".$_SESSION['USERNAME']."</td>";
echo "<td style='PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; LINE-HEIGHT: 20px; PADDING-TOP: 2px; BORDER-BOTTOM: #e0e0e0 1px solid; BORDER-RIGHT: #e0e0e0 1px solid; HEIGHT: 20px'>".$_SESSION['USER_SEX']."</td>";
echo "<td style='PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; LINE-HEIGHT: 20px; PADDING-TOP: 2px; BORDER-BOTTOM: #e0e0e0 1px solid; BORDER-RIGHT: #e0e0e0 1px solid; HEIGHT: 20px'>".$_SESSION['USER_TEL']."</td>";
echo "<td style='PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; LINE-HEIGHT: 20px; PADDING-TOP: 2px; BORDER-BOTTOM: #e0e0e0 1px solid; BORDER-RIGHT: #e0e0e0 1px solid; HEIGHT: 20px'>".$_SESSION['USER_EMAIL']."</td>";
echo "<td style='PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; LINE-HEIGHT: 20px; PADDING-TOP: 2px; BORDER-BOTTOM: #e0e0e0 1px solid; BORDER-RIGHT: #e0e0e0 1px solid; HEIGHT: 20px'><a href='queryEmpById.php?user_id=".$_SESSION['USERS_ID']."'>修改 <a href='/ibm2crm/lib/action/users/toDelete.php?user_id=";
echo $_SESSION['USERS_ID'];
echo "'>删除</a></td>";
echo "</tr>";
}
}
$totalPage = floor(($totalrecord-1)/$pagesize+1);
?>
<TR>
<TD
style="PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; LINE-HEIGHT: 22px; PADDING-TOP: 2px; BORDER-BOTTOM: #e8e8e8 1px solid; HEIGHT: 22px"
align=middle width="100%" bgColor=#ffffff colSpan=7>
<TABLE>
<FORM name=selform action="" method=post>
<TBODY>
<TR>
<TD> <?php
if($_SESSION['USER_ISMANAGER']){
if($pageno==1){?>
首页 上一页
<?php
}else{?>
<a href='user_manage_list.php?pageno=1'>首页</a> <a href='user_manage_list.php?pageno=<?php echo $pageno-1;?>'>上一页</a>
<?php
}
?>
<?php
if($totalPage==$pageno){?>
下一页 末页
<?php
}else{
?>
<a href='user_manage_list.php?pageno=<?php echo $pageno+1;?>'>下一页</a> <a href='user_manage_list.php?pageno=<?php echo $totalPage;?>'>末页</a>
<?php
}
?>第</TD>
<TD>
<SCRIPT language=javascript>
function gopagenav(page)
{
location="department_add_list.php?pageno="+page;
}
</SCRIPT>
<SELECT id=selpage οnchange=javascript:gopagenav(this.value);
name=selpage>
<?php for($j=0;$j<$totalPage;$j++){?>
<OPTION value=<?php echo $j+1 ?> <?php if($pageno == $j+1){ echo 'selected'; } ?> >- <?php echo $j+1 ?> -</OPTION> <?php } ?> </SELECT>
</TD>
<TD>页,共<?php echo $totalPage; ?>页 总记录数:<?php echo $totalrecord; }?></TD></TR></FORM></TBODY></TABLE></TD></TR></TBODY></TABLE></BODY></HTML>