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

Размер файла: 2.55Kb
<?php
require('includes/header.php');
require('includes/utils.php');
require('includes/db.php');
require('includes/auth.php');
require('includes/config.php');

if($_SERVER['REQUEST_METHOD'] == 'POST')
{
   mysql_query('UPDATE users SET name = "' . addslashes($_POST['name']) . '", surname = "' . addslashes($_POST['surname']) . '", email = "' . addslashes($_POST['email']) . '" WHERE login = "' . $login . '"');
   if($_POST['pass'] != '')
      mysql_query('UPDATE users SET password = "' . md5($_POST['pass']) . '" WHERE login = "' . $login . '"');
?>
<wml>
<card id="ok" title="ok" ontimer="main.php?id=<?php echo $id; ?>&amp;p=<?php echo $login; ?>"><timer value="15"/>
<do type="prev" label="&#x043D;&#x0430;&#x0437;&#x0430;&#x0434;"><prev/></do>
<p align="center">
<b>Ваши данные изменены</b>
</p>
</card>
</wml>
<?php
   exit;
}
else
{
   $users = mysql_query('SELECT id, login, name, surname, email FROM users WHERE id = "' . (int)($_GET['id']) . '" AND login = "' . addslashes($_GET['p']) . '"');
   $user = mysql_fetch_array($users, MYSQL_ASSOC);
?>
<wml>
<card id="profile" title="&#x041F;&#x0440;&#x043E;&#x0444;&#x0430;&#x0439;&#x043B;">
<p>
&#x0412;&#x0430;&#x0448; &#x0441;&#x0430;&#x0439;&#x0442;: http://<?php echo $login . '.' . $server_name; ?><br/>
&#x041B;&#x043E;&#x0433;&#x0438;&#x043D;: <?php echo $user['login']; ?><br/>
&#x041F;&#x0430;&#x0440;&#x043E;&#x043B;&#x044C;:<input name="pass" value="" maxlength="10" title="pass"/><br/>
&#x0418;&#x043C;&#x044F;:<input name="name" value="<?php echo $user['name']; ?>" maxlength="20" title="name"/><br/>
&#x0424;&#x0430;&#x043C;&#x0438;&#x043B;&#x0438;&#x044F;:<input name="surname" value="<?php echo $user['surname']; ?>" maxlength="20" title="surname"/><br/>
&#x041A;&#x043E;&#x043D;&#x0442;&#x0430;&#x043A;&#x0442;&#x043D;&#x044B;&#x0439; e-mail: <input name="email" value="<?php echo $user['email']; ?>" maxlength="50" title="sendmail"/><br/><br/>
<anchor title="go">&#x0421;&#x043E;&#x0445;&#x0440;&#x0430;&#x043D;&#x0438;&#x0442;&#x044C; &#x0438;&#x0437;&#x043C;&#x0435;&#x043D;&#x0435;&#x043D;&#x0438;&#x044F;<go href="editprofile.php?id=<?php echo $id; ?>&amp;p=<?php echo $login; ?>" method="post">
<postfield name="pass" value="$(pass)"/>
<postfield name="name" value="$(name)"/>
<postfield name="surname" value="$(surname)"/>
<postfield name="email" value="$(email)"/>
</go></anchor><br/>
&#x0438;&#x043B;&#x0438;<br/>
<a href="main.php?id=<?php echo $id; ?>&amp;p=<?php echo $login; ?>">&#x0412;&#x044B;&#x0439;&#x0442;&#x0438;</a>
</p>
</card>
</wml>
<?php
}
?>