Advertisement
zegige

index.php

Dec 28th, 2011
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.38 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. include('mysql.php');
  5. include('functions.php');
  6.  
  7.  
  8. // Get random 2
  9. $query="SELECT * FROM images ORDER BY RAND() LIMIT 0,2";
  10. $result = @mysql_query($query);
  11.  
  12. while($row = mysql_fetch_object($result)) {
  13.     $images[] = (object) $row;
  14. }
  15.  
  16.  
  17. // Get the top10
  18. $result = mysql_query("SELECT *, ROUND(score/(1+(losses/wins))) AS performance FROM images ORDER BY ROUND(score/(1+(losses/wins))) DESC LIMIT 0,10");
  19. while($row = mysql_fetch_object($result)) $top_ratings[] = (object) $row;
  20.  
  21.  
  22. // Close the connection
  23. mysql_close();
  24.  
  25.  
  26. ?>
  27. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  28. <html xmlns="http://www.w3.org/1999/xhtml">
  29. <head>
  30. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  31. <title>title_add_here</title>
  32. <style type="text/css">
  33.  
  34. body, html {font-family:Arial, Helvetica, sans-serif;width:100%;margin:0;padding:0;text-align:center;}
  35. h1 {background-color:#600;color:#fff;padding:20px 0;margin:0;}
  36. a img {border:0;}
  37. td {font-size:11px;}
  38. .image {background-color:#eee;border:1px solid #ddd;border-bottom:1px solid #bbb;padding:5px;}
  39.  
  40. </style>
  41. <script type="text/javascript">
  42.  
  43.   var _gaq = _gaq || [];
  44.   _gaq.push(['_setAccount', 'UA-25273091-1']);
  45.   _gaq.push(['_trackPageview']);
  46.  
  47.   (function() {
  48.     var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  49.     ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  50.     var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  51.   })();
  52.  
  53. </script>
  54. </head>
  55.  
  56. <body>
  57.  
  58.  
  59. <h1>website_name/url</h1>
  60. <h2>arvizturotukorfurogep_vagy_arvizturotukorfurogep</h2>
  61.  
  62. <center>
  63. <table>
  64.     <tr>
  65.         <td valign="top" class="image"><a href="rate.php?winner=<?=$images[0]->image_id?>&loser=<?=$images[1]->image_id?>"><img src="images/<?=$images[0]->filename?>" /></a></td>
  66.         <td valign="top" class="image"><a href="rate.php?winner=<?=$images[1]->image_id?>&loser=<?=$images[0]->image_id?>"><img src="images/<?=$images[1]->filename?>" /></a></td>
  67.     </tr>
  68.     <tr>
  69.         <td>Won: <?=$images[0]->wins?>, Lost: <?=$images[0]->losses?></td>
  70.         <td>Won: <?=$images[1]->wins?>, Lost: <?=$images[1]->losses?></td>
  71.     </tr>
  72.     <tr>
  73.         <td>Score: <?=$images[0]->score?></td>
  74.         <td>Score: <?=$images[1]->score?></td>
  75.     </tr>
  76.     <tr>
  77.         <td>Expected: <?=round(expected($images[1]->score, $images[0]->score), 4)?></td>
  78.         <td>Expected: <?=round(expected($images[0]->score, $images[1]->score), 4)?></td>
  79.     </tr>
  80. </table>
  81. </center>
  82.  
  83. <h2>top_csajok</h2>
  84. <center>
  85. <table>
  86.     <tr>
  87.         <? foreach($top_ratings as $key => $image) : ?>
  88.         <td valign="top"><img src="images/<?=$image->filename?>" width="70" /></td>
  89.         <? endforeach ?>
  90.     </tr>
  91.     <? /* Remove this to see the scoring
  92.     <tr>
  93.         <? foreach($top_ratings as $key => $image) : ?>
  94.         <td valign="top">Score: <?=$image->score?></td>
  95.         <? endforeach ?>
  96.     </tr>
  97.     <tr>
  98.         <? foreach($top_ratings as $key => $image) : ?>
  99.         <td valign="top">Performance: <?=$image->performance?></td>
  100.         <? endforeach ?>
  101.     </tr>
  102.     <tr>
  103.         <? foreach($top_ratings as $key => $image) : ?>
  104.         <td valign="top">Won: <?=$image->wins?></td>
  105.         <? endforeach ?>
  106.     </tr>
  107.     <tr>
  108.         <? foreach($top_ratings as $key => $image) : ?>
  109.         <td valign="top">Lost: <?=$image->losses?></td>
  110.         <? endforeach ?>
  111.     </tr>
  112.     */ ?>
  113. </table>
  114. </center>
  115. </body>
  116. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement