<?php
require("mysql.php");
require_once 'filter.php';
$random = mysql_fetch_array(mysql_query("select id, name, gender, age, photoTitle, photo from accounts where photo != '' and name != 'James' and name != '".$_SESSION[foto]."' order by rand()"));
$rand = mysql_fetch_array(mysql_query("select * from accounts where id='".mysql_real_escape_string(utf8_decode((int)$_GET[n]))."'"));

$titel = 'Fotorating - Fotos';
$styles = '<link href="/sf/f/registration/registration.css" rel="stylesheet" type="text/css">
<link href="/sf/m/buttons/buttons.css" rel="stylesheet" type="text/css"><link href="/sf/f/index/index.css" rel="stylesheet" type="text/css"><link href="/sf/m/boxes/boxes.css" rel="stylesheet" type="text/css"><link href="/sf/f/photos/photos.css" rel="stylesheet" type="text/css"><link href="/sf/m/tables/tables.css" rel="stylesheet" type="text/css"><link href="/sf/f/photos/photos-rate.css" rel="stylesheet" type="text/css">
';
if($random[gender] == 1) {
$randomgeschlecht = '<img src="pics/male.png" style="display:inline;margin:-100px 0px -4px 0px">';
}elseif($random[gender] == 2) {
$randomgeschlecht = '<img src="pics/female.png" style="display:inline;margin:-100px 0px -3px 0px">';
}
$inhalt .= '
<div class="photo">
<div class="noh1"></div>
<div class="box">
<div class="hd">
<div class="tl"></div>
<div class="tr"></div>

<div class="tm"></div>
<div class="m"><div class="mi">

<div class="h h2"><div class="hbegin"></div><h2>Fotorating -

<a href="photos-profile.php?id='.$random[name].'">'.$random[name].'</a>

'.$randomgeschlecht.'
('.$random[age].')
</h2></div>
</div></div>
</div>
<div class="bd fade bd-fade">
<div class="m">
<div class="mi">
<div class="ratingbox">
<div class="image">
<div class="corner ctl"></div>
<div class="corner cbl"></div>
<div class="corner cbr"></div>
<div class="bounding">

<a href="photos-profile.php?id='.$random[name].'">

<img src="pics/photos/l/'.$random[photo].'.jpg" class="userimage large" />
</a>

</div>
<br class=""><br class="">
<div class="selfcomment">'.$random[photoTitle].'</div>
</div>
<div class="ratingform">
<div class="corner ctr"></div>
<div class="corner cbr"></div>
<div id="rating">';

for($i=0;$i <= 10;$i++) {
$inhalt .= '<a title="Foto mit '.$i.' bewerten" href="photos-rate?v='.$i.'&n='.$random[id].'" id="rate'.$i.'" class="rate'.$i.'"></a>';
}

$inhalt .= '<div class="link_remover">&nbsp;</div>
</div>
</div>
<div class="oldrating">
<div class="corner xtl"></div>
<div class="ratingdetail">
<div class="corner ctl"></div>
<div class="corner cbl"></div>
<div class="corner ctr"></div>
<div class="corner cbr"></div>
<div class="h h3"><div class="hbegin"></div><h3>Letztes Foto</h3></div>
';
if((int)$_GET[v] != '') {
if((int)$_GET[v] >= 0 && (int)$_GET[v] < 11 && !isset($_GET[w])) {
header("location:photos-rate?v=$_GET[v]&n=$rand[id]&w");
mysql_query("update accounts set photoRating=photoRating+'".(int)$_GET[v]."', photoRatingVotes=photoRatingVotes+'1' where name='".$rand[name]."'");
}

$inhalt .= '<div class="oldimage"> 
<a href="photos-profile.php?id='.$rand[name].'" class="nodecoration positioning"> 
<img src="pics/photos/m/'.$rand[photo].'.jpg" style="border:solid 1px #000" /> 
</a> 
<div class="prev_score">'.round($rand[photoRating]/$rand[photoRatingVotes], 1).'</div> 
</div> 
 
<div class="clear"></div> ';
mysql_query("update accounts set ratingZahl='".round($rand[photoRating]/$rand[photoRatingVotes], 1)."' where name='".$rand[name]."'");


}else{
$inhalt .= '<div class="not_rated">Du hast noch kein Foto bewertet.</div>';
}
$inhalt .= '

<div class="clear"></div>

</div>
</div>
</div>
<div class="clear"></div>
<br class="">
</div></div>
          <div class="bl"></div>
          <div class="br"></div>
          <div class="bm"></div>

         
        </div></div></div></div>
';
echo str_replace(array('<?url?>','<?inhalt?>', '<?titel?>', '<?fotonavi?>', '<?registrieren?>', '<?styles?>', '<?fotos?>'),array($_SERVER[SERVER_NAME], $inhalt, $titel, $fotonavi, $registrieren, $styles, $fotos),implode("",file("sf/b/style.tpl")));
?>    