function func_between_dates($fromdate, $enddate) { $lst = ""; $ifyear = ""; $ieyear = ""; //$fromdate='20-3-2004'; //$enddate='30-6-2004'; $ifmonth = ""; $expfdate = explode("-", $fromdate); $expenddate = explode("-", $enddate); $ifday = $expfdate[0]; $ifmonth = $expfdate[1]; $ifyear = $expfdate[2]; $ieday = $expenddate[0]; $iemonth = $expenddate[1]; $ieyear = $expenddate[2]; $fromdatelist = ""; $begindatelist = ""; //print $totaldays."days"."<BR>"; $returndate = ""; //echo $ifday."th day"."<BR>"; $year = $ifyear; $monthdiff = $iemonth - $ifmonth + 1; $yeardiff = $ieyear - $ifyear; $lastdate = ""; $last = ""; $beginday = ""; $begin = ""; $iendday = ""; //echo $monthdiff."<BR>"; //echo $yeardiff; if ($yeardiff > 0) { $monthdiff = 12 - $ifmonth; $monthdiff += 1; while ($yeardiff > 0) { $iendmonth = 12; $iendday = func_noof_days_in_month($iendmonth, $ifyear); $iendyear = $ifyear + 1; $returndate = getdays($ifmonth, $iendmonth, $ifyear, $ifyear, $ifday, $iendday, $monthdiff); $dates = explode("+", $returndate); $fromdatelist .= $dates[0]; $begindatelist .= $dates[1]; $ifyear += 1; $ifmonth = 1; $yeardiff -= 1; $ifday = 1; $monthdiff = 12; } $monthdiff = $iemonth; $ifmonth = 1; } if ($yeardiff == 0) { if ($monthdiff == 1) { $monthdiff = 0; } $monthdiff; $returndate = getdays($ifmonth, $iemonth, $ifyear, $ieyear, $ifday, $ieday, $monthdiff); $dates = explode("+", $returndate); $fromdatelist .= $dates[0]; $begindatelist .= $dates[1]; } return $fromdatelist . "+" . $begindatelist; }
function sign_year($con) { $time = time(); $year = date("Y", $time); $statement = "select * from capubbs.sign where year={$year} order by month, day"; $results = mysql_query($statement); error_reporting(E_ALL & ~E_NOTICE); $datas = array(); while (($res = mysql_fetch_array($results)) != null) { $m = intval($res['month']); if ($m < 10) { $m = "0" . $m; } $date = $res['year'] . "-" . $m; $d = $res['day']; $datas[$date][$d] = intval($datas[$date][$d]) + 1; } echo '<capu>'; foreach ($datas as $key => $value) { echo '<info><month>' . $key . '</month>'; $y = intval(substr($key, 0, 4)); $m = intval(substr($key, 5, 2)); for ($i = 1; $i <= getdays($y, $m); $i++) { $x = 0; if (@$value[$i]) { $x = $value[$i]; } echo '<data><day>' . $i . '</day><number>' . $x . '</number></data>' . "\n"; //echo $x." "; } echo '</info>'; } echo '</capu>'; exit; }
echo "本年度签到统计:\n"; $datas = array(); while (($res = mysql_fetch_array($results)) != null) { $m = intval($res['month']); if ($m < 10) { $m = "0" . $m; } $date = $res['year'] . "-" . $m; $d = $res['day']; $datas[$date][$d] = intval($datas[$date][$d]) + 1; } foreach ($datas as $key => $value) { echo $key . "\n"; $y = intval(substr($key, 0, 4)); $m = intval(substr($key, 5, 2)); for ($i = 1; $i <= getdays($y, $m); $i++) { $x = 0; if (@$value[$i]) { $x = $value[$i]; } echo $x . " "; } echo "\n\n"; } echo "\n"; echo "总签到次数排名top100:\n"; $statement = "select username,sign from capubbs.userinfo order by sign desc,username limit 0,100"; $results = mysql_query($statement); $i = 1; $j = 1; $last = 0;