View file modile/user/prof.php

File size: 5.94Kb
<?php
Defined('INDEX_S_S') or die ('Доступ запрещен!!!');
if (is_file($cms.'user/'.$_SESSION['user_login'].'/profile.php'))
{
 if ($_POST['pokas'] == '')
 {
  include($cms.'user/'.$_SESSION['user_login'].'/profile.php');
 ?>
    <img src="<?php echo trim(file_get_contents('user/'.$_SESSION['user_login'].'/avatar.txt'));?>"
     width="100" alt="<?php echo $_SESSION['user_login'];?>" border="0">
     <br><a href="/?page=sel_foto">Выбрать из списка</a>
    <hr>
  <form name="" action="" method="post">
  Настоящее имя:<br>
  <input name="name" type="text" value="<?php echo $user_name ?>">
  <br>
  Фамилия:<br>
  <input name="user_fam" type="text" value="<?php echo $user_fam ?>">
  <br>
  Год рождения:<br>
  <select size="1" name="age">
  <?php
  $age_cnt = date("Y")-75;
  while ($age_cnt != (date("Y")-10))
  {
  	if ($age_cnt == $age)
  	echo '<option selected value="'.$age_cnt.'">'.$age_cnt.'</option>';
    else
    echo '<option value="'.$age_cnt.'">'.$age_cnt.'</option>';
    $age_cnt++;
  }
  ?>
  </select>
  <br>
  О себе:<br>
  <textarea style="width: 98%;" name="user_info" rows=3 cols=40><?php echo $user_info?></textarea>
  <br>
  <div align="right"><input class="knopka" type="submit" value="Изменить"></div>
  <hr>
  Введите пароль (только для смены):
  <input name="pass" type="text" value="">
  <input name="pokas" type="hidden" value="7">
  <div align="right"><input class="knopka" type="submit" value="Изменить"></div>
  </form>
  <hr>
  <form name="" action="" method="post">
  E-mail:<br>
  <input name="mail_regist" type="text" value="<?php echo $mail?>">
  <input name="pokas" type="hidden" value="8">
  <div align="right"><input class="knopka" type="submit" value="Изменить"></div>
  </form>
  <hr>
  <form name="" action="" method="post">
  Выберите тему<br>
  <?php

          echo '<select size="1" name="s_tema">';
          $s_tema = file_get_contents($cms.'user/'.$_SESSION['user_login'].'/tema.txt');
          $dire = opendir ("dis");
          while ($filee = readdir ($dire))
         { if (( $filee != ".") && ($filee != "..") && ($filee != "price.txt"))
          {
           if ($filee == $s_tema)
           echo '<option selected value="'.$filee.'">'.$filee.'</option>';
           else
           echo '<option value="'.$filee.'">'.$filee.'</option>';
           }
         }
          closedir ($dire);
          echo '</select>';
          ?>

  <input name="pokas" type="hidden" value="tema">

  <div align="right"><input class="knopka" type="submit" value="Изменить"></div>
  </form>

  <?php
 }
 elseif ($_POST['pokas'] == 7)
 {


     $name_in = substr(htmlspecialchars($_POST['name']),0,10);
     $user_fam_in = substr(htmlspecialchars($_POST['user_fam']),0,10);
     $mess1 = $_POST['user_info'];
     include($cms.'flud/anti_x.php');  //анти мат полный фильтр
     $user_info_in = $mess1;
     $age_in = $_POST['age'];
     include($cms.'user/'.$_SESSION['user_login'].'/profile.php');
     if ($_POST['pass'] != '')
     {
     $pass_in = md5(substr($_POST['pass'],0,10));
     }
     else
     {
     include($cms.'user/'.$_SESSION['user_login'].'/profile.php');
     $pass_in = $pass;
     }

     $fp = fopen ($cms.'user/'.$_SESSION['user_login'].'/profile.php', "w+");
     fwrite ($fp,
     '
     <?php
     Defined(\'INDEX_S_S\') or die (\'Доступ запрещен!!!\');
     $user_name = \''.$name_in.'\';
     $user_fam = \''.$user_fam_in.'\';
     $user_info = \''.stripslashes($user_info_in).'\';
     $pass = \''.$pass_in.'\';
     $age = \''.$age_in.'\';
     $mail = \''.$mail.'\';

     ?>
     ');
    fclose ($fp);
  $activ = 'Отредактирован профиль.';
  include($cms.'moduls/act/act_add.php');

  echo '
   <META HTTP-EQUIV="Refresh" CONTENT="0;">
   ';
 }
 elseif ($_POST['pokas'] == 8)
 {
  if (eregi("^([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?)$", $_POST['mail_regist']))
  {

     include($cms.'user/'.$_SESSION['user_login'].'/profile.php');
     $mail_del = $mail;

     $fp = fopen ($cms.'user/'.$_SESSION['user_login'].'/profile.php', "w+");
     fwrite ($fp,
     '
     <?php
     Defined(\'INDEX_S_S\') or die (\'Доступ запрещен!!!\');
     $user_name = \''.$user_name.'\';
     $user_fam = \''.$user_fam.'\';
     $user_info = \''.stripslashes($user_info).'\';
     $pass = \''.$pass.'\';
     $age = \''.$age.'\';
     $mail = \''.$_POST['mail_regist'].'\';

     ?>
     ');
     fclose ($fp);
     if (!is_file($cms.'user/cms_mail_page/'.$_POST['mail_regist']))
     {
      @unlink($cms.'user/cms_mail_page/'.$mail_del);
      $fp = fopen ($cms.'user/cms_mail_page/'.$_POST['mail_regist'], "w+");
      fclose ($fp);

      $activ = 'Отредактирован профиль. Изменен E-Mail.';
      include('moduls/act/act_add.php');

      echo '
      <META HTTP-EQUIV="Refresh" CONTENT="0;">
      ';
     }
     else
     {
      echo '
      <span class="ramka">
      E-mail уже существует!
      </span>
      <META HTTP-EQUIV="Refresh" CONTENT="2;">
      ';
     }

  }
  else
  {
   echo '
   <span class="ramka">
   Невнерно введен e-mail!
   </span>
   <META HTTP-EQUIV="Refresh" CONTENT="2;">
   ';
  }
 }
 elseif ($_POST['pokas'] == 'tema')
 {
  $fp = fopen ($cms.'user/'.$_SESSION['user_login'].'/tema.txt', "w+");
  fwrite ($fp, trim($_POST['s_tema']));
  fclose ($fp);

  $_SESSION['cms_theme'] = trim($_POST['s_tema']);

  $activ = 'Изменена активная тема.';
  include($cms.'moduls/act/act_add.php');

  echo '
   <META HTTP-EQUIV="Refresh" CONTENT="0;">
   ';
 }
}
else
{
echo '
   <span class="ramka">
   Ошибка доступа к базе.
   </span>';
}
?>