Файловый менеджер - Редактировать - /var/www/jonas-eriksen.dk/user/profile.php
Назад
<?php include('../include.php'); include('../admin/consent.php'); include('../export/export-user.php'); $admin = new admin($db); $admin->passwordResetCheck(); $user = new user($db); $event = new event($db); $log = new log($db); if (!isset($_GET['user'])) { echo "Intet id valgt se <a href='./'>brugerlisten</a>"; } elseif (!$user->getUser($_GET['user'])) { } else { $profile = $user->getUser($_GET['user']); $pictureUrl = '/static/profile-picture/' . $profile[0] . '.jpg'; if ($_POST) { if (isset($_POST['cross'])) { $log->addLog($_SESSION['userId'], "Opdateret abonnoment betalt", "Admin", "/user/profile.php?user=" . $_GET['user']); $user->updateSubcription($_POST['cross'], 1); $admin->redirect('/user/profile.php?user=' . $_GET['user']); } if (isset($_POST['checkmark'])) { $log->addLog($_SESSION['userId'], "Opdateret abonnoment ikke betalt", "Admin", "/user/profile.php?user=" . $_GET['user']); $user->updateSubcription($_POST['checkmark'], 0); $admin->redirect('/user/profile.php?user=' . $_GET['user']); } if (isset($_POST['point']) && isset($_POST['crossten'])) { $log->addLog($_SESSION['userId'], "Tilføjede event", "Event", "/user/profile.php?user=" . $_GET['user']); $event->newEvent(DATE('Y'), $_GET['user'], $_POST['point'], $_POST['crossten'], $_POST['weaponSelect']); $user->changeEventNumber($_GET['user'], -1); $admin->redirect('/user/profile.php?user=' . $_GET['user']); } if (isset($_POST['amount'])) { $log->addLog($_SESSION['userId'], "Tilføjede " . $_POST['amount'] . " point til brugeren", "Admin", "/user/profile.php?user=" . $_GET['user']); $user->changeEventNumber($_GET['user'], $_POST['amount']); $admin->redirect('/user/profile.php?user=' . $_GET['user']); } if (isset($_POST['consentButton'])) { $admin->redirect('/admin/consent-form.php?user=' . $_GET['user']); } if (isset($_POST['exportButton'])) { getReport($user, $admin, $event, $_GET['user'], $_SESSION['userId'], $encryptKey, $logoName); $log->addLog($_SESSION['userId'], "Eksporterende report for brugeren " . $profile[3], "Admin", "/user/profile.php?user=" . $_GET['user']); } } include('../static/header.php'); ?> <div class="container"> <div class="row"> <div class="col-lg-12"> <?php echo "<h2>Profil for " . $profile[3]; if ($profile[10]) { echo "<p style='color:red; display: inline'> (Slettet)</p>"; } echo "</h2>"; if ($admin->admin_level(0)) { echo "<i><a href='./update.php?user=$profile[0]'>(Opdater profil)</a></i><br>"; } if (is_file('../static/profile-picture/' . $profile[0] . '.jpg') && file_exists('../static/profile-picture/' . $profile[0] . '.jpg')) { ?> <img src="<?php echo $pictureUrl ?>" style="height: 150px;"/> <?php } else { echo '<img src="../static/' . $logoName . '" style="height: 150px;"/>'; } if ($admin->admin_level(1)) { $user->getSKV($_GET['user']); ?> <form method="post" name="consentButton"> <button name="consentButton" style="float: right"> Hent samtykke </button> </form> <form method="post" name="exportButton"> <button name="exportButton" style="float: right"> Hent brugerrepport </button> </form> <?php } ?> <table id="userTable" class="display table-bordered" cellspacing="0" width="100%"> <tr> <?php if ($admin->admin_level(1)) { echo "<th>CPR</th>"; } ?> <th>Skyttenummer</th> <th>Navn</th> <th>Skytteklasse</th> <?php if ($admin->admin_level(0)) { ?> <th>Adresse</th> <th>Fødselsdag</th> <th>Telefon</th> <th>Email</th> <th>Indmeldelses år</th> <th>Må tages billede af</th> <th>Har egent våben</th> <th>Kontigent betalt</th> <?php } ?> <th>Skydninger tilbage</th> </tr> <tr> <?php if ($admin->admin_level(1)) { $cpr = decrypt($profile[2], $encryptKey); echo "<td>$cpr</td>"; } echo "<td>$profile[1]</td>"; echo "<td>$profile[3]</td>"; echo "<td>$profile[17]</td>"; if ($admin->admin_level(0)) { echo "<td>$profile[4]</td>"; echo "<td>" . date_format(new DateTime($profile[5]), 'd-m-Y') . "<br/>" . date_diff(date_create($profile[5]), date_create('today'))->y . " år</td>"; echo "<td>$profile[9]</td>"; echo "<td>$profile[6]</td>"; echo "<td>$profile[13]</td>"; if ($profile[7] == 1) { echo "<td align='center'><img src='/static/checkmark.gif' alt='Ja' width='40'> </td>"; } else { echo "<td align='center'><img src='/static/red_cross.png' alt='nej' width='40'> </td>"; } if ($profile[11] == 0) { echo "<td>Nej</td>"; } elseif ($profile[11] == 1) { echo "<td>Ja, gevær</td>"; } elseif ($profile[11] == 2) { echo "<td>Ja, pistol</td>"; } else { echo "<td>Ja, både gevær og pistol</td>"; } echo "<form method='POST'>"; if ($profile[8] == 1) { echo "<td align='center'><button style=\"background-color: white;\" name='checkmark' value='$profile[0]'><img src='/static/checkmark.gif' alt='Ja' width='40'></button></td>"; } else { echo "<td align='center'><button style=\"background-color: white;\" name='cross' value='$profile[0]'><img src='/static/red_cross.png' alt='nej' width='40'></button></td>"; } echo "</form>"; } echo "<td>$profile[12]</td>"; echo "</tr>"; ?> </table> </div> </div> </div> <br/> <style> div.container { width: 100%; } input[type=number] { width: 80px; } </style> <?php $weaponStmt = $db->prepare("SELECT id, name FROM result_weapon ORDER BY CASE WHEN name LIKE 'Riffel%' THEN 1 ELSE 2 END, name"); $weaponStmt->execute(); if ($admin->admin_level(0)) { ?> <div class="container"> <div class="row"> <div class="col-lg-12"> <table class="table-bordered"> <tr> <th>Point</th> <th>Krydstier</th> <th>Type</th> <th></th> </tr> <form method="post"> <td><input type="number" name="point"></td> <td><input type="number" name="crossten"></td> <td> <select name="weaponSelect"> <?php foreach ($weaponStmt->fetchAll() as $weaponType) { ?> <option value="<?php echo $weaponType[0] ?>"><?php echo $weaponType[1] ?></option> <?php } ?> </select> </td> <td><input type="submit"></td> </form> </table> <form method="post">Indsæt <input type="number" value="0" width="10px" name="amount">skydninger på kontoen <input type="submit"></form> </div> </div> </div> <?php } if (!isset($_GET['year'])) { $getYear = date("Y"); } else { $getYear = $_GET['year']; } $result = $event->getAllForUser($getYear, $_GET['user']); ?> <div class="container"> <div class="row"> <div class="col-lg-12"> <?php echo "<h2>Træningsresultater i $getYear</h2>"; foreach ($event->getYearsForUser($_GET['user']) as $year) { ?> <a href="/user/profile.php?user=<?php echo $_GET['user'] ?>&year=<?php echo $year[0] ?>"> <button class="btn btn-primary" type="button"> <?php echo $year[0] ?> <span class="badge"><?php $event->getYearCountForUser($year[0], $_GET['user']) ?></span> </button> </a> <?php } ?> <table id="eventTable" class="table-bordered" cellspacing="0" width="100%"> <thead> <tr> <th style="display: none"></th> <th>Point</th> <th>Krydsti</th> <th>Type</th> <th>Dato</th> <th></th> </tr> </thead> <tfoot> <tr> <th style="display: none"></th> <th>Point</th> <th>Krydsti</th> <th>Type</th> <th>Dato</th> <th></th> </tr> </tfoot> <tbody> <?php foreach ($result as $row) { echo "<tr>"; echo "<td style='display: none'>$row[0]</td>"; echo "<td>$row[1]</a></td>"; echo "<td>$row[2]</td>"; echo "<td>$row[3]</td>"; echo "<td>" . date("d/m/Y", strtotime($row[9])) . "</td>"; echo "<td><a href='/event/edit.php?event=" . $row[0] . "'>Edit</a></td>"; echo "</tr>"; } ?> </tbody> </table> </div> </div> </div> <?php include("../static/footer.php"); ?> <script> $(document).ready(function () { $('#eventTable').DataTable({ "order": [[0, "desc"]] }); }); </script> <?php } ?>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка