Файл: modules/kabinet/set_friend.php
Строк: 121
<?php
########################################
## WAP-ENGINE ##
########################################
## ##
## Автор : CHUMA (Токарев Владимир) ##
## e-mail : crazychuma@gmail.com ##
## WAP : http://wap-engine.ru ##
## ##
########################################
## ВЫ НЕ ИМЕЕТЕ ПРАВО ##
## ИЗМЕНЯТЬ КОД СКРИПТА ##
## ДЛЯ ДАЛЬНЕЙШЕГО РАСПРОСТРАНЕНИЯ! ##
########################################
include ('../../config.php');
include ('../../templates/run.php');
include ('../../templates/func.php');
####################
if(isset($_SESSION['pass']) && isset($passw) && $_SESSION['pass'] == $passw)
{
if($_GET['act']=='del')
{
$friends_f = file('../../data/users/'.$login.'_friends.php');
$friends_count = count($friends_f);
$id = filter($_GET['id']);
$page = filter($_GET['page']);
for($i=2; $i < $friends_count - 2; $i++)
{
$friends[] = "$friends_f[$i]";
}
$fr_count = count($friends);
for($i=0; $i < $fr_count; $i++)
{
if($i != $id)
{
$fr_to_file .= trim($friends[$i])."rn";
}
}
$fr_to_file = trim($fr_to_file);
if(!empty($fr_to_file))
{ $fr_to_file = "rn".$fr_to_file; } else
{ $fr_to_file = ''; }
$friends_file = fopen("../../data/users/$login"."_friends.php","w");
flock ($friends_file,LOCK_EX);
fputs($friends_file,"<?phprn/*$fr_to_filern*/rn?>");
fflush ($friends_file);
flock ($friends_file,LOCK_UN);
fclose($friends_file);
header ("Location: friends.php?page=$page&".session_name()."=".session_id()."");
}
####################
if($_GET['act']=='add')
{
$friends_f = @file("../../data/users/$login"."_friends.php");
$friends_count = count($friends_f);
if(isset($_POST['kto']))
{
$kto = filter($_POST['kto']);
}
elseif(isset($_GET['kto']))
{
$kto = filter($_GET['kto']);
}
$nicks = file('../../data/nicks.php');
$count_nicks = count($nicks);
$count_nicks = $count_nicks - 2;
$user_est = 0;
for($i=2; $i <= $count_nicks; $i++)
{
if($kto == trim($nicks[$i]))
{
$user_est = 1;
break;
}
}
if(empty($kto))
{
header("Location: friends.php?err=1&".session_name()."=".session_id()."");
exit;
}
$drug_est = 0;
for($i=2; $i < $friends_count - 2; $i++)
{
if(strstr($friends_f[$i], "$kto"))
{
$drug_est = 1;
break;
}
else
{
$friends[] = "$friends_f[$i]";
}
}
if($kto == $login)
{
header("Location: friends.php?err=2&".session_name()."=".session_id()."");
exit;
}
elseif($user_est == 0)
{
header("Location: friends.php?err=3&".session_name()."=".session_id()."");
exit;
}
elseif($drug_est == 1)
{
header("Location: friends.php?err=4&".session_name()."=".session_id()."");
exit;
}
$fr_count = count($friends);
$fr_to_file = "$ktorn";
for($i=0; $i < $fr_count; $i++)
{
$fr_to_file .= trim($friends[$i])."rn";
}
$fr_to_file = trim($fr_to_file);
$friends_file = fopen("../../data/users/$login"."_friends.php","w");
flock ($friends_file,LOCK_EX);
fputs($friends_file,"<?phprn/*rn$fr_to_filern*/rn?>");
fflush ($friends_file);
flock ($friends_file,LOCK_UN);
fclose($friends_file);
header ("Location: friends.php?".session_name()."=".session_id()."");
}
####################
}
else
{
include ("../../themes/$themes.php");
echo"<p class="b">Вы не авторизованы!!! Войдите в личный кабинет.<br /></p>";
echo"<p><a href="index.php?".session_name()."=".session_id()."">В кабинет</a><br /></p>";
include ('../../templates/foot.php');
}
####################
?>