Просмотр файла index.php

Размер файла: 31.27Kb
<?php include "cfg.php";

print $header;
if($form=='') {print '<div class="top">Знакомства!! </div>';
$filedir2=array("photo", "video");
  for ($ii=0; $ii<count($filedir2); $ii++)
  {
$dir = opendir ("upload/$filedir2[$ii]/"); 
 
  while ($fs = readdir ($dir)) 
{if (( $fs != ".") && ($fs != "..") && ($fs != ".htaccess"))
 {
   $figa[]=$fs;}}
 closedir ($dir);
 for ($i=0; $i<count($figa); $i++) {
   $dir = opendir ("upload/$filedir2[$ii]/$figa[$i]"); 
 if(!empty($dir)) {
  $ext=0; while ($fs = readdir ($dir)) 
{if (( $fs != ".") && ($fs != "..") && ($fs != ".htaccess"))
 {
  $ext = explode('.',$fs);
$ext = $ext[count($ext)-1];
 if($ext!='dat') { $fig[]=$fs;}}}
 closedir ($dir);  
if(empty($dir)) { $ch=0;}  else {$ch=count($fig);}

 if($filedir2[$ii]=='photo') { $f='jpg'; $fn='фоток';} 
if($filedir2[$ii]=='video') { $f='3gp';  $fn='видюшек';} 
}  print '||Всего ваших '.$fn.' : '.$ch.'<br/>'; $ch=0; $fig=''; $figa='';} }
$dir = opendir ("all_users/"); 
$fig=0;$fs=0;
 
  $ext=0; while ($fs = readdir ($dir)) 
{if (( $fs != ".") && ($fs != "..") && ($fs != ".htaccess"))
 {

 $figs[]=$fs ;}}
 closedir ($dir); 

print '||Всего пользователей: '.count($figs).'<br/>';
//////////////////////////////////////////////
print '<div class="text"></div>';

$dir = opendir ("all_users"); 
 while ($f = readdir ($dir)) 
{if (( $f != ".") && ($f != "..") && ($f != ".htaccess"))
 {
 $ext = explode('.',$f);
$ext = $ext[count($ext)-2];
$figr[]=date("d.m.Y - H:i",filemtime('all_users/'.$f)).'||'.$f; 
}}
if(count($figr)!=0) {
  closedir ($dir);
  $randintval = rand(0,count($figr)-1);
list($DATE,$figr[$randintval]) = explode('||',$figr[$randintval]);
 print $DATE.'<br/>';
$file=@file("all_users/$figr[$randintval]");
$totalw = count($file);
$totalw=$totalw-1;
$d = explode("||",$file[$totalw]);

print $d[1].'('.$d[3].')| '.$d[5].'<br/>'.$d[11].'<a href="ankety.php?start='.$start.'&amp;nik='.$nik.'&amp;pass='.$pass.'&amp;komy='.$d[1].'">...</a>
<br/>[<a href="pochta.php?nik='.$nik.'&amp;pass='.$pass.'&amp;komy='.$d[1].'">написать</a>]';
$dirjpg = opendir ("upload/photo/$d[1]"); 
if(!empty($dirjpg)) {
 print '[<a href="fallery.php?nik='.$nik.'&amp;pass='.$pass.'&amp;f=jpg&amp;komy='.$d[1].'">фотки</a>]';}
 $dir3gp = opendir ("upload/video/$d[1]"); 
if(!empty($dir3gp)) {
print '[<a href="fallery.php?nik='.$nik.'&amp;pass='.$pass.'&amp;f=3gp&amp;komy='.$d[1].'">видюшки</a>]';}print '<div class="text"></div>';
}

////////////////////////////////////////////////////

print '<form method="post" action="index.php?form=kabinet">';
print 'Ник:<br/> <input type="text" name="nik" value="" maxlength="20" size="20"  /><br/> 
Пароль:<br/> <input type="password" name="pass" value="" maxlength="20" size="20" /><br/>';
print '<input type="submit" value="Вход" /></form>';
print '<a href="index.php?form=anketaADD">Добавить анкету</a><br/>
';
print '? Добавив свою анкету вы сможете общаться с другими пользователями, смотреть их анкеты, добавлять свои фото и видео';}

