Просмотр файла znak_otzuv(mysql)/c.php

Размер файла: 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=\"&#1055;&#1091;&#1089;&#1090;&#1086;\"/></small><br/>";} else {
print "<img src=\"http://".$data['foto']."\" alt=\"".$data['nick']."\"/><br/>
<small><b>&#1043;&#1086;&#1083;&#1086;&#1089;&#1086;&#1074;:</b> ".$data['counter']."</small><br/>
<small><a href=\"votefoto.php?id=".$data['id']."\">&#1043;&#1086;&#1083;&#1086;&#1089; &#1079;&#1072; &#1092;&#1086;&#1090;&#1086;</a></small><br/>";}
print "<small><b>ID:</b> ".$data['id']."</small><br/>";
print "<small><b>&#1053;&#1080;&#1082;</b>: ".$data['nick']."</small><br/>";
print "<small><b>&#1048;&#1084;&#1103;:</b> ".$data['name']."</small><br/>";
print "<small><b>&#1043;&#1086;&#1088;&#1086;&#1076;:</b> ".$data['gorod']."</small><br/>";
print "<small><b>&#1044;&#1077;&#1085;&#1100; &#1074;&#1072;&#1088;&#1077;&#1085;&#1100;&#1103;</b>: ".$data['bday']."-".$data['bmonth']."-".$data['byear']."</small><br/>";
print "<small><b>&#1056;&#1086;&#1089;&#1090;:</b> ".$data['rost']."</small><br/>";
print "<small><b>&#1042;&#1077;&#1089;:</b> ".$data['ves']."</small><br/>";
print "<small><b>&#1054; &#1089;&#1077;&#1073;&#1077;</b>: ".$data['infa']."</small><br/>";
print "<small><b>&#1048;&#1097;&#1091; ".$data['ssex']." &#1076;&#1083;&#1103; ".$data['swhy']."</b></small><br/>";
print "<small><b>&#1053;&#1086;&#1084;&#1077;&#1088; &#1090;&#1077;&#1083;&#1077;&#1092;&#1086;&#1085;&#1072;:</b> ".$data['mob']."</small><br/>";
print "<small><b>e-mail:</b> ".$data['mail']."</small><br/>";
print "<small><a href=\"add.php?dir=".$data['nick']."&amp;pp=1\">&#1053;&#1072;&#1087;&#1080;&#1089;&#1072;&#1090;&#1100; &#1079;&#1072;&#1087;&#1080;&#1089;&#1082;&#1091;</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']."\">&#1063;&#1080;&#1090;&#1072;&#1090;&#1100; &#1079;&#1072;&#1087;&#1080;&#1089;&#1082;&#1080;[".$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&amp;page=$page_number\">[&#1089;&#1090;&#1088;.".($i+1)."]</a></small>";
} else {
print "<small><b>&#1089;&#1090;&#1088;.".($i+1)."</b></small>"; }
}
}

?>