Файл: world-faces.ru/world-faces.ru/sys/fnc/user_collision.php
Строк: 21
<?
function user_collision($massive, $im=0)
{
global $user;
$new=false;
for ($i=0;$i<count($massive);$i++)
{
$collision_q=mysql_query("SELECT * FROM `user_collision` WHERE `id_user` = '".$massive[$i]."' OR `id_user2` = '".$massive[$i]."'");
while ($collision = mysql_fetch_array($collision_q))
{
if ($collision['id_user']==$massive[$i])$coll=$collision['id_user2'];else $coll=$collision['id_user'];
$ank_coll2=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$coll' LIMIT 1"));
if (!in_array ($coll, $massive) && ($user['level']>$ank_coll2['level'] || $user['level']==4) && ($im==0 || $user['id']!=$ank_coll2['id'])) {
$massive[]=$coll;
$new=true;
}
}
}
if($new)$massive=user_collision($massive);
return $massive;
}
?>