PageRenderTime 77ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/admin/findnotconnectable.php

https://github.com/Bigjoos/U-232-V1
PHP | 144 lines | 112 code | 24 blank | 8 comment | 22 complexity | 9fe56bd312604b914f80a848d3c95e50 MD5 | raw file
  1. <?php
  2. /**
  3. * https://09source.kicks-ass.net:8443/svn/installer09/
  4. * Licence Info: GPL
  5. * Copyright (C) 2010 Installer09 v.1
  6. * A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon.
  7. * Project Leaders: Mindless,putyn,kidvision.
  8. **/
  9. if ( ! defined( 'IN_TBDEV_ADMIN' ) )
  10. {
  11. $HTMLOUT='';
  12. $HTMLOUT .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
  13. \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
  14. <html xmlns='http://www.w3.org/1999/xhtml'>
  15. <head>
  16. <title>Error!</title>
  17. </head>
  18. <body>
  19. <div style='font-size:33px;color:white;background-color:red;text-align:center;'>Incorrect access<br />You cannot access this file directly.</div>
  20. </body></html>";
  21. print $HTMLOUT;
  22. exit();
  23. }
  24. require_once(INCL_DIR.'user_functions.php');
  25. require_once(INCL_DIR.'torrenttable_functions.php');
  26. $lang = array_merge( $lang, load_language('non_con') );
  27. $HTMLOUT ='';
  28. require_once(INCL_DIR.'class_check.php');
  29. class_check(UC_STAFF);
  30. if (isset($_GET["action1"]) && $_GET["action1"] == "list") {
  31. $res2 = sql_query("SELECT userid, seeder, torrent, agent FROM peers WHERE connectable='no' ORDER BY userid DESC") or sqlerr();
  32. $HTMLOUT .="<h3><a href='staffpanel.php?tool=findnotconnectable&amp;action=findnotconnectable&amp;action1=sendpm'>{$lang['non_con_sendall']}</a></h3>
  33. <h3><a href='staffpanel.php?tool=findnotconnectable&amp;action=findnotconnectable'>{$lang['non_con_view']}</a></h3>
  34. <h1>{$lang['non_con_peers']}</h1>
  35. {$lang['non_con_this']}<br /><p><font color='red'>*</font> {$lang['non_con_means']}<br />";
  36. $result = sql_query("select distinct userid from peers where connectable = 'no'");
  37. $count = mysql_num_rows($result);
  38. $HTMLOUT .="$count {$lang['non_con_unique']}</p>";
  39. @mysql_free_result($result);
  40. if (mysql_num_rows($res2) == 0)
  41. $HTMLOUT .="<p align='center'><b>{$lang['non_con_all']}</b></p>\n";
  42. else {
  43. $HTMLOUT .="<table border='1' cellspacing='0' cellpadding='5'>\n";
  44. $HTMLOUT .="<tr><td class='colhead'>{$lang['non_con_name']}</td><td class='colhead'>{$lang['non_con_tor']}</td><td class='colhead'>{$lang['non_con_client']}</td></tr>\n";
  45. while ($arr2 = mysql_fetch_assoc($res2)) {
  46. $r2 = sql_query("SELECT username FROM users WHERE id=$arr2[userid]") or sqlerr();
  47. $a2 = mysql_fetch_assoc($r2);
  48. $HTMLOUT .="<tr><td><a href='userdetails.php?id=$arr2[userid]'>$a2[username]</a></td><td align='left'><a href='details.php?id=$arr2[torrent]&amp;dllist=1#seeders'>$arr2[torrent]</a>";
  49. if ($arr2['seeder'] == 'yes')
  50. $HTMLOUT .="<font color='red'>*</font>";
  51. $HTMLOUT .="</td><td align='left'>".$arr2['agent']."</td></tr>\n";
  52. }
  53. $HTMLOUT .="</table>\n";
  54. }
  55. }
  56. if ($_SERVER["REQUEST_METHOD"] == "POST") {
  57. $dt = sqlesc(time());
  58. $msg = $_POST['msg'];
  59. if (!$msg)
  60. stderr("Error", "Please Type In Some Text");
  61. $query = sql_query("SELECT distinct userid FROM peers WHERE connectable='no'");
  62. while ($dat = mysql_fetch_assoc($query)) {
  63. $subject = "Connectability";
  64. mysql_query("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES (0,$dat[userid] , '" . time() . "', " . sqlesc($msg) . ", " . sqlesc($subject) . ")") or sqlerr(__FILE__, __LINE__);
  65. }
  66. mysql_query("INSERT INTO notconnectablepmlog ( user , date ) VALUES ( $CURUSER[id], $dt)") or sqlerr(__FILE__, __LINE__);
  67. header("Refresh: 0; url=staffpanel.php?tool=findnotconnectable");
  68. }
  69. if (isset($_GET["action1"]) && $_GET["action1"] == "sendpm") {
  70. $HTMLOUT .="<table class='main' width='750' border='0' cellspacing='0' cellpadding='0'><tr><td class='embedded'>
  71. <div align='center'>
  72. <h1>{$lang['non_con_mass']}</h1>
  73. <form method='post' action='staffpanel.php?tool=findnotconnectable&amp;action=findnotconnectable'>";
  74. if (isset($_GET["returnto"]) || isset($_SERVER["HTTP_REFERER"])) {
  75. $HTMLOUT .="<input type='hidden' name='returnto' value='".(isset($_GET["returnto"]) ? $_GET["returnto"] : $_SERVER["HTTP_REFERER"])."' />";
  76. }
  77. $receiver = '';
  78. // default message
  79. $body = "{$lang['non_con_body']}";
  80. $HTMLOUT .="<table cellspacing='0' cellpadding='5'>
  81. <tr>
  82. <td>{$lang['non_con_sendall']}<br />
  83. <table style='border: 0' width='100%' cellpadding='0' cellspacing='0'>
  84. <tr>
  85. <td style='border: 0'>&nbsp;</td>
  86. <td style='border: 0'>&nbsp;</td>
  87. </tr>
  88. </table>
  89. </td>
  90. </tr>
  91. <tr><td><textarea name='msg' cols='120' rows='15'>$body</textarea></td></tr>
  92. <tr><td colspan='2' align='center'><input type='submit' value='Send' class='btn'/></td></tr>
  93. </table>
  94. <input type='hidden' name='receiver' value='$receiver'/>
  95. </form>
  96. </div></td></tr></table>
  97. <br />
  98. NOTE: No HTML Code Allowed. (NO HTML)
  99. ";
  100. }
  101. if (isset($_GET["action1"]) == "") {
  102. $getlog = sql_query("SELECT * FROM `notconnectablepmlog` ORDER BY date DESC LIMIT 20");
  103. $HTMLOUT .="<h1>{$lang['non_con_uncon']}</h1>
  104. <h3><a href='staffpanel.php?tool=findnotconnectable&amp;action=findnotconnectable&amp;action1=sendpm'>{$lang['non_con_sendall']}</a></h3>
  105. <h3><a href='staffpanel.php?tool=findnotconnectable&amp;action=findnotconnectable&amp;action1=list'>{$lang['non_con_list']}</a></h3><p>
  106. <br />{$lang['non_con_please1']}<br /></p>
  107. <table border='1' cellspacing='0' cellpadding='5'>\n
  108. <tr><td class='colhead'>{$lang['non_con_by']}</td>
  109. <td class='colhead'>{$lang['non_con_date']}</td><td class='colhead'>{$lang['non_con_elapsed']}</td></tr>";
  110. while ($arr2 = mysql_fetch_assoc($getlog)) {
  111. $r2 = sql_query("SELECT username FROM users WHERE id=$arr2[user]") or sqlerr();
  112. $a2 = mysql_fetch_assoc($r2);
  113. $elapsed = get_date( $arr2['date'],'',0,1);
  114. $HTMLOUT .="<tr><td class='colhead'><a href='userdetails.php?id=".$arr2['user']."'>".$a2['username']."</a></td><td class='colhead'>" . get_date($arr2['date'], '') . "</td><td>$elapsed</td></tr>";
  115. }
  116. $HTMLOUT .="</table>";
  117. }
  118. print stdhead() . $HTMLOUT . stdfoot();
  119. die();
  120. ?>