Location: PHPKode > projects > Kwalbum > kwalbum/pages/ChangeNamePage.php
<?php
/*
 * Created on Aug 29, 2008
 * 2.0
 */
require_once 'include/IPage.php';

class ChangeNamePage implements IPage
{
	private $msg;

	function GetHead(& $title)
	{
		if (0 == USER_ID)
			return;
		global $DB, $P;

		if (isset($P['act']) and !empty($P['name']))
		{
			$name = strtr($P['name'], array('&' => 'and'));
			$name = $DB->FilterString($name);
			if ($DB->UpdateSingle(USER_TABLE, 'UserTitle', "'$name'", 'UserId='.USER_ID))
				$this->msg = 'Displayed name has been changed.';
		}

		$title = 'Change Displayed Name';
		return '';
	}

	function ShowBody()
	{
		if (0 == USER_ID)
			return;
		global $URLP, $DB;
		$query = 'SELECT UserTitle FROM '.USER_TABLE.
		" WHERE UserId=".USER_ID;
		$row = $DB->Query($query)->fetch_array();
		$name = $row[0];
		require 'ChangeNamePage.html.php';
	}
}
?>
Return current item: Kwalbum