Просмотр файла vavok-1.5.3/adminpanel/addban.php

Размер файла: 9.02Kb
  1. <?php
  2. // (c) vavok.net
  3. require_once"../include/startup.php";
  4.  
  5. if (!empty($_GET['action'])) {
  6. $action = check($_GET["action"]);
  7. } else {
  8. $action = '';
  9. }
  10. if (isset($_POST['users'])) {
  11. $user = check($_POST['users']);
  12. } elseif (isset($_GET['users'])) {
  13. $user = check($_GET['users']);
  14. } else { $user = ''; }
  15.  
  16. $time = time();
  17.  
  18. if (!$users->is_reg()) { redirect_to("../?error"); }
  19.  
  20. if ($_SESSION['permissions'] == 101 || $_SESSION['permissions'] == 102 || $_SESSION['permissions'] == 103) {
  21. $my_title = $lang_admin['banning'];
  22. require_once BASEDIR . "themes/" . MY_THEME . "/index.php";
  23.  
  24. echo '<img src="../images/img/partners.gif" alt=""> <b>' . $lang_admin['banunban'] . '</b><br /><br />';
  25.  
  26. if (empty($action)) {
  27. echo $lang_admin['chooseuser'] . ':<br />';
  28.  
  29. echo '<form method="post" action="addban.php?action=edit">';
  30. echo '<input name="users" maxlength="20" /><br /><br />';
  31. echo '<input value="' . $lang_home['confirm'] . '" type="submit" /></form><hr>';
  32. }
  33. // edit profile
  34. if ($action == "edit") {
  35. if (!empty($user)) {
  36. if (ctype_digit($user) === false) {
  37. $userx_id = $users->getidfromnick($user);
  38. $users_nick = $users->getnickfromid($userx_id);
  39. } else {
  40. $userx_id = $user;
  41. $users_nick = $users->getnickfromid($user);
  42. }
  43.  
  44. $show_user = $db->get_data('vavok_users', "id='" . $userx_id . "'", 'banned, perm');
  45. $show_prof = $db->get_data('vavok_profil', "uid='" . $userx_id . "'", 'bantime, bandesc, allban, lastban');
  46.  
  47. $user = check($user);
  48. if ($userx_id != "" && $users_nick != "") {
  49. echo '<img src="../images/img/profiles.gif" alt=""> <b>Profile of member ' . $users_nick . '</b><br /><br />'; // update lang
  50. echo 'Bans: <b>' . (int)$show_prof['allban'] . '</b><br />'; // update lang
  51. if (ctype_digit($show_prof['lastban'])) {
  52. echo '' . $lang_admin['lastban'] . ': ' . date_fixed(check($show_prof['lastban']), "j.m.y/H:i") . '<br />';
  53. }
  54.  
  55. echo '<br />';
  56.  
  57. if ($show_user['perm'] >= 101 && $show_user['perm'] <= 105 && $user != $users->show_username()) {
  58. echo $lang_admin['noauthtoban'] . '<br /><br />';
  59. } else {
  60. if ($user == $users->show_username()) {
  61. echo '<b><font color="#FF0000">' . $lang_admin['myprofile'] . '!</font></b><br /><br />';
  62. }
  63.  
  64. if ($show_prof['bantime'] > 0) {
  65. $ost_time = round($show_prof['bantime'] - $time);
  66. } else { $ost_time = $time; }
  67.  
  68. if ($show_user['banned'] < 1 || $show_prof['bantime'] < $time) {
  69. echo '<form method="post" action="addban.php?action=banuser&amp;users=' . $users_nick . '">';
  70. echo $lang_admin['banduration'] . ':<br /><input name="duration" /><br />';
  71.  
  72. echo '<input name="bform" type="radio" value="min" checked> ' . $lang_admin['minutes'] . '<br />';
  73. echo '<input name="bform" type="radio" value="chas"> ' . $lang_admin['hours'] . '<br />';
  74. echo '<input name="bform" type="radio" value="sut"> ' . $lang_admin['days'] . '<br />';
  75.  
  76. echo $lang_admin['bandesc'] . ':<br /><textarea name="udd39" cols="25" rows="3"></textarea><br />';
  77. echo '<input value="' . $lang_home['confirm'] . '" type="submit"></form><hr>';
  78.  
  79. echo $lang_admin['maxbantime'] . ' ' . formattime(round($config["maxBanTime"] * 60)) . '<br />';
  80. echo $lang_admin['bandesc1'] . '<br />';
  81. } else {
  82. echo '<b><font color="#FF0000">' . $lang_admin['confban'] . '</font></b><br />';
  83. if (ctype_digit($show_prof['lastban'])) {
  84. echo '' . $lang_admin['bandate'] . ': ' . date_fixed($show_prof['lastban']) . '<br />';
  85. }
  86. echo $lang_admin['banend'] . ' ' . formattime($ost_time) . '<br />';
  87. echo $lang_admin['bandesc'] . ': ' . check($show_prof['bandesc']) . '<br />';
  88. // echo 'Kaznio: <a href="../pages/user.php?uz=' . check($udc[63]) . '&amp;' . SID . '">' . check($udc[63]) . '</a><br /><br />';
  89. echo '<a href="addban.php?action=deleteban&amp;users=' . $user . '" class="btn btn-outline-primary sitelink">' . $lang_admin['delban'] . '</a><hr>';
  90. }
  91. }
  92. } else {
  93. echo '' . $lang_admin['usrnoexist'] . '!<br />';
  94. }
  95. } else {
  96. echo '' . $lang_admin['nousername'] . '!<br />';
  97. }
  98.  
  99. }
  100.  
  101. if ($action == "banuser") {
  102. $bform = check($_POST['bform']);
  103. $udd38 = check($_POST['duration']);
  104. $users_id = $users->getidfromnick($user);
  105. $udd39 = check($_POST['udd39']);
  106.  
  107. if ($users_id != "") {
  108. if ($bform == "min") {
  109. $ban_time = $udd38;
  110. }
  111. if ($bform == "chas") {
  112. $ban_time = round($udd38 * 60);
  113. }
  114. if ($bform == "sut") {
  115. $ban_time = round($udd38 * 60 * 24);
  116. }
  117.  
  118. if ($ban_time != "") {
  119. if ($ban_time <= $config["maxBanTime"]) {
  120. if ($udd39 != "") {
  121. $newbantime = round($time + ($ban_time * 60));
  122. $newbandesc = no_br(check($udd39), ' ');
  123. $newlastban = $time;
  124.  
  125. $vavok_profil = $db->get_data('vavok_users', "uid='" . $users_id . "'", 'allban');
  126. $newallban = $vavok_profil['allban'];
  127. $newallban = $newallban + 1;
  128.  
  129. $db->update('vavok_users', 'banned', 1, "id='" . $users_id . "'");
  130.  
  131. $fields = array('bantime', 'bandesc', 'lastban', 'allban');
  132. $values = array($newbantime, $newbandesc, $newlastban, $newallban);
  133. $db->update('vavok_profil', $fields, $values, "uid='" . $users_id . "'");
  134.  
  135. echo $lang_admin['usrdata'] . ' ' . $user . ' ' . $lang_admin['edited'] . '!<br />';
  136. echo '<b><font color="FF0000">' . $lang_admin['confban'] . '</font></b><br /><br />';
  137.  
  138. echo'<a href="addban.php" class="btn btn-outline-primary sitelink">' . $lang_home['back'] . '</a><br />';
  139. } else {
  140. echo '' . $lang_admin['noreason'] . '!<br />';
  141. }
  142. } else {
  143. echo '' . $lang_admin['maxbantimeare'] . ' ' . round($config["maxBanTime"] / 1440) . ' ' . $lang_admin['days'] . '!<br />';
  144. }
  145. } else {
  146. echo '' . $lang_admin['nobantime'] . '!<br />';
  147. }
  148. } else {
  149. echo $lang_admin['usrnoexist'] . '!<br />';
  150. }
  151. echo'<br /><a href="addban.php?action=edit&amp;users=' . $user . '" class="btn btn-outline-primary sitelink">' . $lang_home['back'] . '</a>';
  152. }
  153.  
  154. if ($action == "deleteban") {
  155. $users_id = $users->getidfromnick($user);
  156.  
  157. if ($users_id != "") {
  158. // update changes
  159. $vavok_binfo = $db->get_data('vavok_profil', "uid='" . $users_id . "'", 'allban');
  160. $newallban = $vavok_binfo['allban'];
  161. if ($newallban > 0) {
  162. $newallban = $newallban--;
  163. }
  164.  
  165. $db->update('vavok_users', 'banned', 0, "id='" . $users_id . "'");
  166.  
  167. $fields = array('bantime', 'bandesc', 'allban');
  168. $values = array(0, '', $newallban);
  169. $db->update('vavok_profil', $fields, $values, "uid='" . $users_id . "'");
  170.  
  171. echo $lang_admin['usrdata'] . ' ' . $user . ' ' . $lang_admin['edited'] . '!<br />';
  172. echo '<b><font color="00FF00">' . $lang_admin['confUnBan'] . '</font></b><br /><br />';
  173.  
  174. echo'<a href="addban.php" class="btn btn-outline-primary sitelink">' . $lang_admin['changeotheruser'] . '</a><br />';
  175. } else {
  176. echo'' . $lang_home['usrnoexist'] . '!<br />';
  177. }
  178. echo'<br /><a href="addban.php?action=edit&amp;users=' . $user . '" class="btn btn-outline-primary sitelink">' . $lang_home['back'] . '</a>';
  179. }
  180. // delete user
  181. if ($action == "deluser") {
  182. $user = check($user);
  183. $users->delete_user($user);
  184.  
  185. echo '' . $lang_admin['usrdeleted'] . '!<br />';
  186.  
  187. echo '<br /><a href="addban.php" class="btn btn-outline-primary sitelink">' . $lang_home['back'] . '</a>';
  188. }
  189.  
  190. echo '<br /><a href="index.php" class="btn btn-outline-primary sitelink">' . $lang_home['admpanel'] . '</a><br />';
  191. echo '<a href="../" class="btn btn-primary homepage">' . $lang_home['home'] . '</a><br />';
  192. } else {
  193. redirect_to("../?error");
  194. }
  195.  
  196. require_once BASEDIR . "themes/" . MY_THEME . "/foot.php";
  197.  
  198. ?>