PageRenderTime 42ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/userstats.php

https://bitbucket.org/stavrossk/openmaidos
PHP | 69 lines | 56 code | 6 blank | 7 comment | 18 complexity | 3a9615f9401b72dc88e682c5be42a809 MD5 | raw file
  1. <?php
  2. require_once('functions.php');
  3. require_once('authentication.php');
  4. require_once('maintenance.php');
  5. include('header.php');
  6. $u = Authenticate();
  7. global $db_host;
  8. global $db_user;
  9. global $db_pass;
  10. global $db_database;
  11. @mysql_connect($db_host, $db_user, $db_pass) or slowDie("Error connecting to sql " . $db_user );
  12. @mysql_select_db($db_database) or slowDie("Error connecting to db");
  13. //Added way to vote without using ajax (robogeek)
  14. if ($_GET["mode"] == "vote") {
  15. //confirm profil_id
  16. if ($u == null || $u !== $_GET['profile_id']) die("Are you trying to hack the vote?");
  17. //confirm plugin_id and plugin_version
  18. $getPluginId = $_GET['plugin_id'];
  19. $getPluginVersion = $_GET['plugin_version'];
  20. $res = mysql_query("SELECT * FROM plugins WHERE plugin_ID='$getPluginId' AND plugin_Version='$getPluginVersion'");
  21. $numrows = mysql_numrows($res);
  22. if ($numrows <> 1) die("Are you scamming an old or non-existant plugin?");
  23. //confirm vote
  24. $v = $_GET['vote'];
  25. if ($v == null || $v == "") die("You forgot to vote?");
  26. if ($v !== "true" && $v !== "false") die("Invalid vote");
  27. VoteWorking($_GET['profile_id'], $getPluginId, $getPluginVersion, $v, null);
  28. }
  29. $res = mysql_query("SELECT plugin_ID, plugin_Name, plugin_Author, max(plugin_Date) as maxdate FROM plugins WHERE plugin_ReviewFlag = 'FALSE' GROUP BY plugin_ID ORDER BY maxdate desc LIMIT 10");
  30. while (($enreg=@mysql_fetch_array($res)))
  31. ////////////////////////////////////////////////////////////////////////////////
  32. echo "<table border=0 cellpadding=0 cellspacing=0 width=600>";
  33. //Your last 10 downloads
  34. echo "<br><p><h1 id='title'>Your Last 10 Downloads:</b><br><br>";
  35. $where = "WHERE download_profil_id='$u'";
  36. if ($u == "binary64") $where = "";
  37. $res = mysql_query("SELECT * FROM userdownloads $where ORDER BY download_Date DESC LIMIT 0,10");
  38. while (($enreg=@mysql_fetch_array($res)))
  39. {
  40. $plugin_id = $enreg["plugin_ID"];
  41. $plugin_version = $enreg["plugin_Version"];
  42. $plugin_date = $enreg["plugin_Date"];
  43. $profil_id = $enreg["profil_id"];
  44. //is vote still latest version?
  45. $res2 = mysql_query("SELECT * FROM plugins WHERE plugin_ID='$plugin_id' and plugin_Version='$plugin_version'");
  46. $enreg2 = @mysql_fetch_array($res2);
  47. if ($enreg2["plugin_Version"] == $plugin_version)
  48. {
  49. echo "<tr>";
  50. echo "<td id=\"pluginicon\" align='center' valign='center' width=130>\n";
  51. echo "<a href='detail.php?plugin_id=$plugin_id$breadcrumb'>\n";
  52. $plugin_directory = "$plugin_home_directory/$plugin_id/$plugin_version/$plugin_state";
  53. echo "<img src='" . GetPluginIcon($plugin_id,$plugin_version) . "' width='80' height='80'><br>\n"; //width=100 height=100
  54. echo "</a></td>";
  55. echo "<td id=\"plugininfos\">";
  56. echo "<a href=\"detail.php?plugin_id=" . $enreg2["plugin_ID"] . "\"><b>" . $enreg2["plugin_Name"] . "</b></a> by <a href=\"thelist.php?author=" . urlencode($enreg2["plugin_Author"]) . "\"><i>" . $enreg2["plugin_Author"] . "</i></a> ";
  57. VoteWorking($u, $plugin_id, $plugin_version, "", "userstats.php?");
  58. echo "</td>";
  59. echo "<tr height='10'/>";
  60. }
  61. }
  62. echo "</table>"
  63. ?>