SignUp/subs/users.php

100 lines
5.2 KiB
PHP
Raw Normal View History

2019-08-08 13:40:15 +00:00
<?php
/**
* /subs/users.php
* @version 1.0
* @desc user managemant
* @author Fándly Gergő Zoltán
* @copy 2017 Fándly Gergő Zoltán
*/
$oid=0;
?>
<div id="content">
<?php if($_SESSION['accesslevel']>=3): ?>
<div id="newdiv">
<form class="ajaxform" method="POST" action="" id="new" autocomplete="off">
<fieldset>
<legend><?php echo $lang['newuser'] ?></legend>
<center>
<table>
<tr>
<td><?php echo $lang['name'].": " ?></td>
<td><input type="text" name="n_name" placeholder="<?php echo $lang['name']."..." ?>" required></td>
</tr>
<tr>
<td><?php echo $lang['class'].": " ?></td>
<td><input type="text" name="n_class" placeholder="<?php echo $lang['class']."..." ?>"></td>
</tr>
<tr>
<td><?php echo $lang['accesslevel'].": " ?></td>
<td>
<?php
for($i=0; $i<=3; $i++){
echo "<input type=\"radio\" name=\"n_al\" value=\"".$i."\" id=\"o_".$oid."\"><label for=\"o_".$oid."\">".$lang['al'][$i]."</label><br>";
$oid++;
}
?>
</td>
</tr>
<tr>
<td><?php echo $lang['password'].": " ?></td>
<td><input type="text" name="n_password" placeholder="<?php echo $lang['password']."..." ?>" required></td>
</tr>
</table>
<br>
<br>
<button type="submit" form="new"><?php echo $lang['ok'] ?></button>
</center>
</fieldset>
</form>
</div>
<hr class="placeholder">
<div id="utils">
<button class="ajaxbutton" type="button" data-keep="1" data-confirm="<?php echo $lang['qproceed'] ?>" data-url="./users?all=passwd"><?php echo $lang['newpassword4all'] ?></button>
<button class="ajaxbutton" type="button" data-keep="\" data-confirm="<?php echo $lang['qproceed'] ?>" data-url="./users?all=reset"><?php echo $lang['resetall'] ?></button>
</div>
<hr class="placeholder">
<?php endif ?>
<h2><?php echo $lang['users'] ?></h2>
<br>
<table class="table">
<thead>
<tr>
<th data-breakpoints="xs sm"><?php echo $lang['id'] ?></th>
<th><?php echo $lang['name'] ?></th>
<th><?php echo $lang['class'] ?></th>
<th data-breakpoints="xs sm"><?php echo $lang['accesslevel'] ?></th>
<?php if($_SESSION['accesslevel']>=3): ?><th data-breakpoints="xs sm md"><?php echo $lang['password'] ?></th><?php endif ?>
<?php if($_SESSION['accesslevel']>=3): ?><th data-breakpoints="xs sm md"><?php echo $lang['except_login'] ?></th><?php endif ?>
<?php if($_SESSION['accesslevel']>=3): ?><th data-breakpoints="xs sm md"><?php echo $lang['except_signup'] ?></th><?php endif ?>
<?php if($_SESSION['accesslevel']>=3): ?><th data-breakpoints="xs sm"><?php echo $lang['actions'] ?></th><?php endif ?>
</tr>
</thead>
<tbody>
<?php
while($row=$msql->fetch(PDO::FETCH_ASSOC)){
echo "<tr>";
echo "<td>".$row['id']."</td>";
echo "<td>".$row['name']."</td>";
echo "<td>".$row['class']."</td>";
echo "<td>".$lang['al'][$row['accesslevel']]."</td>";
if($_SESSION['accesslevel']>=3){
echo "<td><span class=\"password\">".\Defuse\Crypto\Crypto::decrypt($row['password'], $crypto)."</span></td>";
echo "<td>".$row['except_login']."</td>";
echo "<td>".$row['except_signup']."</td>";
echo "<td>";
echo "<button class=\"ajaxbutton\" type=\"button\" data-confirm=\"".$lang['qdelete']."\" data-url=\"./users?delete=".$row['id']."\">".$lang['delete']."</button>";
echo "<button class=\"ajaxbutton\" type=\"button\" data-keep=\"1\" data-prompt=\"".$lang['qnewpassword'].functions::randomString(6, functions::RAND_SMALL)."\" data-url=\"./users?np_uid=".$row['id']."&np_passwd=\">".$lang['newpassword']."</button>";
echo "<button class=\"ajaxbutton\" type=\"button\" data-keep=\"1\" data-prompt=\"".$lang['qexceptlogin']."\" data-url=\"./users?el_uid=".$row['id']."&el_param=\">".$lang['except_login']."</button>";
echo "<button class=\"ajaxbutton\" type=\"button\" data-keep=\"1\" data-prompt=\"".$lang['qexceptsignup']."\" data-url=\"./users?es_uid=".$row['id']."&es_param=\">".$lang['except_signup']."</button>";
}
echo "</tr>";
}
?>
</tbody>
</table>
<hr class="placeholder">
<button type="button" onclick="window.location='./users?export'"><?php echo $lang['export'] ?></button>
</div>