⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 current.php

📁 通达的部分源代码大家研究一下吧
💻 PHP
字号:
<?
include_once("inc/auth.php");
include_once("inc/utility_all.php");
?>

<html>
<head>
<title>已发布的投票</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<script>
function open_vote(VOTE_ID)
{
 URL="read_vote.php?VOTE_ID="+VOTE_ID;
 myleft=(screen.availWidth-100)/2;
 window.open(URL,"read_vote","height=300,width=400,status=1,toolbar=no,menubar=no,location=no,scrollbars=yes,top=150,left="+myleft+",resizable=yes");
}

function view_result(VOTE_ID)
{
 URL="show_reader.php?VOTE_ID="+VOTE_ID;
 myleft=(screen.availWidth-100)/2;
 window.open(URL,"read_vote","height=300,width=400,status=1,toolbar=no,menubar=no,location=no,scrollbars=yes,top=150,left="+myleft+",resizable=yes");
}
</script>

</head>
<body class="bodycolor" topmargin="5">

<?
 $CUR_DATE=date("Y-m-d",time());

 $query = "SELECT count(*) from VOTE_TITLE where (TO_ID='ALL_DEPT' or find_in_set('$LOGIN_DEPT_ID',TO_ID) or find_in_set('$LOGIN_USER_ID',USER_ID) or find_in_set('$LOGIN_USER_PRIV',PRIV_ID)) and BEGIN_DATE<='$CUR_DATE' and (END_DATE>='$CUR_DATE' or END_DATE is null) order by BEGIN_DATE";
 $cursor= exequery($connection,$query);
 if($ROW=mysql_fetch_array($cursor))
    $VOTE_COUNT=$ROW[0];

 if($VOTE_COUNT==0)
 {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="3" class="small">
  <tr>
    <td class="Big"><img src="/images/menu/vote.gif" align="absmiddle"><span class="big3"> 已发布的投票</span><br>
    </td>
  </tr>
</table>
<br>

<?
   Message("","无已发布的投票");
   exit;
 }

 $PER_PAGE=10;
 $PAGES=10;
 $PAGE_COUNT=ceil($VOTE_COUNT/$PER_PAGE);

 if($CUR_PAGE<=0 || $CUR_PAGE=="")
    $CUR_PAGE=1;
 if($CUR_PAGE>$PAGE_COUNT)
    $CUR_PAGE=$PAGE_COUNT;
?>

<table border="0" width="100%" cellspacing="0" cellpadding="3" class="small">
  <tr>
    <td class="Big"><img src="/images/menu/vote.gif" align="absmiddle"><span class="big3"> 已发布的投票</span><br>
    </td>
    <td align="right" valign="bottom" class="small1">共<span class="big4">&nbsp;<?=$VOTE_COUNT?></span>&nbsp;条
    </td>
    <td align="right" valign="bottom" class="small1">
       <a class="A1" href="current.php?CUR_PAGE=1">首页</a>&nbsp;
       <a class="A1" href="current.php?CUR_PAGE=<?=$PAGE_COUNT?>">末页</a>&nbsp;&nbsp;
<?
if($CUR_PAGE%$PAGES==0)
   $J=$PAGES;
else
   $J=$CUR_PAGE%$PAGES;

if($CUR_PAGE> $PAGES)
{
?>
       <a class="A1" href="current.php?CUR_PAGE=<?=$CUR_PAGE-$J-$PAGES+1?>">上<?=$PAGES?>页</a>&nbsp;&nbsp;
<?
}

for($I=$CUR_PAGE-$J+1;$I<=$CUR_PAGE-$J+$PAGES;$I++)
{
   if($I>$PAGE_COUNT)
      break;

   if($I==$CUR_PAGE)
   {
?>
       [<?=$I?>]&nbsp;
<?
   }
   else
   {
?>
       [<a class="A1" href="current.php?CUR_PAGE=<?=$I?>"><?=$I?></a>]&nbsp;
<?
   }
}
?>
      &nbsp;
<?
if($I-1< $PAGE_COUNT)
{
?>
       <a class="A1" href="current.php?CUR_PAGE=<?=$I?>">下<?=$PAGES?>页</a>&nbsp;&nbsp;
<?
}
if($CUR_PAGE-1>=1)
{
?>
       <a class="A1" href="current.php?CUR_PAGE=<?=$CUR_PAGE-1?>">上一页</a>&nbsp;
<?
}
else
{
?>
       上一页&nbsp;
<?
}

