Server IP : 10.254.12.21 / Your IP : 10.254.12.21 Web Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/5.6.40 System : Linux arit.skru.ac.th 3.10.0-1160.76.1.el7.x86_64 #1 SMP Wed Aug 10 16:21:17 UTC 2022 x86_64 User : apache ( 48) PHP Version : 5.6.40 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/ |
Upload File : |
<?php //include 'check_mode_admin.php';?> <?php include 'header.php';?> <?php include 'dbstat.php';?> <div class="container px-5 py-5"> <?php function MonthThai($strMonth) { $strMonthName = Array("","มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"); $strMonthThai=$strMonthName[$strMonth]; return $strMonthThai; } $pagetitle_text = "สถิติการเข้าชมเว็บไซต์สำนักวิทยบริการและเทคโนโลยีสารสนเทศ"; $max_report_days = 31; $submit_stat = (isset($_POST["submit_stat"])) ? $_POST["submit_stat"] : ''; ?> <h2 class="page-header" style="text-align: center;"><?php echo $pagetitle_text;?></h2> <p> </p> <?php if($submit_stat <> "") { $stat_type = (isset($_POST["stat_type"])) ? $_POST["stat_type"] : ''; $start_date = (isset($_POST["start_date"])) ? $_POST["start_date"] : ''; $stop_date = (isset($_POST["stop_date"])) ? $_POST["stop_date"] : ''; if($stat_type<>'' && $start_date<>'' && $stop_date<>'') { if($stop_date<$start_date) { $temp_date = $start_date; $start_date = $stop_date; $stop_date = $temp_date; } $condition_start_date = $start_date . " 00:00:00"; $condition_stop_date = $stop_date . " 23:59:59"; $total_count = 0; //วันที่ เดือน พ.ศ. $start_date_thai = date('j', strtotime($start_date)) . " " . MonthThai(date('n', strtotime($start_date))) . " " . (date('Y', strtotime($start_date))+543); $stop_date_thai = date('j', strtotime($stop_date)) . " " . MonthThai(date('n', strtotime($stop_date))) . " " . (date('Y', strtotime($stop_date))+543); if($stat_type == 1) { $report_type = (isset($_POST["report_type"])) ? $_POST["report_type"] : ''; if($report_type<>"") { if($report_type==1) { //if($report_type==1) { $add_string = " +" . $max_report_days-1 . " day"; $last_condition_date = date('Y-m-d', strtotime($start_date . $add_string)); if($stop_date <= $last_condition_date) { ?> <h4>สถิติการเข้าชมเว็บไซต์สำนักวิทยบริการและเทคโนโลยีสารสนเทศ รายวัน</h4> <h4>ระหว่างวันที่ <?php echo $start_date_thai;?> ถึงวันที่ <?php echo $stop_date_thai;?></h4> <br /> <table class="table table-striped table-bordered table-hover"> <thead> <tr bgcolor="#6699FF"> <th><div align="center">วันที่</div></th> <th><div align="center">จำนวนครั้งที่เข้าใช้บริการ</div></th> </tr> </thead> <tbody> <?php $i_date = $start_date; $total_count1 = 0; while($i_date <= $stop_date) { $condition_start_date = $i_date . " 00:00:00"; $condition_stop_date = $i_date . " 23:59:59"; $i_date_thai = date('j', strtotime($i_date)) . " " . MonthThai(date('n', strtotime($i_date))) . " " . (date('Y', strtotime($i_date))+543); //หาจำนวนครั้งที่เข้าใช้บริการ $sql = "SELECT COUNT(num) AS count_num FROM stat_enter WHERE (enter_date Between '" . $condition_start_date . "' And '" . $condition_stop_date . "')"; $query = mysqli_query($conn,$sql); if($result=mysqli_fetch_array($query,MYSQLI_ASSOC)) { $num_enter = $result["count_num"]; } ?> <tr> <td align="center"><?php echo $i_date_thai;?></td> <td align="right"><?php echo number_format($num_enter, 0, '', ',');?></td> </tr> <?php $i_date = date('Y-m-d', strtotime($i_date . ' +1 day')); $total_count1 += $num_enter; } //while($i_date <= $stop_date) { ?> <tr> <td align="center" bgcolor="#CCFFCC">รวม</td> <td align="right" bgcolor="#CCFFCC"><?php echo number_format($total_count1, 0, '', ',');?></td> </tr> </tbody> </table> <br /><br /> <?php } else { //if($stop_date <= $last_condition_date) { ?> <BR />สถิติรายวันดูได้ไม่เกิน <?php echo $max_report_days;?> วัน กรุณาระบุวันที่ต้องการดูสถิติรายวันใหม่ <BR /><BR /><a href="stat.php"><button type="button" class="btn-warning">คลิกที่นี่เพื่อกลับไปหน้าที่แล้ว</button></a> <?php } //if($stop_date <= $last_condition_date) { } elseif($report_type==2) { //if($report_type==1) { $month_start = date('n', strtotime($start_date)); $year_start = date('Y', strtotime($start_date)); $month_stop = date('n', strtotime($stop_date)); $year_stop = date('Y', strtotime($stop_date)); $i = $year_start*12 + $month_start; $i_stop = $year_stop*12 + $month_stop; $current_month = $month_start; $current_year = $year_start; ?> <h4>สถิติการเข้าชมเว็บไซต์สำนักวิทยบริการและเทคโนโลยีสารสนเทศ รายเดือน</h4> <h4>ระหว่างวันที่ <?php echo $start_date_thai;?> ถึงวันที่ <?php echo $stop_date_thai;?></h4> <br /> <table class="table table-striped table-bordered table-hover"> <thead> <tr bgcolor="#6699FF"> <th><div align="center">เดือน</div></th> <th><div align="center">ปีพ.ศ.</div></th> <th><div align="center">จำนวนครั้งที่เข้าใช้บริการ</div></th> </tr> </thead> <tbody> <?php $total_count1 = 0; while($i <= $i_stop) { //หาจำนวนครั้งที่เข้าใช้บริการ $sql = "SELECT COUNT(num) AS count_num FROM stat_enter WHERE ( (month(enter_date)=" . $current_month . ") AND (year(enter_date)=" . $current_year . ") AND (enter_date BETWEEN '" . $condition_start_date . "' AND '" . $condition_stop_date . "') )"; $query = mysqli_query($conn,$sql); if($result=mysqli_fetch_array($query,MYSQLI_ASSOC)) { $num_enter = $result["count_num"]; } ?> <tr> <td align="center"><?php echo MonthThai($current_month);?></td> <td align="center"><?php echo $current_year+543;?></td> <td align="right"><?php echo number_format($num_enter, 0, '', ',');?></td> </tr> <?php $total_count1 += $num_enter; if($current_month==12) { $current_month = 1; $current_year += 1; } else { $current_month += 1; } $i = ($current_year*12) + $current_month; } //while($i <= $i_stop) { ?> <tr> <td colspan="2" align="center" bgcolor="#CCFFCC">รวม</td> <td align="right" bgcolor="#CCFFCC"><?php echo number_format($total_count1, 0, '', ',');?></td> </tr> </tbody> </table> <br /><br /> <?php } elseif($report_type==3) { //if($report_type==1) { $year_start = date('Y', strtotime($start_date)); $year_stop = date('Y', strtotime($stop_date)); $current_year = $year_start; ?> <h4>สถิติการเข้าชมเว็บไซต์สำนักวิทยบริการและเทคโนโลยีสารสนเทศ มหาวิทยาลัยราชภัฏสงขลา รายปี</h4> <h4>ระหว่างวันที่ <?php echo $start_date_thai;?> ถึงวันที่ <?php echo $stop_date_thai;?></h4> <br /> <table class="table table-striped table-bordered table-hover"> <thead> <tr bgcolor="#6699FF"> <th><div align="center">ปีพ.ศ.</div></th> <th><div align="center">จำนวนครั้งที่เข้าใช้บริการ</div></th> </tr> </thead> <tbody> <?php $total_count1 = 0; while($current_year <= $year_stop) { //หาจำนวนครั้งที่เข้าใช้บริการ $sql = "SELECT COUNT(num) AS count_num FROM stat_enter WHERE ( (year(enter_date)=" . $current_year . ") AND (enter_date BETWEEN '" . $condition_start_date . "' AND '" . $condition_stop_date . "') )"; $query = mysqli_query($conn,$sql); if($result=mysqli_fetch_array($query,MYSQLI_ASSOC)) { $num_enter = $result["count_num"]; } ?> <tr> <td align="center"><?php echo $current_year+543;?></td> <td align="right"><?php echo number_format($num_enter, 0, '', ',');?></td> </tr> <?php $total_count1 += $num_enter; $current_year += 1; } //while($i <= $i_stop) { ?> <tr> <td align="center" bgcolor="#CCFFCC">รวม</td> <td align="right" bgcolor="#CCFFCC"><?php echo number_format($total_count1, 0, '', ',');?></td> </tr> </tbody> </table> <br /><br /> <?php } elseif($report_type==4) { //if($report_type==1) { ?> <h4>สรุปสถิติการเข้าชมเว็บไซต์สำนักวิทยบริการและเทคโนโลยีสารสนเทศ มหาวิทยาลัยราชภัฏสงขลา</h4> <h4>ระหว่างวันที่ <?php echo $start_date_thai;?> ถึงวันที่ <?php echo $stop_date_thai;?></h4> <br /> <table class="table table-striped table-bordered table-hover"> <thead> <tr bgcolor="#6699FF"> <th><div align="center">จำนวนครั้งที่เข้าใช้บริการ</div></th> </tr> </thead> <tbody> <tr> <?php //หาจำนวนครั้งที่เข้าใช้บริการ $sql = "SELECT COUNT(num) AS count_num FROM stat_enter WHERE (enter_date Between '" . $condition_start_date . "' And '" . $condition_stop_date . "')"; $query = mysqli_query($conn,$sql); if($result=mysqli_fetch_array($query,MYSQLI_ASSOC)) { $num_enter = $result["count_num"]; } ?> <td align="center"><?php echo number_format($num_enter, 0, '', ',');?></td> </tr> </tbody> </table> <?php } //if($report_type==1) { } else { //if($report_type<>"") { ?> <form action="" method="post" name="form1" id="form1"> <br /> <table class="table table-striped table-bordered table-hover"> <thead> <th colspan="2">กรุณาเลือกรูปแบบรายงาน</th> </thead> <tbody> <tr> <td width="30%">รูปแบบรายงาน</td> <td> <div class="form-group"> <label class="radio-inline"> <input type="radio" name="report_type" id="report_type3" value="4" checked="checked">สรุป </label> <label class="radio-inline"> <input type="radio" name="report_type" id="report_type1" value="1">รายวัน </label> <label class="radio-inline"> <input type="radio" name="report_type" id="report_type2" value="2">รายเดือน </label> <label class="radio-inline"> <input type="radio" name="report_type" id="report_type3" value="3">รายปี </label> </div> </td> </tr> </tbody> </table> <div class="form-group"> <input type="hidden" name="stat_type" id="stat_type" value="<?php echo $stat_type;?>" /> <input type="hidden" name="start_date" id="start_date" value="<?php echo $start_date;?>" /> <input type="hidden" name="stop_date" id="stop_date" value="<?php echo $stop_date;?>" /> <input name="submit_stat" type="submit" id="submit_stat" value="ดูสถิติ" class="btn btn-success"> <a href='javascript:history.back(1);'><button type="button" class="btn btn-default">ยกเลิก</button></a> </div> </form> <?php } //if($report_type<>"") { } //if($stat_type == 1) { } else { //if($stat_type<>'' && start_date<>'' && stop_date<>'') { ?> <BR />กรุณาเลือกสถิติที่ต้องการดู และเลือกวันที่ <BR /><BR /><a href='javascript:history.back(1);'><button type="button" class="btn-warning">คลิกที่นี่เพื่อกลับไปหน้าที่แล้ว</button></a> <?php } //if($stat_type<>'' && start_date<>'' && stop_date<>'') { } else { //if($submit_roomanddate <> "") { //$get_room_code = (isset($_GET["room_code"])) ? $_GET["room_code"] : ''; //$get_reserve_date = (isset($_GET["reserve_date"])) ? $_GET["reserve_date"] : ''; ?> <form action="" method="post" name="form1" id="form1"> <br /> <table class="table table-striped table-bordered table-hover"> <tbody> <tr> <td width="30%">ชนิดของสถิติ</td> <td> <div class="form-group"> <select class="form-control" name="stat_type" id="stat_type"> <option value="1">สถิติการเข้าชมเว็บไซต์สำนักวิทยบริการและเทคโนโลยีสารสนเทศ</option> </select> </div> </td> </tr> <tr> <td width="30%">จากวันที่</td> <td> <div class="form-group"> <input type="date" name="start_date" id="start_date" class="form-control"> </div> </td> </tr> <tr> <td width="30%">ถึงวันที่</td> <td> <div class="form-group"> <input type="date" name="stop_date" id="stop_date" class="form-control"> </div> </td> </tr> </tbody> </table> <div class="form-group"> <input name="submit_stat" type="submit" id="submit_stat" value="ดูสถิติ" class="btn btn-success"> <input name="reset_stat" type="reset" id="reset_stat" value="Reset" class="btn btn-default"> </div> </form> <?php } //if($submit_roomanddate <> "") { ?> </div> <?php include 'footer.php';?>