File size: 3.16Kb
<?php
$hostname = "mysqlserver";
$user = "masnetru_znak";
$password = "222222";
$db = "masnetru_znak";
$main_name= "Mas.Net.Ru";
$main_link= "http://mas.net.ru";
mysql_connect($hostname, $user, $password);
mysql_select_db ($db);
///////////////////////
function print_data($sex_data, $komu_data, $page)
{
if(empty($page)) $page=0;
$query=mysql_query("SELECT `id` FROM `users` where sex='$sex_data';");
$num_of_rows=mysql_num_rows($query);
$total_mat_number=$num_of_rows;
$mat_per_page=4;
$total_pages=ceil($total_mat_number/$mat_per_page);
$print = mysql_query("select * from `users` where sex='$sex_data' and counter>0 order by counter desc limit ".$page.", ".($mat_per_page).";");
while($data=mysql_fetch_array($print))
{
if($data['foto']==""){print "<small><img src=\"no.gif\" alt=\"Пусто\"/></small><br/>";} else {
print "<img src=\"http://".$data['foto']."\" alt=\"".$data['nick']."\"/><br/>
<small><b>Голосов:</b> ".$data['counter']."</small><br/>
<small><a href=\"votefoto.php?id=".$data['id']."\">Голос за фото</a></small><br/>";}
print "<small><b>ID:</b> ".$data['id']."</small><br/>";
print "<small><b>Ник</b>: ".$data['nick']."</small><br/>";
print "<small><b>Имя:</b> ".$data['name']."</small><br/>";
print "<small><b>Город:</b> ".$data['gorod']."</small><br/>";
print "<small><b>День варенья</b>: ".$data['bday']."-".$data['bmonth']."-".$data['byear']."</small><br/>";
print "<small><b>Рост:</b> ".$data['rost']."</small><br/>";
print "<small><b>Вес:</b> ".$data['ves']."</small><br/>";
print "<small><b>О себе</b>: ".$data['infa']."</small><br/>";
print "<small><b>Ищу ".$data['ssex']." для ".$data['swhy']."</b></small><br/>";
print "<small><b>Номер телефона:</b> ".$data['mob']."</small><br/>";
print "<small><b>e-mail:</b> ".$data['mail']."</small><br/>";
print "<small><a href=\"add.php?dir=".$data['nick']."&pp=1\">Написать записку</a></small><br/>";
$lnak_count = @mysql_query("SELECT count(*) FROM `otziv` WHERE komu='".$data['nick']."';");
$ldc = @mysql_fetch_array($lnak_count);
$lncount = $ldc['count(*)'];
$lnak_regs = @mysql_query("select count(*) from `otziv`;");
$lregs = @mysql_fetch_array($lnak_regs);
print "<small><a href=\"letter.php?komu=".$data['nick']."\">Читать записки[".$ldc['count(*)']."]</a></small><br/>";
print "<small>*****</small><br/>";
}
for ($i=0; $i<$total_pages; $i++){
$page_number=$i*$mat_per_page;
if ($page_number!=$page) {
print "<small><a href=\"znak.php?sex=$sex_data&page=$page_number\">[стр.".($i+1)."]</a></small>";
} else {
print "<small><b>стр.".($i+1)."</b></small>"; }
}
}
?>