tweetmonitor/admin/change-email.php
2016-02-09 14:23:43 +01:00

70 lines
2.1 KiB
PHP

<?php
include('../config/config.php');
include('html/html.inc.php');
include('includes/functions.php');
checkLoginAdmin();
if ( isset($_POST['submit']) )
{
$updateQry = "UPDATE admin
SET
email = '".clean($_POST['newEmail'])."'
WHERE id = '".$_SESSION['user_login_id']."'";
mysql_query($updateQry);
$_SESSION['email'] = clean($_POST['newEmail']);
$redirectUrl = basename($_SERVER['PHP_SELF']);
$_SESSION['succesMessage'] = 3;
header("Location: $redirectUrl");
exit;
}
startHtml($title = "Change Email");
tophead($title);
leftNav();
?>
<script src="<?php echo ADMIN_JS;?>accounts.js" type="text/javascript"></script>
<?php
if ( isset($_SESSION['succesMessage']) )
{
successMsg($_SESSION['succesMessage']);
unset($_SESSION['succesMessage']);
}
?>
<section id="main" class="column">
<article class="module width_half">
<header>
<h3>Change Email</h3>
</header>
<form name="changeEmailForm" id="changeEmailForm" action="" method="post">
<fieldset style="margin:15px">
<table width="100%">
<tr>
<td>
<label>Old Email</label>
<input type="text" name="username" id="username" value="<?php echo $_SESSION['email'];?>"/>
</td>
</tr>
<tr>
<td>
<label>New Email</label>
<input type="text" name="newEmail" id="newEmail">
<input type="hidden" name="usernameHidd" id="usernameHidd" value="<?php echo $_SESSION['email'];?>" />
</td>
</tr>
<tr>
<td>
<input type="submit" name="submit" id="submit" value="Change Email" />
<input type="button" name="cancel" id="cancel" value="Cancel" onclick="window.location='<?php echo ADMIN_URL;?>'" />
</td>
</tr>
</table>
</fieldset>
</form>
</article>
<div class="spacer"></div>
</section>
<?php
endHtml();
?>