<?php
/*
* Created on sep 3, 2008
* 2.0
*/
require_once 'include/IPage.php';
class ChangeEmailPage implements IPage
{
private $msg;
function GetHead(& $title)
{
if (0 == USER_ID)
return;
global $DB, $P;
if (!empty($P['email']))
{
$email = $DB->FilterString($P['email']);
require_once 'include/JoinValidate.php';
$JV = new JoinValidate();
if ($JV->validateAJAX($email, 'txtEmail'))
{
if ($DB->UpdateSingle(USER_TABLE, 'UserEmail', "'$email'", 'UserId='.USER_ID))
$this->msg = 'Your email address has been changed. Please check to make sure it was saved correctly.';
}
else
$this->msg = '<div class="error">New email address is invalid. Changes were not saved.</div>';
}
$title = 'Change Email Address';
return '';
}
function ShowBody()
{
if (0 == USER_ID)
return;
global $URLP, $DB;
$query = 'SELECT UserEmail FROM '.USER_TABLE.
" WHERE UserId=".USER_ID;
$row = $DB->Query($query)->fetch_array();
$email = $row[0];
require 'ChangeEmailPage.html.php';
}
}
?>