Вход Регистрация
Файл: html/admin/reputation.php
Строк: 101
<?php
require_once ('../system/func.php');
require_once (
'../system/header.php');

if (!isset(
$user) || $user['access'] < 3) {
    
?><script>showContent("/");</script><?php
    
exit(0);
}
if (isset(
$_GET['save']) && isset($_GET['id']) && isset($_GET['rep']) && isset($_GET['name'])) {
    if (
$mc->query("UPDATE `reputation` SET "
                    
"`rep` = '" $_GET['rep'] . "' ,"
                    
"`name` = '" $_GET['name'] . "'"
                    
" WHERE `id` = '" $_GET['id'] . "'")) {
        
message(urlencode("сохранено"));
    } else {
        
message(urlencode("<font style='color:red'>не сохранено</font>"));
    }
}
if (isset(
$_GET['dell']) && isset($_GET['id'])) {
    if (
$mc->query("DELETE FROM `reputation` WHERE `id` = '" $_GET['id'] . "'")) {
        
message(urlencode("удалено"));
    } else {
        
message(urlencode("<font style='color:red'>не удалено</font>"));
    }
}
if (isset(
$_GET['add']) && isset($_GET['rep']) && isset($_GET['name'])) {
    if (
$mc->query("INSERT INTO `reputation`("
                    
"`id`,"
                    
"`rep`,"
                    
"`name`"
                    
") VALUES ("
                    
"NULL,"
                    
"'" $_GET['rep'] . "',"
                    
"'" $_GET['name'] . "'"
                    
")")
            ) {
        
message(urlencode("создано"));
    } else {
        
message(urlencode("<font style='color:red'>не создано</font>"));
    }
}
$repArrAll $mc->query("SELECT * FROM `reputation` ORDER BY `rep` ASC")->fetch_all(MYSQLI_ASSOC);
?>
<center>
    <h2>
        <strong>-Редактор Репутаций-</strong>
    </h2>
</center>
<table style="width: 98%;margin: auto;">
    <tr>
        <td style="width:80px"><input  type='text' id='rep_new' style="width:100%;text-align: center" placeholder="очки репутации" value=""></td>
        <td style="max-width:100%"><input  type='text' id='name_new' style="width:100%;text-align: center" placeholder="название" value=""></td>
    </tr> 
</table>
<table style="width: 98%;margin: auto;">
    <tr>
        <td style="max-width:100%"><button onclick="showContent('/admin/reputation.php?add&rep=' + $('#rep_new').val() + '&name=' + $('#name_new').val())" class="button" style="width:100%;text-align: center" >add new</button></td>
    </tr>
</table>
<hr class="hr_01"/>
<table style="width: 98%;margin: auto;">
    <tr>
        <td style="width:80px;text-align: center">Репутация</td>
        <td style="max-width:100%;text-align: center">Название</td>
    </tr> 
</table>
<hr class="hr_01"/>
<?php for ($i 0$i count($repArrAll); $i++) { ?>
    <table style="width: 98%;margin: auto;">
        <tr>
            <td><input  type='text' id='id_<?= $i?>' value="<?= $repArrAll[$i]['id']; ?>" hidden></td>
            <td style="width:80px"><input  type='text' id='rep_<?= $i?>' style="width:100%;text-align: center" placeholder="очки репутации" value="<?= $repArrAll[$i]['rep']; ?>"></td>
            <td style="max-width:100%"><input  type='text' id='name_<?= $i?>' style="width:100%;text-align: center" placeholder="название" value="<?= $repArrAll[$i]['name']; ?>"></td>
        </tr> 
    </table>
    <table style="width: 98%;margin: auto;">
        <tr>
            <td style="max-width:100%"><button onclick="showContent('/admin/reputation.php?save&id=' + $('#id_<?= $i?>').val() + '&rep=' + $('#rep_<?= $i?>').val() + '&name=' + $('#name_<?= $i?>').val())" class="button" style="width:100%;text-align: center" >save</button></td>
            <td style="width:80px" ><button onclick="showContent('/admin/reputation.php?dell&id=' + $('#id_<?= $i?>').val())" class="button" style="width:100%;text-align: center" >delete</button></td>
        </tr>
    </table>
    <hr class="hr_01"/>
<?php ?>

<?php
$footval 
'adminmoney';
include 
'../system/foot/foot.php';
?>
Онлайн: 0
Реклама