if($form=='anketaADD') {print '<form method="post" action="index.php?form=anketaADDend">';
print 'Ник:<br/> <input type="text" name="nik" value="" maxlength="20" size="20"  /><br/> 
Пароль:<br/> <input type="password" name="pass" value="" maxlength="20" size="20" /><br/>';
print 'Кто ты?<br/> <select name="who_you" ><option value="1">Парень</option><option value="2">Девушка</option></select>
<br/>Имя:<br/> <input type="text" name="name" value="" maxlength="20" size="20" /><br/>

День рождения:<br/>'; 
 print '<select name="day" >'; 
for ($i=1; $i<32; $i++){ print '<option value="'.$i.'">'.$i.'</option>';}
 print '</select>'; 
print '<select name="mounth" >'; 
for ($i=1; $i<13; $i++){ print '<option value="'.$i.'">'.$i.'</option>';}
 print '</select>'; 
print '<select name="year" >'; for ($i=1970; $i<2007; $i++){ print '<option value="'.$i.'">
'.$i.'</option>';}
 print '</select><br/>';  

$znak=array("Овен","Телец","Близнецы","Рак","Лев","Дева","Весы","Скорпион","Стрелец","Козерог","Водолей","Рыба");
print 'Рост:<br/><input type="text" name="rost" value="" maxlength="20" size="20" /><br/> Знак зодиака:<br/>
<select name="Znak">';
 for ($i=0; $i<count($znak); $i++){ print '<option value="'.$znak[$i].'">'.$znak[$i].'</option>';}

print '</select><br/>
Цвет глаз:<br/><input type="text" name="color_aes" value="" maxlength="20" size="20" /><br/>
Город:<br/><input type="text" name="city" value="" maxlength="20" size="20" /><br/>
Как вас найти(ICQ, E-mail)?:<br/><input type="text" name="poisk" value="" maxlength="20" size="20" /><br/>
О себе:<br/><input type="text" name="o_sebe" value="" maxlength="20" size="20" /><br/>
Зачем вам это?:<br/><input type="text" name="zachem" value="" maxlength="20" size="20" /><br/>';
print '<input type="submit" value="Готово" /></form>';}

if($form=='anketaADDend') { 

if(empty($nik)) {print 'Вы не ввели ник<br/>'; $err='ok';}
if(empty($pass)){print 'Вы не ввели пароль<br/>'; $err='ok';}

if(empty($who_you)){print 'Вы не выбрали "Кто вы?" <br/>'; $err='ok';}

if(empty($name)){print 'Вы не ввели имя<br/>'; $err='ok';}

if((empty($day))or(empty($mounth))or(empty($year)))  {print 'Вы не ввели День рождения<br/>'; $err='ok';}

if(empty($rost)) {print 'Вы не ввели рост<br/>'; $err='ok';}

if(empty($Znak)) {print 'Вы не Выбрали знак зодиака<br/>'; $err='ok';}

if(empty($color_aes)){print 'Вы не ввели цвет глаз<br/>'; $err='ok';}

if(empty($city)){print 'Вы не ввели город<br/>'; $err='ok';}

if(empty($o_sebe)){print 'Вы не ввели О себе<br/>'; $err='ok';}

if(empty($poisk)){print 'Вы не ввели Как вас найти<br/>'; $err='ok';}

if(empty($zachem)) {print 'Вы не ввели зачем вам это<br/>'; $err='ok';}
 
$nik = substr($HTTP_POST_VARS["nik"],0,32);
$nik = htmlspecialchars(stripslashes($nik));
$pass = substr($HTTP_POST_VARS["pass"],0,32);
$pass = htmlspecialchars(stripslashes($pass));
$who_you = substr($HTTP_POST_VARS["who_you"],0,32);
$who_you = htmlspecialchars(stripslashes($who_you));
$name = substr($HTTP_POST_VARS["name"],0,32);
$name = htmlspecialchars(stripslashes($name));
$rost = substr($HTTP_POST_VARS["rost"],0,32);
$rost = htmlspecialchars(stripslashes($rost));
$day = substr($HTTP_POST_VARS["day"],0,32);
$day = htmlspecialchars(stripslashes($day));
$mounth = substr($HTTP_POST_VARS["mounth"],0,32);
$mounth = htmlspecialchars(stripslashes($mounth));
$year = substr($HTTP_POST_VARS["year"],0,32);
$year = htmlspecialchars(stripslashes($year));
$Znak = substr($HTTP_POST_VARS["Znak"],0,32);
$Znak = htmlspecialchars(stripslashes($Znak));
$color_aes = substr($HTTP_POST_VARS["color_aes"],0,32);
$color_aes = htmlspecialchars(stripslashes($color_aes));
$city = substr($HTTP_POST_VARS["city"],0,32);
$city = htmlspecialchars(stripslashes($city));
$poisk = substr($HTTP_POST_VARS["poisk"],0,32);
$poisk = htmlspecialchars(stripslashes($poisk));
$o_sebe = substr($HTTP_POST_VARS["o_sebe"],0,32);
$o_sebe = htmlspecialchars(stripslashes($o_sebe));
$zachem = substr($HTTP_POST_VARS["zachem"],0,32);
$zachem = htmlspecialchars(stripslashes($zachem));


if($err=='ok'){print 'Вернитесь <a href="index.php?form=anketaADD">назад</a> и введите корректные данные'; }


if($Znak=='1')

$file = @file("all_users/$pass.$nik.cvs","w"); 
if(!empty($file)) {print 'Такой пользователель уже зарегистрирован<br/>';


print 'Вернитесь <a href="index.php?form=anketaADD">назад</a> и введите Другой Ник'; $err='ok'; }

if(!eregi("([a-zA-Z0-9-])\$",$nik)) {print 'Ник должен быть на латинице<br/>'; $err='ok';}
if(!eregi("([a-zA-Z0-9-])\$",$pass)) {print 'Пароль должен быть на латинице<br/>'; $err='ok';}


 $nik = strip_tags($nik);
$nik = trim($nik);
  $nik=str_replace("$","",$nik);
 $nik=str_replace("quot;","",$nik);
            $nik=str_replace("$","",$nik);
            $nik=str_replace("&lt;","",$nik);
            $nik=str_replace("<","",$nik);
            $nik=str_replace(">","",$nik);
            $nik=str_replace("&gt;","",$nik);
            $nik=str_replace("\"","",$nik);
            $nik=str_replace("'","",$nik);
            $nik=str_replace("\\","",$nik);
            $nik=str_replace("&","",$nik);
             $nik=str_replace("%","",$nik);
              
            $nik=str_replace("@","",$nik);
            $nik=str_replace("^","",$nik);
            $nik=str_replace("*","",$nik);
            $nik=str_replace(")","",$nik);
            $nik=str_replace("(","",$nik);
            $nik=str_replace("|","",$nik);
            $nik=str_replace("!","",$nik);
            $nik=str_replace("№","",$nik);
            $nik=str_replace(";","",$nik);
            $nik=str_replace("/","",$nik);
            $nik=str_replace("{","",$nik);
            $nik=str_replace("}","",$nik);
            $nik=str_replace("[","",$nik);
            $nik=str_replace("]","",$nik);
            $nik=str_replace("#","",$nik);
            $pass = strip_tags($pass);
$pass = trim($pass);
  $pass=str_replace("$","",$pass);
 $pass=str_replace("quot;","",$pass);
            $pass=str_replace("$","",$pass);
            $pass=str_replace("&lt;","",$pass);
            $pass=str_replace("<","",$pass);
            $pass=str_replace(">","",$pass);
            $pass=str_replace("&gt;","",$pass);
            $pass=str_replace("\"","",$pass);
            $pass=str_replace("'","",$pass);
            $pass=str_replace("\\","",$pass);
            $pass=str_replace("&","",$pass);
             $pass=str_replace("%","",$pass);
              
            $pass=str_replace("@","",$pass);
            $pass=str_replace("^","",$pass);
            $pass=str_replace("*","",$pass);
            $pass=str_replace(")","",$pass);
            $pass=str_replace("(","",$pass);
            $pass=str_replace("|","",$pass);
            $pass=str_replace("!","",$pass);
            $pass=str_replace("№","",$pass);
            $pass=str_replace(";","",$pass);
            $pass=str_replace("/","",$pass);
            $pass=str_replace("{","",$pass);
            $pass=str_replace("}","",$pass);
            $pass=str_replace("[","",$pass);
            $pass=str_replace("]","",$pass);
            $pass=str_replace("#","",$pass);
            $who_you = strip_tags($who_you);
$who_you = trim($who_you);
  $who_you=str_replace("$","",$who_you);
 $who_you=str_replace("quot;","",$who_you);
            $who_you=str_replace("$","",$who_you);
            $who_you=str_replace("&lt;","",$who_you);
            $who_you=str_replace("<","",$who_you);
            $who_you=str_replace(">","",$who_you);
            $who_you=str_replace("&gt;","",$who_you);
            $who_you=str_replace("\"","",$who_you);
            $who_you=str_replace("'","",$who_you);
            $who_you=str_replace("\\","",$who_you);
            $who_you=str_replace("&","",$who_you);
             $who_you=str_replace("%","",$who_you);

            $who_you=str_replace("@","",$who_you);
            $who_you=str_replace("^","",$who_you);
            $who_you=str_replace("*","",$who_you);
            $who_you=str_replace(")","",$who_you);
            $who_you=str_replace("(","",$who_you);
            $who_you=str_replace("|","",$who_you);
            $who_you=str_replace("!","",$who_you);
            $who_you=str_replace("№","",$who_you);
            $who_you=str_replace(";","",$who_you);
            $who_you=str_replace("/","",$who_you);
            $who_you=str_replace("{","",$who_you);
            $who_you=str_replace("}","",$who_you);
            $who_you=str_replace("[","",$who_you);
            $who_you=str_replace("]","",$who_you);
            $who_you=str_replace("#","",$who_you);$name = strip_tags($name);
$name = trim($name);
  $name=str_replace("$","",$name);
 $name=str_replace("quot;","",$name);
            $name=str_replace("$","",$name);
            $name=str_replace("&lt;","",$name);
            $name=str_replace("<","",$name);
            $name=str_replace(">","",$name);
            $name=str_replace("&gt;","",$name);
            $name=str_replace("\"","",$name);
            $name=str_replace("'","",$name);
            $name=str_replace("\\","",$name);
            $name=str_replace("&","",$name);
             $name=str_replace("%","",$name);
                          
            $name=str_replace("@","",$name);
            $name=str_replace("^","",$name);
            $name=str_replace("*","",$name);
            $name=str_replace(")","",$name);
            $name=str_replace("(","",$name);
            $name=str_replace("|","",$name);
            $name=str_replace("!","",$name);
            $name=str_replace("№","",$name);
            $name=str_replace(";","",$name);
            $name=str_replace("/","",$name);
            $name=str_replace("{","",$name);
            $name=str_replace("}","",$name);
            $name=str_replace("[","",$name);
            $name=str_replace("]","",$name);
            $name=str_replace("#","",$name);$rost = strip_tags($rost);
$rost = trim($rost);
  $rost=str_replace("$","",$rost);
 $rost=str_replace("quot;","",$rost);
            $rost=str_replace("$","",$rost);
            $rost=str_replace("&lt;","",$rost);
            $rost=str_replace("<","",$rost);
            $rost=str_replace(">","",$rost);
            $rost=str_replace("&gt;","",$rost);
            $rost=str_replace("\"","",$rost);
            $rost=str_replace("'","",$rost);
            $rost=str_replace("\\","",$rost);
            $rost=str_replace("&","",$rost);
             $rost=str_replace("%","",$rost);
              
            $rost=str_replace("@","",$rost);
            $rost=str_replace("^","",$rost);
            $rost=str_replace("*","",$rost);
            $rost=str_replace(")","",$rost);
            $rost=str_replace("(","",$rost);
            $rost=str_replace("|","",$rost);
            $rost=str_replace("!","",$rost);
            $rost=str_replace("№","",$rost);
            $rost=str_replace(";","",$rost);
            $rost=str_replace("/","",$rost);
            $rost=str_replace("{","",$rost);
            $rost=str_replace("}","",$rost);
            $rost=str_replace("[","",$rost);
            $rost=str_replace("]","",$rost);
            $rost=str_replace("#","",$rost);$Znak = strip_tags($Znak);
$Znak = trim($Znak);
  $Znak=str_replace("$","",$Znak);
 $Znak=str_replace("quot;","",$Znak);
            $Znak=str_replace("$","",$Znak);
            $Znak=str_replace("&lt;","",$Znak);
            $Znak=str_replace("<","",$Znak);
            $Znak=str_replace(">","",$Znak);
            $Znak=str_replace("&gt;","",$Znak);
            $Znak=str_replace("\"","",$Znak);
            $Znak=str_replace("'","",$Znak);
            $Znak=str_replace("\\","",$Znak);
            $Znak=str_replace("&","",$Znak);
             $Znak=str_replace("%","",$Znak);
              
            $Znak=str_replace("@","",$Znak);
            $Znak=str_replace("^","",$Znak);
            $Znak=str_replace("*","",$Znak);
            $Znak=str_replace(")","",$Znak);
            $Znak=str_replace("(","",$Znak);
            $Znak=str_replace("|","",$Znak);
            $Znak=str_replace("!","",$Znak);
            $Znak=str_replace("№","",$Znak);
            $Znak=str_replace(";","",$Znak);
            $Znak=str_replace("/","",$Znak);
            $Znak=str_replace("{","",$Znak);
            $Znak=str_replace("}","",$Znak);
            $Znak=str_replace("[","",$Znak);
            $Znak=str_replace("]","",$Znak);
            $Znak=str_replace("#","",$Znak);$color_aes = strip_tags($color_aes);
$color_aes = trim($color_aes);
  $color_aes=str_replace("$","",$color_aes);
 $color_aes=str_replace("quot;","",$color_aes);
            $color_aes=str_replace("$","",$color_aes);
            $color_aes=str_replace("&lt;","",$color_aes);
            $color_aes=str_replace("<","",$color_aes);
            $color_aes=str_replace(">","",$color_aes);
            $color_aes=str_replace("&gt;","",$color_aes);
            $color_aes=str_replace("\"","",$color_aes);
            $color_aes=str_replace("'","",$color_aes);
            $color_aes=str_replace("\\","",$color_aes);
            $color_aes=str_replace("&","",$color_aes);
             $color_aes=str_replace("%","",$color_aes);
              
            $color_aes=str_replace("@","",$color_aes);
            $color_aes=str_replace("^","",$color_aes);
            $color_aes=str_replace("*","",$color_aes);
            $color_aes=str_replace(")","",$color_aes);
            $color_aes=str_replace("(","",$color_aes);
            $color_aes=str_replace("|","",$color_aes);
            $color_aes=str_replace("!","",$color_aes);
            $color_aes=str_replace("№","",$color_aes);
            $color_aes=str_replace(";","",$color_aes);
            $color_aes=str_replace("/","",$color_aes);
            $color_aes=str_replace("{","",$color_aes);
            $color_aes=str_replace("}","",$color_aes);
            $color_aes=str_replace("[","",$color_aes);
            $color_aes=str_replace("]","",$color_aes);
            $color_aes=str_replace("#","",$color_aes);$city = strip_tags($city);
$city = trim($city);
  $city=str_replace("$","",$city);
 $city=str_replace("quot;","",$city);
            $city=str_replace("$","",$city);
            $city=str_replace("&lt;","",$city);
            $city=str_replace("<","",$city);
            $city=str_replace(">","",$city);
            $city=str_replace("&gt;","",$city);
            $city=str_replace("\"","",$city);
            $city=str_replace("'","",$city);
            $city=str_replace("\\","",$city);
            $city=str_replace("&","",$city);
             $city=str_replace("%","",$city);
              
            $city=str_replace("@","",$city);
            $city=str_replace("^","",$city);
            $city=str_replace("*","",$city);
            $city=str_replace(")","",$city);
            $city=str_replace("(","",$city);
            $city=str_replace("|","",$city);
            $city=str_replace("!","",$city);
            $city=str_replace("№","",$city);
            $city=str_replace(";","",$city);
            $city=str_replace("/","",$city);
            $city=str_replace("{","",$city);
            $city=str_replace("}","",$city);
            $city=str_replace("[","",$city);
            $city=str_replace("]","",$city);
            $city=str_replace("#","",$city);$poisk = strip_tags($poisk);
$poisk = trim($poisk);
  $poisk=str_replace("$","",$poisk);
 $poisk=str_replace("quot;","",$poisk);
            $poisk=str_replace("$","",$poisk);
            $poisk=str_replace("&lt;","",$poisk);
            $poisk=str_replace("<","",$poisk);
            $poisk=str_replace(">","",$poisk);
            $poisk=str_replace("&gt;","",$poisk);
            $poisk=str_replace("\"","",$poisk);
            $poisk=str_replace("'","",$poisk);
            $poisk=str_replace("\\","",$poisk);
            $poisk=str_replace("&","",$poisk);
             $poisk=str_replace("%","",$poisk);
              
            $poisk=str_replace("@","",$poisk);
            $poisk=str_replace("^","",$poisk);
            $poisk=str_replace("*","",$poisk);
            $poisk=str_replace(")","",$poisk);
            $poisk=str_replace("(","",$poisk);
            $poisk=str_replace("|","",$poisk);
            $poisk=str_replace("!","",$poisk);
            $poisk=str_replace("№","",$poisk);
            $poisk=str_replace(";","",$poisk);
            $poisk=str_replace("/","",$poisk);
            $poisk=str_replace("{","",$poisk);
            $poisk=str_replace("}","",$poisk);
            $poisk=str_replace("[","",$poisk);
            $poisk=str_replace("]","",$poisk);
            $poisk=str_replace("#","",$poisk);$o_sebe = strip_tags($o_sebe);
$o_sebe = trim($o_sebe);
  $o_sebe=str_replace("$","",$o_sebe);
 $o_sebe=str_replace("quot;","",$o_sebe);
            $o_sebe=str_replace("$","",$o_sebe);
            $o_sebe=str_replace("&lt;","",$o_sebe);
            $o_sebe=str_replace("<","",$o_sebe);
            $o_sebe=str_replace(">","",$o_sebe);
            $o_sebe=str_replace("&gt;","",$o_sebe);
            $o_sebe=str_replace("\"","",$o_sebe);
            $o_sebe=str_replace("'","",$o_sebe);
            $o_sebe=str_replace("\\","",$o_sebe);
            $o_sebe=str_replace("&","",$o_sebe);
             $o_sebe=str_replace("%","",$o_sebe);
              
            $o_sebe=str_replace("@","",$o_sebe);
            $o_sebe=str_replace("^","",$o_sebe);
            $o_sebe=str_replace("*","",$o_sebe);
            $o_sebe=str_replace(")","",$o_sebe);
            $o_sebe=str_replace("(","",$o_sebe);
            $o_sebe=str_replace("|","",$o_sebe);
            $o_sebe=str_replace("!","",$o_sebe);
            $o_sebe=str_replace("№","",$o_sebe);
            $o_sebe=str_replace(";","",$o_sebe);
            $o_sebe=str_replace("/","",$o_sebe);
            $o_sebe=str_replace("{","",$o_sebe);
            $o_sebe=str_replace("}","",$o_sebe);
            $o_sebe=str_replace("[","",$o_sebe);
            $o_sebe=str_replace("]","",$o_sebe);
            $o_sebe=str_replace("#","",$o_sebe);$zachem = strip_tags($zachem);
$zachem = trim($zachem);
  $zachem=str_replace("$","",$zachem);
 $zachem=str_replace("quot;","",$zachem);
            $zachem=str_replace("$","",$zachem);
            $zachem=str_replace("&lt;","",$zachem);
            $zachem=str_replace("<","",$zachem);
            $zachem=str_replace(">","",$zachem);
            $zachem=str_replace("&gt;","",$zachem);
            $zachem=str_replace("\"","",$zachem);
            $zachem=str_replace("'","",$zachem);
            $zachem=str_replace("\\","",$zachem);
            $zachem=str_replace("&","",$zachem);
             $zachem=str_replace("%","",$zachem);
              
            $zachem=str_replace("@","",$zachem);
            $zachem=str_replace("^","",$zachem);
            $zachem=str_replace("*","",$zachem);
            $zachem=str_replace(")","",$zachem);
            $zachem=str_replace("(","",$zachem);
            $zachem=str_replace("|","",$zachem);
            $zachem=str_replace("!","",$zachem);
            $zachem=str_replace("№","",$zachem);
            $zachem=str_replace(";","",$zachem);
            $zachem=str_replace("/","",$zachem);
            $zachem=str_replace("{","",$zachem);
            $zachem=str_replace("}","",$zachem);
            $zachem=str_replace("[","",$zachem);
            $zachem=str_replace("]","",$zachem);
            $zachem=str_replace("#","",$zachem);

if($err!='ok') {
$file2 = fopen("all_users/$pass.$nik.cvs","w"); 
$DATE=$day.'.'.$mounth.'.'.$year;
$DATE_anketaADDend=date("d-m-Y H:i");
if($who_you==1) {$who_you='Парень';} else {$who_you='Девушка';}
fputs($file2, $DATE_anketaADDend.'||'.$nik.'||'.$pass.'||'.$who_you.'||'.$name.'||'.$DATE.'||'.$rost.'||'.$Znak.'||'.$color_aes.'||'.$city.'||'.$poisk.'||'.$o_sebe.'||'.$zachem); 
fclose($file2); if($ot=='dan') { print $nik.', ваши данные успешно изменены
<br/>Назад в <a href="index.php?form=kabinet&amp;nik='.$nik.'&amp;pass='.$pass.'">Личный кабинет</a> ';  } 

if($ot!='dan') {
print $nik.', ваша анкета успешно добавлена!<br/>
Перейдя в <a href="index.php?form=kabinet&amp;nik='.$nik.'&amp;pass='.$pass.'">Личный кабинет</a> в ыможете добавить свои фото и видео!
Или вернуться на <a href="index.php">Главную</a> ';}} }
if($form=='kabinet') {


$nik = htmlspecialchars(stripslashes($nik));

$pass = htmlspecialchars(stripslashes($pass));
 if(empty($nik)) {print 'Вы не ввели Ник<br/>'; $er='ok';}
  if(empty($pass)) {print 'Вы не ввели Пароль<br/>'; $er='ok';}
if($er!='ok') {
$file3=@file("all_users/$pass.$nik.cvs");
if(empty($file3)) {print 'Вы не зарегистрированы<br/>'; $er2='ok';}}
if(($er2!='ok')&&($er!='ok')) {
if(($er2!='ok')&&($er!='ok')) {
print 'Добро пожаловать '.$nik;
if($ot=='dan') {print '<div class="top">Ваши данные</div>';} else {
print '<br/><a href="index.php?form=kabinet&amp;ot=dan&amp;nik='.$nik.'&amp;pass='.$pass.'">Ваши данные</a>';}

if($ot!='dan') {print '<br/>';} 
if($ot=='upload'){print  '<div class="top">Добавить Фото|Видео</div>';} else {
print '<a href="index.php?form=kabinet&amp;ot=upload&amp;nik='.$nik.'&amp;pass='.$pass.'">Добавить Фото|Видео</a>';}

if($ot!='upload') {print '<br/>';} 
if($ot=='pochta'){print  '<div class="top">Ваши письма</div>';} else {
print '<a href="index.php?form=kabinet&amp;ot=pochta&amp;nik='.$nik.'&amp;pass='.$pass.'">Ваши письма</a>';}}

print '<div class="text"></div>';

if($ot=='pochta') {

$dir = opendir ("pochta/$nik"); 
if(empty($dir)) {
print '<form method="post" action="index.php?form=pochtaADD">';
print '<input type="hidden" name="nik" value="'.$nik.'"/>';
print '<input type="hidden" name="pass" value="'.$pass.'"/>';
print 'Кому: <br/><input type="text" name="komy" value="'.$komy.'" maxlength="20" size="20" />
<br/>Сообщение<br/><input type="text" name="msg" value="" maxlength="500" size="20" />';
 print '<br/><input type="submit" value="Отправить" /></form>';print 'Вам не пришло ни одного письма';
} else {

while ($f = readdir ($dir)) 
{if (( $f != ".") && ($f != "..") && ($f != ".htaccess"))
 {$fig[]=$f;}}
  closedir ($dir);
 print '<a href="pochta.php?nik='.$nik.'&amp;pass='.$pass.'">Входящие</a>['.count($fig).']';}
print '<br/>? Вы можете общаться с другими пользователями через внутреннюю почту';}

if($ot=='upload') { include "upload/upload.php";

 print '? Вы можете добовлять свои фото(*jpg) и видео(*3gp)';
}

if($ot=='dan') {
$filew2 = @file("all_users/$pass.$nik.cvs");
$totalw2 = count($filew2);
$totalw2=$totalw2-1;
$d = explode("||",$filew2[$totalw2]);

print 'Дата регистрации: '.$d[0];
print '<br/>Ник: '.$d[1].'('.$d[3].')';
print '<br/>Пароль: '.$d[2];


print '<form method="post" action="index.php?form=anketaADDend&amp;ot=dan">';
print '<input type="hidden" name="nik" value="'.$nik.'"/>';
print '<input type="hidden" name="pass" value="'.$pass.'"/>';
print 'Кто вы?<br/><select name="who_you" ><option value="1">Парень</option><option value="2">Девушка</option></select>
<br/>Имя:<br/> <input type="text" name="name" value="'.$d[4].'" maxlength="20" size="20" /><br/>

День рождения('.$d[5].'):<br/>'; 
 print '<select name="day" >'; 
for ($i=1; $i<32; $i++){ print '<option value="'.$i.'">'.$i.'</option>';}
 print '</select>'; 
print '<select name="mounth" >'; 
for ($i=1; $i<13; $i++){ print '<option value="'.$i.'">'.$i.'</option>';}
 print '</select>'; 
print '<select name="year">'; for ($i=1970; $i<2007; $i++){ print '<option value="'.$i.'">
'.$i.'</option>';}
 print '</select><br/>';  

$znak=array("Овен","Телец","Близнецы","Рак","Лев","Дева","Весы","Скорпион","Стрелец","Козерог","Водолей","Рыба");
print 'Рост:<br/><input type="text" name="rost" value="'.$d[6].'" maxlength="20" size="20" /><br/> Знак зодиака('.$d[7].'):<br/>
<select name="Znak">';
 for ($i=0; $i<count($znak); $i++){ print '<option value="'.$znak[$i].'">'.$znak[$i].'</option>';}

print '</select><br/>
Цвет глаз:<br/><input type="text" name="color_aes" value="'.$d[8].'" maxlength="20" size="20" /><br/>
Город:<br/><input type="text" name="city" value="'.$d[9].'" maxlength="20" size="20" /><br/>
Как вас найти(ICQ, E-mail)?:<br/><input type="text" name="poisk" value="'.$d[10].'" maxlength="20" size="20" /><br/>
О себе:<br/><input type="text" name="o_sebe" value="'.$d[11].'" maxlength="20" size="20" /><br/>
Зачем вам это?:<br/><input type="text" name="zachem" value="'.$d[12].'" maxlength="20" size="20" /><br/>';
print '<input type="submit" value="Изменить" /></form>';
 print '? Измените свои данные, Ник и Пароль не изменяемые';
}

print '<div class="text"></div>';
$filedir2=array("photo", "video");
  for ($i=0; $i<count($filedir2); $i++)
  {
$dir = opendir ("upload/$filedir2[$i]/$nik"); 
$fig=0;$fs=0;
 
  $ext=0; while ($fs = readdir ($dir)) 
{if (( $fs != ".") && ($fs != "..") && ($fs != ".htaccess"))
 {
  $ext = explode('.',$fs);
$ext = $ext[count($ext)-1];
 if($ext!='dat') { $fig[]=$fs;}}}
 closedir ($dir); 
if($filedir2[$i]=='photo') { $f='jpg'; $fn='фотки';} 
if($filedir2[$i]=='video') { $f='3gp';  $fn='видюшки';} 
if(empty($dir)) { $ch=0;}  else {$ch=count($fig);}
 print '||<a href="fallery.php?nik='.$nik.'&amp;pass='.$pass.'&amp;f='.$f.'">Ваши '.$fn.'</a>['.$ch.']<br/>';
 
}
$dir = opendir ("all_users/"); 
$fig=0;$fs=0;
 
  $ext=0; while ($fs = readdir ($dir)) 
{if (( $fs != ".") && ($fs != "..") && ($fs != ".htaccess"))
 {

 $figs[]=$fs ;}}
 closedir ($dir); 

print '||<a href="ankety.php?nik='.$nik.'&amp;pass='.$pass.'">Просмотреть анкеты</a>[всего:'.count($figs).']';
}}
if($form=='pochtaADD') {
$komy = htmlspecialchars(stripslashes($komy));

$msg = htmlspecialchars(stripslashes($msg));
 if(empty($komy)) {print 'Вы не ввели Ник адресата<br/>'; $er='ok';}
  if(empty($msg)) {print 'Вы не ввели сообщение'; $er='ok';}
  
  if($er!='ok') {
 $dir = opendir ("all_users"); 
 while ($f = readdir ($dir)) 
{if (( $f != ".") && ($f != "..") && ($f != ".htaccess"))
 {
 $ext = explode('.',$f);
$ext = $ext[count($ext)-2];
  $filedir[]=$ext;

  }}
 closedir ($dir); 
  for ($i=0; $i<count($filedir); $i++)
{
if($komy==$filedir[$i]) { $err2='no';}  }
if($err2!='no') {
print 'Пользователь под таким Ником не зарегистрирован. ';}
$Date=date("d-m-Y_H-i");
$file=@file("pochta/$komy/$Date.dat");
if($file) { print 'Вы можете отпровлять олько одно письмо в минуту'; $err='ok';}
if(($err!='ok') && ($err2=='no')){
mkdir("pochta/$komy/",0777);
$file2 = fopen("pochta/$komy/$Date.dat","w+");
fwrite($file2, $Date.'||'.$nik.'||'.$msg.'||'); 
fclose($file2); print $nik.', ваше письмо отправленно пользователю '.$komy;
print'<br/>Вернуться в <a href="index.php?form=kabinet&amp;pass='.$pass.'&amp;nik='.$nik.'">Личный кабинет</a> или <a href="index.php?form=kabinet&amp;ot=pochta&amp;pass='.$pass.'&amp;nik='.$nik.'">Отправить ещё</a>'; }}
if (($err=='ok')or($er=='ok')or($err2!='no')){print'<br/>Вернитесь <a href="index.php?form=kabinet&amp;ot=pochta&amp;pass='.$pass.'&amp;nik='.$nik.'">назад</a> и введите сообщение позже'; }
}

print $footer;  ?>