/
0Art
/
Baev_course
Обзор
Документация
Войти
/
0Art
/
Baev_course
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
admin.php
349 строк
10 KB
0Art
upload files
18 дек 2024, 18:49
18 дек 2024, 18:49
150210e
Код
Авторство
О чём код?
<?php // Админка ini_set('display_errors','On'); require_once("header.php"); if(isset($_GET['potok'])) { $potok = (int) $_GET['potok']; } $token = ""; if(isset($_GET['token'])) $token = $_GET['token']; if($token != "f4446c6fb71d1b1056dc090") { header("location:index.php"); } $sql = "SELECT * FROM `course".$course."` WHERE `show_baev` = 1 AND `potok_number` = '$potok' ORDER BY`pay_time` DESC"; $result = mysqli_query($db, $sql); $all_users = []; $all_data = [ "all_pay" => 0, "all_users" => 0 ]; while( $myrow3 = mysqli_fetch_array($result) ) { $id = $myrow3["id"]; $tarif = $myrow3["tarif"]; $payed = $myrow3['payed']; $all_data["all_pay"] = $all_data["all_pay"] + $payed; $all_data["all_users"]++; if($payed == 3000 || $payed == 2500) $tarif = 3; if($tarif==0) $tarif_text = "лайт"; if($tarif==1) $tarif_text = "медиум"; if($tarif==2) $tarif_text = "хард"; if($tarif==3) $tarif_text = "бронь"; $all_users[$id]["id"] = $myrow3["id"]; $all_users[$id]["email"] = $myrow3["email"]; $all_users[$id]["tarif"] = $tarif; $all_users[$id]["tarif_text"] = $tarif_text; $all_users[$id]["card"] = "**".$myrow3['card_last_four']; if($myrow3['card_last_four'] == "0") $all_users[$id]["card"] = "paypal"; $all_users[$id]["payed"] = $payed; $all_users[$id]["pay_time"] = $myrow3['pay_time']; $all_users[$id]["show"] = $myrow3["show_baev"]; } $check = round($all_data["all_pay"]/ $all_data["all_users"],0); $amount = $all_data["all_pay"]*0.878; $amount = round($amount,0); $sql3 = "SELECT * FROM `costs` WHERE `course` = $course AND `potok` = $potok"; $result3 = mysqli_query($db, $sql3); $costs = []; $amount_with_costs = $amount; $all_costs = 0; while( $myrow4 = mysqli_fetch_array($result3) ) { $costs[] = [ "summ" => $myrow4['value'], "description" => $myrow4['description'], "id" => $myrow4['id'], "type" => $myrow4['type'] ]; $amount_with_costs = $amount_with_costs - $myrow4['value']; $all_costs = $all_costs + $myrow4['value']; } ?> <!DOCTYPE html> <html style="margin-top:0 !important;"> <head> <title>Админка | Максим Баев</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="font/stylesheet.css" rel="stylesheet"> <link href="./css/slick.css" rel="stylesheet" type="text/css"> <link href="style.css" rel="stylesheet" type="text/css"> <script src="https://widget.cloudpayments.ru/bundles/cloudpayments"></script> <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700" rel="stylesheet"> <style> .container { margin: 30px auto; min-width: 600px; max-width: 1024px; height: auto; display: block; position: relative; padding: 40px; } .container .flex { display: flex; justify-content: space-between; padding-top: 50px; } .container .flex > div { word-break: break-all; overflow-wrap: break-word; width: 29%; font-size: 16px; } .container .flex > div:nth-child(2) { width: 66%; } h4.text-background { display: inline-block; } .iframe { width: 100%; height: 300px; overflow: scroll; } .users + .users { background-color: white; margin-top: 40px; padding: 20px; color: #000; } table { min-width: 100%; } table tr td, table tr th { width: 140px; } table tr th { display: none; font-size: 13px; } table tr td { display: none; font-size: 13px; padding: 3px 0px; } table tr td.active, table tr th.active { display: table-cell; text-align: left; word-break: break-all; overflow-wrap: break-word; padding-right: 5.5px; } table tr td[data=email], table tr th[data=email] { width: 230px; } table tr td[data=card], table tr th[data=card] { width: 100px; } table tr:hover td { background-color: rgba(0,0,0,.2); } table tr.active td { background-color: rgba(0,0,0,.14); } table.tablecost tbody tr td { display: table-cell; vertical-align: top; word-break: break-word; } table.tablecost tbody tr > td:first-child { padding-right: 10px; width: 80%; } .small-costs div+div { margin-top: 20px; } @media (max-width: 600px) { .container { min-width: 200px; padding: 15px; } .container .flex { flex-wrap: wrap; padding-top: 20px; } .container .flex > div, .container .flex > div:nth-child(1), .container .flex > div:nth-child(2) { width: 100%; } .container .flex > div + div { padding-top: 20px; } table tr > td:nth-child(4), table tr > td:nth-child(5), table tr > td:nth-child(6), table tr > td:nth-child(7), table tr > td:nth-child(8), table tr > td:nth-child(9), table tr > td:nth-child(10), table tr > th:nth-child(4), table tr > th:nth-child(5), table tr > th:nth-child(6), table tr > th:nth-child(7), table tr > th:nth-child(8), table tr > th:nth-child(9), table tr > th:nth-child(10) { display: none; } } </style> </head> <body> <div class="container"> <div class="header"> <h1>Свет по Баеву <?=$potok;?>.0</h1> <div>Потоки: <a href="admin.php?token=<?=$token;?>&potok=3">3</a>, <a href="admin.php?token=<?=$token;?>&potok=4">4</a></div> <div class="flex"> <div> <h4 class="text-background">Всего:</h4><br> <span>Всего выручки:</span> <strong><?=$all_data["all_pay"];?> р.</strong> <br/><br> <span>Совершило покупку:</span> <strong><?=$all_data["all_users"];?></strong> <br/><br> <span>Средний чек:</span> <strong><?=$check;?> р.</strong> <br/><br> <span>Минус налоги:</span> <strong><?=$amount;?> р.</strong> </div> <div> <div class="small-costs"> <div> <strong class="small">Разовые расходы <br/>(на создание курса и упаковки)</strong> <table cellpadding=0 cellspacing=0 class='tablecost'> <tbody> <?php foreach ($costs as $val) { if ($val['type'] == 0) { echo "<tr><td>" . $val['description'] . "</td><td>" . $val['summ'] . "</td></tr>"; } } ?> </tbody> </table> </div> <div> <strong class="small">Переменные</strong> <table cellpadding=0 cellspacing=0 class='tablecost'> <tbody> <?php foreach ($costs as $val) { if ($val['type'] == 1) { echo "<tr><td>" . $val['description'] . "</td><td>" . $val['summ'] . "</td></tr>"; } } ?> </tbody> </table> </div> </div> <br/><br/> <span><strong>Чистая прибыль после налогов и расходов:</strong></span><br/> <strong style="font-size: 1.1em;"><?=$amount-$all_costs;?> р.</strong> </div> </div> <br/><br/><br/> <h3>Все:</h3> <div class="users"> </div> <div class="users"> <table cellspacing="0" cellpadding="0" id="student2"> <thead> <tr> <th data="email" class="active">Email:</th> <th data="card" class="active">Карта:</th> <th data="payed" class="active">Сумма:</th> <th data="tarif" class="active">Тариф:</th> </tr> </thead> </table> <div class="iframe"> <table cellspacing="0" cellpadding="0" id="student"> <tbody> <?php foreach ($all_users as $row) { ?> <tr data-id="<?php echo $row['id'];?>"> <td data="email" class="active"><?php echo $row['email'];?></td> <td data="card" class="active"><?php echo $row['card'];?></td> <td data="payed" class="active"><?php echo $row['payed'];?></td> <td data="tarif" class="active"><?php echo $row['tarif_text'];?></td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> </div> <script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script> <script> $(document).ready(function() { }); </script> </body> </html>