Файл: in4at/gallery.php
Строк: 136
<?php
##################################################################################################
## Script name : In4at ##
## Version : Final ##
## Made by : XPYCT(Сергей Мищенко) ##
## E-mail : bce-ok@bk.ru ##
## ICQ : 447-50-50-62 ##
## Site : http://vkontakte.ru/id31604521 ##
## Внимание! Скрипт распространяется бесплатно! Модификация W4at by XPYCT ##
##################################################################################################
define('REQ_2_chat', true);
require('4at_set.php');
require('db_con.php');
require('style.php');
if ($py !== spy_code) require('us_info.php');
$user=$row['user'];
echo head;
if ($vv!=0) echo '<div class="d0"><b>Фотогалерея!</b></div>';
else echo '<card id="index" title="Фотогалерея!"><p>';
echo $fsize1;
switch($mod) {
default:
echo '<b>Фотки юзеров чата!</b><br/>';
echo divide;
echo '<u>Самый красивый юзер:</u><br/>';
$resu = @mysql_query ("Select id,user,votefoto,img from users where img!='' order by votefoto desc limit 1");
while ($a2 = mysql_fetch_array($resu))
{
echo " <b>".$a2["user"]."</b><br/><a href="search.php?nk=".$a2['id']."&$wp&go=view"><img src="scr.php?img=".$a2['img']."&r=100" alt="фото"/></a><br/>";
}
echo divide;
if(!isset($r)) $r="50";
$querym = mysql_num_rows(mysql_query("select id from `users` where img!='' and sex ='1';"));
$queryf = mysql_num_rows(mysql_query("select id from `users` where img!='' and sex ='0';"));
$queryall = mysql_num_rows(mysql_query("select id from `users` where img!='';"));
echo "<a href="gallery.php?mod=foto&$wp&r=$r">Все фотки</a> ($queryall)<br/>";
echo "<a href="gallery.php?mod=foto&sex=m&$wp&r=$r">Парни</a> ($querym)<br/>";
echo "<a href="gallery.php?mod=foto&sex=f&$wp&r=$r">Девушки</a> ($queryf)<br/>";
echo divide;
$glob=glob("photos/*{.jpg,.gif}", GLOB_BRACE);
shuffle($glob);
echo 'Случайное фото:<br/>';
$l=preg_replace("/[^0-9]/","", $glob[0]);
$select = mysql_query("Select user from users where id = '".$l."'");
$a = mysql_fetch_array($select);
$who = $a['user'];
$img=str_replace("photos/","", $glob[0]);
echo '<a href="'.$glob[0].'"><img src="scr.php?img='.$img.'&r='.$r.'" alt=""/></a> ';
echo "<a href="search.php?go=view&$wp&nk=$l">$who</a><br/>";
echo divide;
echo 'Предпросмотр:<br/>';
echo $fsize2;
if ($vv!=0) echo "<form action="gallery.php?$wp" method="post">";
echo "<select name="r">n";
echo "<option value="0">Без предпросмотра</option>n";
echo "<option value="30">30*30</option>n";
echo "<option value="50">50*50</option>n";
echo "<option value="100">100*100</option>n";
echo "<option value="150">150*150</option>n";
echo "</select>";
if ($vv!=0){
echo " <input class="ibutton" type="submit" value="Ok"/></form>";
echo $fsize1;
} else {
echo $fsize1;
echo " <anchor title="go">Ok<go href="gallery.php?$wp" method="post">";
echo "<postfield name="r" value="$(r)"/>";
echo '</go></anchor><br/>';
}
echo divide;
echo "<a href="cabinet.php?go=foto&$wp">Добавить/изменить свое фото</a><br/>";
echo "<a href="add_album.php?$wp">Фото в альбом</a><br/>";
break;
case 'foto':
if(empty($page)) $page=0;
if ($sex=='m') $query = mysql_query("select id from `users` where img!='' and sex ='1';");
elseif ($sex=='f') $query = mysql_query("select id from `users` where img!='' and sex ='0';");
else $query = mysql_query("select id from `users` where img!='';");
$num_of_rows=mysql_num_rows($query);
$total_mat_number=$num_of_rows;
$max = 10;
$total_pages=ceil($total_mat_number/$max);
if ($sex=='m') $print = mysql_query("select id,user,img,votefoto from `users` where img!='' and sex ='1' order by votefoto desc limit ".$page.",".($max).";");
elseif ($sex=='f') $print = mysql_query("select id,user,img,votefoto from `users` where img!='' and sex ='0' order by votefoto desc limit ".$page.",".($max).";");
else $print = mysql_query("select id,user,img,votefoto from `users` where img!='' order by votefoto desc limit ".$page.",".($max).";");
$i = 1+$page;
while($arr = mysql_fetch_array($print)) {
$usid=$arr['id'];
echo ($i++).") <a href="photos/".$arr['img']."">".$arr['user']."</a> (".$arr['votefoto'].")<br/>";
if ($r!=0) echo "<img src="scr.php?img=$arr[img]&r=$r" alt=""/> ";
echo "<a href="search.php?go=view&$wp&nk=$usid">Анкета</a>|";
$kol=mysql_num_rows(mysql_query("select id from photos where uid='$usid';"));
echo '<a href="album.php?'.$wp.'&mod=view&uid='.$usid.'">Альбом ['.$kol.']</a><br/>';
if ($id!=$usid) echo "<a href="gallery.php?mod=votes&$wp&usid=$usid">Голосовать!</a><br/>";
else echo "<a href="cabinet.php?go=golos&$wp">Голоса за вас</a><br/>";
if (($id == 11)||($id == 22)){
echo "<a href="gallery.php?mod=admin&$wp&nk=$usid">Изменить</a><br/>";
}
echo divide;
}
for ($num=0;$num<$total_pages;$num++){
$page_number=$num*$max;
if ($page_number!=$page) {
echo "<a href="gallery.php?$wp&mod=$mod&sex=$sex&page=$page_number&r=$r">".($num+1)."</a>|";
} else {
echo "".($num+1)."|";
}
}
echo '<br/>';
break;
case 'votes':
$query = mysql_query("select user,img,votefoto,user_soft,user_ip from `users` where id = '".$usid."' LIMIT 1");
if (mysql_affected_rows() == 0) {
echo '<b>Нет такого юзера!</b><br/>';
echo $fsize2;
echo foot;
mysql_close ($link);
exit;
}
$arr = mysql_fetch_array($query);
$agent = $HTTP_USER_AGENT;
$addr = $REMOTE_ADDR;
if (($id==$usid) or ($agent==$arr['user_soft'] and $addr==$arr['user_ip'])){
echo '<b>За себя Вы не можете голосовать!</b><br/>';
}else{
mysql_query("Select * from golos where user='".$usid."' and who='".$id."'");
if (mysql_affected_rows() == 0) {
$q = mysql_query("select user,votefoto from users where id='".$usid."';");
$data = mysql_fetch_array($q);
$counter = $data['votefoto'];
$login = $data['user'];
$counter2 = $counter+1;
mysql_query("update users set votefoto='".$counter2."' where id='".$usid."';");
mysql_query("INSERT INTO golos SET user = '".$usid."', who = '".$id."'");
echo '<b>Ваш голос принят!</b><br/>';
} else {
echo '<b>Вы уже голосовали за это фото. Голос не принят.</b><br/>';
}
}
break;
case 'admin':
if($row['level'] < 7) {
echo '<b>У вac нeт пpaв дocтyпa!</b><br/>';
echo $fsize2;
echo foot;
mysql_close ($link);
exit;
}
$result = mysql_query("select id,user,img,votefoto from users where id = '".$nk."' LIMIT 1;");
if (mysql_affected_rows() == 0) {
echo '<b>Нет такого юзера!</b><br/>';
echo $fsize2;
echo foot;
mysql_close ($link);
exit;
}
$infoto = mysql_fetch_array($result);
$golosov = $infoto["votefoto"];
echo 'ID: '.$infoto['id'].'<br/>';
echo 'Ник: '.$infoto['user'].'<br/>';
echo "<a href="gallery.php?mod=view&$wp&nk=$nk">Голосов за фото:</a><br/>";
echo $fsize2;
if ($vv!=0) echo "<form action="gallery.php?mod=edit&$wp&nk=$nk" method="post">";
echo "<input name="votefoto$ref" value="$golosov" title="votes"/><br/>n";
if ($vv!=0){
echo " <input class="ibutton" type="submit" value="Ok"/></form>";
echo $fsize1;
} else {
echo $fsize1;
echo "<anchor title="go">Изменить!<go href="gallery.php?mod=edit&$wp" method="post">n";
echo "<postfield name="nk" value="$nk"/>n";
echo "<postfield name="votefoto" value="$(votefoto$ref)"/>n";
echo '</go></anchor><br/>';
}
echo divide;
echo "<a href="apanel.php?go=delfoto&$wp&usid=$nk">Удалить фото!</a><br/>";
break;
case 'view':
if($row['level'] < 7) {
echo '<b>У вac нeт пpaв дocтyпa!</b><br/>';
echo $fsize2;
echo foot;
mysql_close ($link);
exit;
}
if(empty($page)) $page=0;
$query = mysql_query("select id from golos where user='".$nk."';");
$num_of_rows=mysql_num_rows($query);
$total_mat_number=$num_of_rows;
$max = 10;
$total_pages=ceil($total_mat_number/$max);
$print = mysql_query("select * from golos where user='".$nk."' order by who desc limit ".$page.",".($max).";");
$i = 1+$page;
while($arr = mysql_fetch_array($print)) {
$usid=$arr['who'];
$whogolos = mysql_query("select user from users where id=".$usid.";");
$idatas = mysql_fetch_array($whogolos);
$login=$idatas['user'];
echo ($i++).") <a href="search.php?go=view&$wp&nk=$usid">".$login."</a><br/>";
}
echo divide;
for ($num=0;$num<$total_pages;$num++){
$page_number=$num*$max;
if ($page_number!=$page) {
echo "<a href="gallery.php?mod=view&$wp&page=$page_number&nk=$nk">".($num+1)."</a>|";
} else {
echo "".($num+1)."|";
}
}
echo '<br/>';
break;
case 'edit':
if($row['level'] < 7) {
echo '<b>У вac нeт пpaв дocтyпa!</b><br/>';
echo $fsize2;
echo foot;
mysql_close ($link);
exit;
}
$votefoto = intval($votefoto);
mysql_query("update users set votefoto='".$votefoto."' where id='".$nk."' LIMIT 1;");
echo '<b>Успешно обновлено!</b><br/>';
break;
}
echo divide;
if($mod) echo "<a href="gallery.php?$wp">Назад</a><br/>";
echo '<a href="enter.php?'.$wp.'">Пpuxoжaя</a><br/>';
echo $fsize2;
echo foot;
mysql_close ($link);
?>