if($CUR_PAGE+1<= $PAGE_COUNT)
{
?>
       <a class="A1" href="current.php?CUR_PAGE=<?=$CUR_PAGE+1?>">下一页</a>&nbsp;
<?
}
else
{
?>
       下一页&nbsp;
<?
}
?>
       &nbsp;
    </td>
    </tr>
</table>

<br>
<table border="0" cellspacing="1" width="95%" class="small" bgcolor="#000000" cellpadding="3">
  <tr class="TableHeader">
      <td nowrap align="center">发布人</td>
      <td nowrap align="center">标题</td>
      <td nowrap align="center">匿名</td>
      <td nowrap align="center">生效日期 <img border=0 src="/images/arrow_down.gif" width="11" height="10"></td>
      <td nowrap align="center">终止日期</td>
      <td nowrap align="center">操作</td>
    </tr>

<?
 //============================ 显示已发布公告 =======================================
 $query = "SELECT * from VOTE_TITLE where (TO_ID='ALL_DEPT' or find_in_set('$LOGIN_DEPT_ID',TO_ID)  or find_in_set('$LOGIN_USER_ID',USER_ID) or find_in_set('$LOGIN_USER_PRIV',PRIV_ID)) and BEGIN_DATE<='$CUR_DATE' and (END_DATE>='$CUR_DATE' or END_DATE is null) order by BEGIN_DATE";
 $cursor= exequery($connection,$query);
 $VOTE_COUNT=0;
 while($ROW=mysql_fetch_array($cursor))
 {
    $VOTE_COUNT++;

    if($VOTE_COUNT<$CUR_PAGE*$PER_PAGE-$PER_PAGE+1)
       continue;
    if($VOTE_COUNT>$CUR_PAGE*$PER_PAGE)
       break;

    $VOTE_ID=$ROW["VOTE_ID"];
    $FROM_ID=$ROW["FROM_ID"];
    $TO_ID=$ROW["TO_ID"];
    $SUBJECT=$ROW["SUBJECT"];
    $TYPE=$ROW["TYPE"];
    $VIEW_PRIV=$ROW["VIEW_PRIV"];
    $ANONYMITY=$ROW["ANONYMITY"];
    $SEND_TIME=$ROW["SEND_TIME"];
    $BEGIN_DATE=$ROW["BEGIN_DATE"];
    $END_DATE=$ROW["END_DATE"];
    $READERS=$ROW["READERS"];

    $SUBJECT=str_replace("<","&lt",$SUBJECT);
    $SUBJECT=str_replace(">","&gt",$SUBJECT);
    $SUBJECT=stripslashes($SUBJECT);

    if($ANONYMITY=="0")
       $ANONYMITY_DESC="不允许";
    else
       $ANONYMITY_DESC="允许";

    if($END_DATE=="0000-00-00")
       $END_DATE="";

    $query1="select * from USER where USER_ID='$FROM_ID'";
    $cursor1= exequery($connection,$query1);
    if($ROW=mysql_fetch_array($cursor1))
    {
       $FROM_NAME=$ROW["USER_NAME"];
       $DEPT_ID=$ROW["DEPT_ID"];
    }

    $DEPT_NAME=dept_long_name($DEPT_ID);

    if($VOTE_COUNT%2==1)
       $TableLine="TableLine1";
    else
       $TableLine="TableLine2";
?>
    <tr class="<?=$TableLine?>">
      <td nowrap align="center"><u title="部门:<?=$DEPT_NAME?>" style="cursor:hand"><?=$FROM_NAME?></u></td>
      <td>
      <a href="javascript:open_vote('<?=$VOTE_ID?>');" title="点击查看投票情况"><?=$SUBJECT?></a>
      </td>
      <td nowrap align="center"><?=$ANONYMITY_DESC?></td>
      <td nowrap align="center"><?=$BEGIN_DATE?></td>
      <td nowrap align="center"><?=$END_DATE?></td>
      <td nowrap align="center">
<?
if($VIEW_PRIV!="2")
{
?>
      <a href="javascript:<?if($VIEW_PRIV=="0"&&!find_id($READERS,$LOGIN_USER_ID)){?>alert('投票后才能查看投票结果!')<?}else{?>view_result('<?=$VOTE_ID?>')<?}?>;">查看结果</a>
<?
}
?>
      </td>
    </tr>
<?
 }
?>

</table>
</body>

</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -