PageRenderTime 46ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/dead/my2.php

https://bitbucket.org/nexea/x00n
PHP | 171 lines | 162 code | 9 blank | 0 comment | 0 complexity | cb60acc1af9cbc09d1bd424c48eb7be6 MD5 | raw file
Possible License(s): GPL-2.0
  1. <?
  2. require_once("include/bittorrent.php");
  3. dbconn(false);
  4. loggedinorreturn();
  5. $res = mysql_query("SELECT COUNT(*) FROM messages WHERE receiver=" . $CURUSER["id"] . " AND location IN ('in', 'both')") or print(mysql_error());
  6. $arr = mysql_fetch_row($res);
  7. $messages = $arr[0];
  8. $res = mysql_query("SELECT COUNT(*) FROM messages WHERE receiver=" . $CURUSER["id"] . " AND location IN ('in', 'both') AND unread='yes'") or print(mysql_error());
  9. $arr = mysql_fetch_row($res);
  10. $unread = $arr[0];
  11. $res = mysql_query("SELECT COUNT(*) FROM messages WHERE sender=" . $CURUSER["id"] . " AND location IN ('out', 'both')") or print(mysql_error());
  12. $arr = mysql_fetch_row($res);
  13. $outmessages = $arr[0];
  14. stdhead($CURUSER["username"] . "'s private page", false);
  15. if ($_GET["edited"]) {
  16. print("<h1>Profile updated!</h1>\n");
  17. if ($_GET["mailsent"])
  18. print("<h2>Confirmation email has been sent!</h2>\n");
  19. }
  20. elseif ($_GET["emailch"])
  21. print("<h1>Email address changed!</h1>\n");
  22. else
  23. print("<h1>Welcome, <a href=userdetails.php?id=$CURUSER[id]>$CURUSER[username]</a>!</h1>\n");
  24. ?>
  25. <table border="1" cellspacing="0" cellpadding="10" align="center">
  26. <tr>
  27. <td align="center" width="33%"><a href=logout.php><b>Logout</b></a></td>
  28. <td align="center" width="33%"><a href=mytorrents.php><b>My torrents</b></a></td>
  29. <td align="center" width="33%"><a href=friends.php><b>My users lists</b></a></td>
  30. </tr>
  31. <tr>
  32. <td colspan="3">
  33. <form method="post" action="takeprofedit.php">
  34. <table border="1" cellspacing=0 cellpadding="5" width="100%">
  35. <?
  36. /***********************
  37. $res = mysql_query("SELECT COUNT(*) FROM ratings WHERE user=" . $CURUSER["id"]);
  38. $row = mysql_fetch_array($res);
  39. tr("Ratings submitted", $row[0]);
  40. $res = mysql_query("SELECT COUNT(*) FROM comments WHERE user=" . $CURUSER["id"]);
  41. $row = mysql_fetch_array($res);
  42. tr("Written comments", $row[0]);
  43. ****************/
  44. $ss_r = mysql_query("SELECT * from stylesheets") or die;
  45. $ss_sa = array();
  46. while ($ss_a = mysql_fetch_array($ss_r))
  47. {
  48. $ss_id = $ss_a["id"];
  49. $ss_name = $ss_a["name"];
  50. $ss_sa[$ss_name] = $ss_id;
  51. }
  52. ksort($ss_sa);
  53. reset($ss_sa);
  54. while (list($ss_name, $ss_id) = each($ss_sa))
  55. {
  56. if ($ss_id == $CURUSER["stylesheet"]) $ss = " selected"; else $ss = "";
  57. $stylesheets .= "<option value=$ss_id$ss>$ss_name</option>\n";
  58. }
  59. $countries = "<option value=0>---- None selected ----</option>\n";
  60. $ct_r = mysql_query("SELECT id,name FROM countries ORDER BY name") or die;
  61. while ($ct_a = mysql_fetch_array($ct_r))
  62. $countries .= "<option value=$ct_a[id]" . ($CURUSER["country"] == $ct_a['id'] ? " selected" : "") . ">$ct_a[name]</option>\n";
  63. function format_tz($a)
  64. {
  65. $h = floor($a);
  66. $m = ($a - floor($a)) * 60;
  67. return ($a >= 0?"+":"-") . (strlen(abs($h)) > 1?"":"0") . abs($h) .
  68. ":" . ($m==0?"00":$m);
  69. }
  70. tr("Accept PMs",
  71. "<input type=radio name=acceptpms" . ($CURUSER["acceptpms"] == "yes" ? " checked" : "") . " value=yes>All (except blocks)
  72. <input type=radio name=acceptpms" . ($CURUSER["acceptpms"] == "friends" ? " checked" : "") . " value=friends>Friends only
  73. <input type=radio name=acceptpms" . ($CURUSER["acceptpms"] == "no" ? " checked" : "") . " value=no>Staff only"
  74. ,1);
  75. tr("Delete PMs", "<input type=checkbox name=deletepms" . ($CURUSER["deletepms"] == "yes" ? " checked" : "") . "> (Default value for \"Delete PM on reply\")",1);
  76. tr("Save PMs", "<input type=checkbox name=savepms" . ($CURUSER["savepms"] == "yes" ? " checked" : "") . "> (Default value for \"Save PM to Sentbox\")",1);
  77. $r = mysql_query("SELECT id,name FROM categories ORDER BY name") or mysql_error();
  78. //$categories = "Default browsing categories:<br>\n";
  79. if (mysql_num_rows($r) > 0)
  80. {
  81. $categories .= "<table><tr>\n";
  82. $i = 0;
  83. while ($a = mysql_fetch_assoc($r))
  84. {
  85. $categories .= ($i && $i % 2 == 0) ? "</tr><tr>" : "";
  86. $categories .= "<td class=bottom style='padding-right: 5px'><input name=cat$a[id] type=\"checkbox\" " . (strpos($CURUSER['notifs'], "[cat$a[id]]") !== false ? " checked" : "") . " value='yes'>&nbsp;" . htmlspecialchars($a["name"]) . "</td>\n";
  87. ++$i;
  88. }
  89. $categories .= "</tr></table>\n";
  90. }
  91. tr("Email notification", "<input type=checkbox name=pmnotif" . (strpos($CURUSER['notifs'], "[pm]") !== false ? " checked" : "") . " value=yes> Notify me when I have received a PM<br>\n" .
  92. "<input type=checkbox name=emailnotif" . (strpos($CURUSER['notifs'], "[email]") !== false ? " checked" : "") . " value=yes> Notify me when a torrent is uploaded in one of <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; my default browsing categories.\n"
  93. , 1);
  94. tr("Browse default<br>categories",$categories,1);
  95. tr("Stylesheet", "<select name=stylesheet>\n$stylesheets\n</select>",1);
  96. tr("Country", "<select name=country>\n$countries\n</select>",1);
  97. tr("My avatar", "URL: <input name=avatar size=45 value=\"" . htmlspecialchars($CURUSER["avatar"]) .
  98. "\"><br>\n<font class=small size=1>Width should be 150 pixels (will be resized if necessary).\n<br>If you need a host for the picture, try the <a href=bitbucket-upload.php>bit-bucket</a>.</font><br><input type=checkbox name=avataroffensive value='yes'>This avatar may be offensive to some people<br><font class=small size=1>Please check this box if your avatar depicts nudity, or may<br>otherwise be potentially offensive or unsuitable for minors.</font>",1);
  99. tr("Show avatars", "<input type=radio name=avatars" . ($CURUSER["avatars"] == "yes" ? " checked" : "") . "> All<br><input type=radio name=avatars" . ($CURUSER["avatars"] == "yes" ? " checked" : "") . "> All except potentially offensive<br><input type=radio name=avatars" . ($CURUSER["avatars"] == "yes" ? " checked" : "") . "> None<br>",1);
  100. tr("Torrents per page", "<input type=text size=10 name=torrentsperpage value=$CURUSER[torrentsperpage]> (0=use default setting)",1);
  101. tr("Topics per page", "<input type=text size=10 name=topicsperpage value=$CURUSER[topicsperpage]> (0=use default setting)",1);
  102. tr("Posts per page", "<input type=text size=10 name=postsperpage value=$CURUSER[postsperpage]> (0=use default setting)",1);
  103. tr("Info", "<textarea name=info cols=50 rows=4>" . $CURUSER["info"] . "</textarea><br>Displayed on your public page. May contain <a href=tags.php target=_new>BB codes</a>.", 1);
  104. tr("Email address", "<input type=\"text\" name=\"email\" size=50 value=\"" . htmlspecialchars($CURUSER["email"]) . "\" />", 1);
  105. print("<tr><td colspan=\"2\" align=left><b>Note:</b> In order to change your email address, you will receive another<br>confirmation email to your new address.</td></tr>\n");
  106. tr("Change password", "<input type=\"password\" name=\"chpassword\" size=\"50\" />", 1);
  107. tr("Type password again", "<input type=\"password\" name=\"passagain\" size=\"50\" />", 1);
  108. function priv($name, $descr) {
  109. global $CURUSER;
  110. if ($CURUSER["privacy"] == $name)
  111. return "<input type=\"radio\" name=\"privacy\" value=\"$name\" checked=\"checked\" /> $descr";
  112. return "<input type=\"radio\" name=\"privacy\" value=\"$name\" /> $descr";
  113. }
  114. /* tr("Privacy level", priv("normal", "Normal") . " " . priv("low", "Low (email address will be shown)") . " " . priv("strong", "Strong (no info will be made available)"), 1); */
  115. ?>
  116. <tr><td colspan="2" align="center"><input type="submit" value="Submit changes!" style='height: 25px'> <input type="reset" value="Revert changes!" style='height: 25px'></td></tr>
  117. </table>
  118. </form>
  119. </td>
  120. </tr>
  121. </table>
  122. <?
  123. if ($messages){
  124. print("<p>You have $messages message" . ($messages != 1 ? "s" : "") . " ($unread new) in your <a href=inbox.php><b>inbox</b></a>,<br>\n");
  125. if ($outmessages)
  126. print("and $outmessages message" . ($outmessages != 1 ? "s" : "") . " in your <a href=inbox.php?out=1><b>sentbox</b></a>.\n</p>");
  127. else
  128. print("and your <a href=inbox.php?out=1>sentbox</a> is empty.</p>");
  129. }
  130. else
  131. {
  132. print("<p>Your <a href=inbox.php>inbox</a> is empty, <br>\n");
  133. if ($outmessages)
  134. print("and you have $outmessages message" . ($outmessages != 1 ? "s" : "") . " in your <a href=inbox.php?out=1><b>sentbox</b></a>.\n</p>");
  135. else
  136. print("and so is your <a href=inbox.php?out=1>sentbox</a>.</p>");
  137. }
  138. print("<p><a href=users.php><b>Find User/Browse User List</b></a></p>");
  139. stdfoot();
  140. ?>