Просмотр файла use/log/red.php

Размер файла: 4.73Kb
<?php
Defined('INDEX_S_S') or die ('Доступ запрещен!!!');

if ($_SESSION[login] == ""){ echo 'Вы не авторизованы!'; exit; };
include ("use/$_SESSION[login].php");
echo 'Ваше имя: '.$us_name.'<br />';
?>
Для редактирования введите данные о себе.
  <?php if ($_POST[pokas] != 1)
  {?>


<form name="red_ank" action="<?php echo $_SERVER[self]?>" method="post">
  <br />Ящик:<br>
<input name="mailto" type="text" value="<?php echo $us_mail?>"><br />
          О себе:<br />
<textarea name="us_info" rows=8 cols=50><?php echo $us_info ;?></textarea><br />
<br />
Пол: <select size="1" name="pol">
     <option value="Мужской">Мужской</option>
     <option value="Женский">Женский</option>
     </select>
<br />
Страна: <input name="land" type="text" value="<?php echo $us_land ;?>">
<br />
Город: <input name="city" type="text" value="<?php echo $us_city ;?>">
<br />
Возраст: <input name="vosr" type="text" value="<?php echo $us_vosr ;?>">
<br />

          Желаемая тема:  <br />
          <?php
          echo '<select size="1" name="us_tema">';

          $dir = opendir ("tem");
          while ($file = readdir ($dir))
         { if (( $file != ".") && ($file != ".."))
          {
           echo '<option value="'.$file.'">'.$file.'</option>';
          }
         }
          closedir ($dir);
          echo '</select><br />';

          ?>
          Пароль: (только если желаете сменить)<br />
<input name="us_pass2" type="password" value=""><br />
<input name="pokas" type="hidden" value="1">
<input type="submit" value="Изменить">
</form> <br />

   <?
   }
   else
   {

   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['mailto']))
    {
    $mailto = $_POST['mailto'];
    }
    else
    {
    echo 'E-mail не корректен';
    echo '<META HTTP-EQUIV="Refresh" CONTENT="1; URL=/?pg='.$pg.'">';
    exit;

    }
             // создание учетной записи
$fp = fopen ("use/$_SESSION[login].php", "w+");
fwrite ($fp, "<?php \r\n");
fwrite ($fp, "Defined('INDEX_S_S') or die ('Доступ запрещен'); \r\n");

            if (isset($_POST[us_info]))
            {
      $us_info = $_POST[us_info];
      $us_info = str_replace("'","_",$us_info);
      $us_info = str_replace("\"","_",$us_info);
      $us_info = str_replace("\\","_",$us_info);
      $us_info = str_replace("<","_",$us_info);
      $us_info = str_replace(">","_",$us_info);
      $us_info = str_replace("Java","_",$us_info);
      $us_info = str_replace("java","_",$us_info);
      $us_info = str_replace("Script","_",$us_info);
      $us_info = str_replace("script","_",$us_info);
      $us_info = str_replace("\n","<br>",$us_info);
             };

              if ($_POST[us_pass2] != "")
              {
                $reg_pass = $_POST[us_pass2];
              	$reg_pass = str_replace(" ","_",$reg_pass);
                $reg_pass = str_replace("<","_",$reg_pass);
                $reg_pass = str_replace(">","_",$reg_pass);
                $reg_pass = str_replace("\\","_",$reg_pass);
                $reg_pass = str_replace("\"","_",$reg_pass);
                $reg_pass = str_replace("'","_",$reg_pass);
                $reg_pass = str_replace(".","_",$reg_pass);
     			$reg_pass = str_replace("-","_",$reg_pass);
     			$reg_pass = str_replace("/","_",$reg_pass);
     			$reg_pass = str_replace("#","_",$reg_pass);
     			$reg_pass = str_replace("=","_",$reg_pass);
     			$reg_pass = md5(md5(md5($reg_pass)));
              }
              else
              {
              $reg_pass = $us_pass;
              };




                $us_tema = $_POST['us_tema'];

    $_POST['pol'] = htmlspecialchars($_POST['pol']);
    $_POST['land'] = htmlspecialchars($_POST['land']);
    $_POST['city'] = htmlspecialchars($_POST['city']);
    if (eregi("[0-9]",$_POST['vosr']))
    $_POST['vosr'] = htmlspecialchars($_POST['vosr']);
    else
    $_POST['vosr'] = 'Не указан';


             //запись данных
fwrite ($fp, "\$us_name = '$us_name';\r\n");
fwrite ($fp, "\$us_mail = '$mailto';\r\n");
fwrite ($fp, "\$us_pass = '$reg_pass';\r\n");
fwrite ($fp, "\$us_info = '$us_info';\r\n");
fwrite ($fp, "\$us_tema = '$us_tema';\r\n");
fwrite ($fp, "\$us_pol = '$_POST[pol]';\r\n");
fwrite ($fp, "\$us_land = '$_POST[land]';\r\n");
fwrite ($fp, "\$us_city = '$_POST[city]';\r\n");
fwrite ($fp, "\$us_vosr = '$_POST[vosr]';\r\n");
fwrite ($fp, "\$us_status = '$us_status';\r\n");
fwrite ($fp, "\r\n?>");
fclose ($fp);
                  include ("use/$_SESSION[login].php");
                  $_SESSION[mailto] = $us_mail;
                  $_SESSION[tema] = $us_tema;
     echo '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=/?pg='.$pg.'">';



   };
   ?>