✏️ 正在编辑: export_server_Data.php
路径:
/home/llpreacharge/public_html/LLPRECHARGE/Admin/export_server_Data.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php ob_start(); require'session.php'; require'../connection.php'; require'../functions.php'; ini_set('memory_limit', '-1'); $tableName = "recharge"; $colDate = "Date"; $quM = "SELECT $colDate FROM $tableName ORDER BY Id ASC LIMIT 1"; $reM = mysqli_query($con,$quM); $dataM = mysqli_fetch_array($reM); $countM = mysqli_num_rows($reM); //print_r($dataM); $dateData = $dataM[$colDate]; $yearData = substr($dateData,0,4); $monthData = substr($dateData,5,2); $firstDate = $yearData."-".$monthData."-01"; $lastDate = $yearData."-".$monthData."-31"; if(isset($_POST['export'])) { $firstDate = $_POST['fdate']; $lastDate = $_POST['ldate']; $sql = "SELECT * FROM $tableName WHERE $colDate>='$firstDate' AND $colDate<='$lastDate'"; $res = mysqli_query($con,$sql); $count = mysqli_num_rows($res); if($count>0) { $finaldata = array(); while($data=mysqli_fetch_assoc($res)) { $finaldata[]=$data; } $fnDate = date_create($firstDate); $fnDate = date_format($fnDate, "Ym"); $filename = $tableName.$fnDate . ".xls"; header("Content-Type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=\"$filename\""); $firstrow=false; foreach($finaldata as $data) { if(!$firstrow) { echo implode("\t",array_keys($data))."\n"; $firstrow=true; } echo implode("\t",array_values($data))."\n"; } exit(); } else { echo "Data Not Found !"; } } if(isset($_POST['delete'])) { $firstDate = $_POST['fdate']; $lastDate = $_POST['ldate']; $quDelete = "DELETE FROM $tableName WHERE $colDate>='$firstDate' AND $colDate<='$lastDate'"; mysqli_query($con,$quDelete); } ?> <html> <head> <title>Payment By Seller</title> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="icon" href="images/logo.png" type="image/gif" sizes="16x16"> <!-- Admin CSS File Link --> <link rel="stylesheet" href="css/style.css"> <!-- User JAVA SCRIPT File Link --> <script type="text/javascript" src="js/script.js"></script> <!-- Font Awesome Icone --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <style> .div1{ background:; width:96%; margin:0 2%; padding:5px 10px; } .div1 input, .div1 select{ height:40px; max-width:160px; font-size:14px; padding:5px; border-radius:5px; border:solid #6b5127 1px; overflow:hidden; margin:10px 5px; } textarea{width:500px; height:130px; padding:10px;} input[type=submit]{ background:#6b5127; color:white; transition:1s; cursor:pointer; } input[type=submit]:hover{ background:white; color:#6b5127; transition:1s; } .div2{ background:#f7f7f7; width:100%; height:450px; float:left; text-align:center; padding:5px; overflow:auto; } .div2 table{ width:98%; text-align:center; font-size:13px; border-collapse:collapse; padding:2px 5px; margin:1%; } .div2 table tr:nth-child(odd){background:#f6f0e8;} .div2 table tr:nth-child(even){background:white; } table th{ background:#6b5127; color:white; height:35px; border:solid white 1px; padding:2px 5px; } table td{ height:30px; border:solid black 1px; padding:2px 5px; } #inpNum, #mdate, #ydate{display:none;} @media(max-width:768px) { .div1{ background:; width:100%; height:auto; margin:10px 0 0 0; padding:0; text-align:center; } .div1 input,.div1 select{ width:90%; margin:10px; } .div2{ width:100%; margin:10px 0 0 0; padding:0px; text-align:center; } } </style> <link rel="stylesheet" href="css/mediaStyle.css"> </head> <body> <!--Header Divison--> <?php require'header.php'; ?> <!--Container Division--> <div class="container"> <?php include'menu.php'; ?> <div class="content" id="contentDiv"> <div class="head"> <div class="title"><i class="fa fa-bars" onclick="hideMenu()" style="float:left; margin:10px;"></i><p>Payment By Seller :-</p></div> <div class="msg"><marquee><?php include'../msg.php'; ?></marquee></msg> </div><hr> <div class="data-content"> <div class="div1"> <form method="post"> <input type="date" name="fdate" value="<?php echo $dateData; ?>"> <input type="date" name="ldate" value="<?php echo $dateData; ?>"> <input type="submit" name="export" value="Export To Excel" > <input type="submit" name="delete" value="DELETE OLD DATA" > </form> </div> </form> <div class="div2"> <table cellpadding="20" border="2" id="DataTbl"> <tr> <th>P.Id</th> <th>Date Time</th> <th>Seller</th> <th>Firm</th> <th>Amount</th> <th>BankName FirmName</th> </tr> </table> </div> </div> </div> </div> <?php require'footer.php'; ?> </body> </html>
💾 保存文件
← 返回文件管理器