Файл: index.php
Строк: 101
<?php
include('mysql.php');
include('functions.php');
// Get random 2
$query="SELECT * FROM images ORDER BY RAND() LIMIT 0,2";
$result = @mysql_query($query);
while($row = mysql_fetch_object($result)) {
$images[] = (object) $row;
}
// Get the top10
$result = mysql_query("SELECT *, ROUND(score/(1+(losses/wins))) AS performance FROM images ORDER BY ROUND(score/(1+(losses/wins))) DESC LIMIT 0,10");
while($row = mysql_fetch_object($result)) $top_ratings[] = (object) $row;
// Close the connection
mysql_close();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Фото онлайн Битва</title>
<style type="text/css">
body, html {font-family:Arial, Helvetica, sans-serif;width:100%;margin:0;padding:0;text-align:center;}
h1 {background-color:#0033CC;color:#fff;padding:20px 0;margin:0;}
a img {border:0;}
td {font-size:11px;}
.image {background-color:#eee;border:1px solid #ddd;border-bottom:1px solid #bbb;padding:5px;}
</style>
<script type="text/javascript">var switchTo5x=true;</script>
<script type="text/javascript">stLight.options({publisher: "1c0c5da1-0f9d-4687-863d-999cfea82bc6", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script>
</head>
<body>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<?php include("main.php"); ?>
<center>
<table>
<tr>
<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>
<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>
</tr>
<tr>
<td style='text-align:center;'>Выйграно: <?=$images[0]->wins?>, Проиграно: <?=$images[0]->losses?></td>
<td style='text-align:center;'>Выйграно: <?=$images[1]->wins?>, Проиграно: <?=$images[1]->losses?></td>
</tr>
<tr>
<td style='text-align:center;'>Score: <?=$images[0]->score?></td>
<td style='text-align:center;'>Score: <?=$images[1]->score?></td>
</tr>
<tr>
<td style='text-align:center;'>Expected: <?=round(expected($images[1]->score, $images[0]->score), 4)?></td>
<td style='text-align:center;'>Expected: <?=round(expected($images[0]->score, $images[1]->score), 4)?></td>
</tr>
</table>
<div class="share42init"></div>
<script type="text/javascript" src="/share42/share42.js"></script>
</center>
<h2 style="font-family:calibri; font-size: 32px"><font color="#99FFCC">Самые популярные</font></h2>
<center>
<table>
<tr>
<? foreach($top_ratings as $key => $image) : ?>
<td valign="top"><img src="images/<?=$image->filename?>" width="70" /></td>
<? endforeach ?>
</tr>
<tr>
<? foreach($top_ratings as $key => $image) : ?>
<td valign="top">Балы: <?=$image->score?></td>
<? endforeach ?>
</tr>
<tr>
<? foreach($top_ratings as $key => $image) : ?>
<td valign="top">Набрано: <?=$image->performance?></td>
<? endforeach ?>
</tr>
<tr>
<? foreach($top_ratings as $key => $image) : ?>
<td valign="top">Выиграно: <?=$image->wins?></td>
<? endforeach ?>
</tr>
<tr>
<? foreach($top_ratings as $key => $image) : ?>
<td valign="top">Проиграно: <?=$image->losses?></td>
<? endforeach ?>
</tr>
</table>
</br>
</center>
</body>
</html>