Advertisement
sb2014

ts3 api error entire page

Oct 12th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.00 KB | None | 0 0
  1. <?php
  2. if(!isset($_SESSION['ts3_id']) || !isset($_SESSION['ts3_ip']) || !isset($_SESSION['ts3_port']) || !isset($_SESSION['ts3_user']) || !isset($_SESSION['ts3_passwort']) || !isset($_SESSION['ts3_query_port']) || !isset($_SESSION['ts3_nickname']) || $_SESSION['ts3_id'] == "" || $_SESSION['ts3_ip'] == "" || $_SESSION['ts3_port'] == "" || $_SESSION['ts3_user'] == "" || $_SESSION['ts3_passwort'] == "" || $_SESSION['ts3_query_port'] == "" || $_SESSION['ts3_nickname'] == "") {
  3. fLog($db, $_SESSION['id'], $_SESSION['ip'], time(), "ts3_select", "Der Benutzer " . $_SESSION['email'] . " (" . $_SESSION['id'] . ") hatte keinen ts3 Server ausgewählt.", "user_false");
  4. echo "<meta http-equiv='refresh' content='0; URL=index.php?seite=ts3&alert=6'/>";
  5. die();
  6. }
  7. ?>
  8.  
  9. <?php
  10. $errorMessange = "";
  11. ?>
  12.  
  13. <!-- Content Wrapper. Contains page content -->
  14. <div class="content-wrapper">
  15. <!-- Content Header (Page header) -->
  16. <section class="content-header">
  17. <h1>
  18. <?= $titel; ?>
  19. </h1>
  20. <ol class="breadcrumb">
  21. <li><a href="#"><i class="fa fa-dashboard"></i> Level</a></li>
  22. <li class="active">Here</li>
  23. </ol>
  24. </section>
  25.  
  26. <!-- Main content -->
  27. <section class="content container-fluid">
  28. <?php
  29. if(isset($_POST['ts3_action'])){
  30. if($_POST['ts3_waehlen_action'] == "delete"){
  31.  
  32. require_once('programme/ts3phpframework-1.1.33/libraries/TeamSpeak3/TeamSpeak3.php');
  33. $server = array(
  34. "tsip" => $_SESSION['ts3_ip'],
  35. "tsport" => $_SESSION['ts3_port'],
  36. "ts_query_admin" => $_SESSION['ts3_user'],
  37. "ts_query_password" => pasent($_SESSION['ts3_passwort']),
  38. "ts_query_port" => $_SESSION['ts3_query_port'],
  39. "ts_query_user_nick" => $_SESSION['ts3_nickname']
  40. );
  41. try {
  42. TeamSpeak3::init();
  43. $ts3_server = TeamSpeak3::factory("serverquery://".$server["ts_query_admin"].":".$server["ts_query_password"]."@".$server["tsip"].":".$server["ts_query_port"]."/?server_port=".$server["tsport"]."&nickname=".$server["ts_query_user_nick"]."");
  44.  
  45. $ts3_server->privilegeKeyDelete($_POST['ts3_waehlen_id']);
  46.  
  47. if($_SESSION['ts3_slow'] == "true"){
  48. sleep(1);
  49. }
  50.  
  51. }catch(Exception $e){
  52. $errorId = $e->getCode();
  53. $errorMessange = $e->getMessage();
  54.  
  55. fLog($db, $_SESSION['id'], $_SESSION['ip'], time(), "ts3_ban_delete", "Der Benutzer " . $_SESSION['email'] . " (" . $_SESSION['id'] . ") konnte den Token (" . $_POST['ts3_waehlen_id'] . ") nicht löschen.", "user_false");
  56. echo "<meta http-equiv='refresh' content='0; URL=index.php?seite=ts3&alert=1000&ts3id=$errorId&ts3messange=$errorMessange'/>";
  57. echo die();
  58. }
  59. ?>
  60. <div class="alert alert-success alert-dismissible">
  61. <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
  62. <h4><i class="icon fa fa-check"></i> Alert!</h4>
  63. Token was deleted. You will be redirected to the Token page in 4 seconds!
  64. </div>
  65. <?php
  66. fLog($db, $_SESSION['id'], $_SESSION['ip'], time(), "ts3_token_delete", "Der Benutzer " . $_SESSION['email'] . " (" . $_SESSION['id'] . ") hat erfolgreich den Token (" . $_POST['ts3_waehlen_id'] . ") gelöscht.", "user_true");
  67. ?>
  68. <meta http-equiv='refresh' content='4' URL='index.php?seite=ts3_token'/>
  69. <?php
  70. }
  71. }
  72. ?>
  73.  
  74. <?php
  75. require_once('programme/ts3phpframework-1.1.33/libraries/TeamSpeak3/TeamSpeak3.php');
  76. $ts3_nickname = $_SESSION['ts3_nickname'] . "/DB";
  77. $server = array(
  78. "tsip" => $_SESSION['ts3_ip'],
  79. "tsport" => $_SESSION['ts3_port'],
  80. "ts_query_admin" => $_SESSION['ts3_user'],
  81. "ts_query_password" => pasent($_SESSION['ts3_passwort']),
  82. "ts_query_port" => $_SESSION['ts3_query_port'],
  83. "ts_query_user_nick" => $ts3_nickname
  84. );
  85.  
  86. $uri = "serverquery://".rawurlencode($server['ts_query_admin']).":".rawurlencode($server['ts_query_password'])."@".$server['tsip'].":".$server['ts_query_port']."/?server_port=".$server['tsport']."&nickname=".rawurlencode($server['ts_query_user_nick']);
  87.  
  88. try {
  89. TeamSpeak3::init();
  90. $ts3_server = TeamSpeak3::factory("$uri");
  91. $ts3_privilege_key_list = $ts3_server->privilegeKeyList(TRUE);
  92.  
  93. // foreach ($ts3_privilege_key_list as $ts3_privilege_key_lis) {
  94. // foreach ($ts3_privilege_key_lis as $key => $value) {
  95. // echo $key . " - " . $value . "<br>";
  96.  
  97. //if($key == "token"){
  98. //if(!isset($token)){
  99. //$token = array($value);
  100. //}else{
  101. //array_push($token, $value);
  102. //}
  103. //}
  104.  
  105. //if($key == "token_type"){
  106. //if(!isset($token_type)){
  107. //$token_type = array($value);
  108. //}else{
  109. //array_push($token_type, $value);
  110. //}
  111. //}
  112.  
  113. //if($key == "token_id1"){
  114. //if(!isset($token_id1)){
  115. //$token_id1 = array($value);
  116. //}else{
  117. //array_push($token_id1, $value);
  118. //}
  119. //}
  120.  
  121. //if($key == "token_id2"){
  122. //if(!isset($token_id2)){
  123. //$token_id2 = array($value);
  124. //}else{
  125. //array_push($token_id2, $value);
  126. //}
  127. //}
  128.  
  129. //if($key == "token_created"){
  130. //if(!isset($token_created)){
  131. //$token_created = array($value);
  132. //}else{
  133. //array_push($token_created, $value);
  134. //}
  135. //}
  136.  
  137. //if($key == "token_description"){
  138. //if(!isset($token_description)){
  139. //$token_description = array($value);
  140. //}else{
  141. //array_push($token_description, $value);
  142. //}
  143. //}
  144.  
  145. //}
  146. // echo "<br>";
  147. //}
  148.  
  149. }catch(Exception $e){
  150. $errorId = $e->getCode();
  151. $errorMessange = $e->getMessage();
  152.  
  153. if($errorMessange == "database empty result set"){
  154.  
  155. }else{
  156. echo "<meta http-equiv='refresh' content='0; URL=index.php?seite=ts3&alert=1000&ts3id=$errorId&ts3messange=$errorMessange'/>";
  157. echo die();
  158. }
  159. }
  160.  
  161. foreach ($ts3_privilege_key_list as $ts3_privilege_key_lis) {
  162. foreach ($ts3_privilege_key_lis as $key => $value) {
  163. switch ($key) {
  164. case "token":
  165. if(!isset($token)){
  166. $token = array($value);
  167. }else{
  168. array_push($token, $value);
  169. }
  170. continue;
  171. case "token_type":
  172. if(!isset($token_type)){
  173. $token_type = array($value);
  174. }else{
  175. array_push($token_type, $value);
  176. }
  177. continue;
  178. case "token_id1":
  179. if(!isset($token_id1)){
  180. $token_id1 = array($value);
  181. }else{
  182. array_push($token_id1, $value);
  183. }
  184. continue;
  185. case "token_id2":
  186. if(!isset($token_id2)){
  187. $token_id2 = array($value);
  188. }else{
  189. array_push($token_id2, $value);
  190. }
  191. continue;
  192. case "token_created":
  193. if(!isset($token_created)){
  194. $token_created = array($value);
  195. }else{
  196. array_push($token_created, $value);
  197. }
  198. continue;
  199. case "token_description":
  200. if(!isset($token_description)){
  201. $token_description = array($value);
  202. }else{
  203. array_push($token_description, $value);
  204. }
  205. continue;
  206. }
  207. }
  208. }
  209. ?>
  210.  
  211. <div class="box">
  212. <div class="box-header">
  213. <h3 class="box-title">Selected TeamSpeak3 Server</h3>
  214. </div>
  215. <!-- /.box-header -->
  216.  
  217. <div class="box-body">
  218. <div id="table-wrapper">
  219. <div id="table-scroll">
  220. <table id="example1" class="table table-bordered table-striped">
  221. <thead>
  222. <tr>
  223. <th>ID</th>
  224. <th>IP</th>
  225. <th>Port</th>
  226. <th>Query User</th>
  227. <th>Query Password</th>
  228. <th>Query Port</th>
  229. <th>Query Nickname</th>
  230. <th>Slow Mode</th>
  231. </tr>
  232. </thead>
  233. <tbody>
  234. <tr>
  235. <td><?= $_SESSION['ts3_id'] ?></td>
  236. <td><?= $_SESSION['ts3_ip'] ?></td>
  237. <td><?= $_SESSION['ts3_port'] ?></td>
  238. <td><?= $_SESSION['ts3_user'] ?></td>
  239. <!-- $_SESSION['ts3_passwort'] -->
  240. <td>****</td>
  241. <td><?= $_SESSION['ts3_query_port'] ?></td>
  242. <td><?= $_SESSION['ts3_nickname'] ?></td>
  243. <?php
  244. if($_SESSION['ts3_slow'] == "true"){
  245. echo "<td><span class='btn btn-success btn-sm'><i class='fa fa-check'></i></span></td>";
  246. }else{
  247. echo "<td><span class='btn btn-danger btn-sm'><i class='fa fa-close'></i></span></td>";
  248. }
  249. ?>
  250. </tr>
  251. </tbody>
  252. </table>
  253. </div>
  254. </div>
  255. </div>
  256. </div>
  257. <!-- /.box-body -->
  258.  
  259. <div class="box">
  260. <div class="box-header">
  261. <h3 class="box-title">Token (<?php if(isset($token)){echo count($token);}else{ echo 0;} ?>)</h3>
  262. </div>
  263. <!-- /.box-header -->
  264.  
  265. <div class="box-body">
  266. <div id="table-wrapper">
  267. <div id="table-scroll">
  268. <table id="example1" class="table table-bordered table-striped">
  269. <thead>
  270. <tr>
  271. <th>Schlüssel</th>
  272. <th>Type</th>
  273. <th>Gruppe</th>
  274. <th>Channel</th>
  275. <th>Created</th>
  276. <th>Description</th>
  277. <th>Delete</th>
  278. </tr>
  279. </thead>
  280. <tbody>
  281. <?php
  282. if(!isset($ts3_privilege_key_list)){
  283. echo "<tr><td>No Token found.</td></tr>";
  284. }else{
  285. for($i = 0; $i < count($token); $i ++){
  286. echo "<tr>";
  287. if(isset($token[$i])){
  288. if($token[$i] !== " "){
  289. echo "<td>" . $token[$i] . "</td>";
  290. }else{
  291. echo "<td></td>";
  292. }
  293. }else{
  294. echo "<td></td>";
  295. }
  296.  
  297. if(isset($token_type[$i])){
  298. if($token_type[$i] !== " "){
  299. echo "<td>" . $token_type[$i] . "</td>";
  300. }else{
  301. echo "<td></td>";
  302. }
  303. }else{
  304. echo "<td></td>";
  305. }
  306.  
  307. if(isset($token_id1[$i])){
  308. if($token_id1[$i] !== " "){
  309. echo "<td>" . $token_id1[$i] . "</td>";
  310. }else{
  311. echo "<td></td>";
  312. }
  313. }else{
  314. echo "<td></td>";
  315. }
  316.  
  317. if($token_type[$i] == 0){
  318. echo "<td></td>";
  319. }else{
  320. if(isset($token_id2[$i])){
  321. if($token_id2[$i] !== " "){
  322. echo "<td>" . $token_id2[$i] . "</td>";
  323. }else{
  324. echo "<td></td>";
  325. }
  326. }else{
  327. echo "<td></td>";
  328. }
  329. }
  330.  
  331. if(isset($token_created[$i])){
  332. if($token_created[$i] !== " "){
  333. $ts3_date_created = date('d.m.Y H:i:s', $token_created[$i]);
  334. echo "<td>" . $ts3_date_created . "</td>";
  335. }else{
  336. echo "<td></td>";
  337. }
  338. }else{
  339. echo "<td></td>";
  340. }
  341.  
  342. if(isset($token_description[$i])){
  343. if($token_description[$i] !== " "){
  344. echo "<td>" . $token_description[$i] . "</td>";
  345. }else{
  346. echo "<td></td>";
  347. }
  348. }else{
  349. echo "<td></td>";
  350. }
  351.  
  352. echo "<td>" . "
  353. <form role='form' action='index.php?seite=ts3_token' method='post'>
  354. <div class='form-group'>
  355. <input type='text' class='form-control unsichtbar' id='ts3_waehlen_action' name='ts3_waehlen_action' value='delete'>
  356. <input type='text' class='form-control unsichtbar' id='ts3_waehlen_id' name='ts3_waehlen_id' value='" . $token[$i] . "'>
  357. <button type='submit' name='ts3_action' class='btn btn-danger button_prosition'>Delete</button>
  358. </div>
  359. </form>
  360. " . "</td>";
  361.  
  362. echo "<tr>";
  363. }
  364. }
  365. ?>
  366. </tbody>
  367. <thead>
  368. <tr>
  369. <th>Schlüssel</th>
  370. <th>Type</th>
  371. <th>Gruppe</th>
  372. <th>Channel</th>
  373. <th>Created</th>
  374. <th>Description</th>
  375. <th>Delete</th>
  376. </tr>
  377. </thead>
  378. </table>
  379. </div>
  380. </div>
  381. </div>
  382. </div>
  383. <!-- /.box-body -->
  384.  
  385. <section class="content container-fluid rechts">
  386. <a href="index.php?seite=ts3_token_add"><button type="button" class="btn btn-block btn-primary klein">Add Token</button></a>
  387. </section>
  388.  
  389. </section>
  390. <!-- /.content -->
  391. </div>
  392. <!-- /.content-wrapper -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement