Location: PHPKode > projects > Terra-Terra, A Virtual Operating System > terra-terra.0.0.5/workareas/Guests/TTpwdreset.php
<?php
/****m*
 * NAME
 *  TTpwdreset.php --- Workarea of the TT Guests application
 *
 * DESCRIPTION
 *  Regenerate a forgotten password and mail it to the user
 *
 * AUTHOR
 *  Oscar van Eijk, Oveas Functionality Provider
 *
 * COPYRIGHT
 *  (c) 2003-2005 by Oscar van Eijk/Oveas Functionality Provider 
 ***/
/*
 * This module is part of Terra-Terra, the Virtual Operating System
 * http://terra-terra.com
 * ------------------------------------------------------------------------
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License,
 * or any later version.
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 * ------------------------------------------------------------------------
 * $Id: TTpwdreset.php,v 1.2 2005/07/19 18:17:40 tt_oscar Exp $ 
 */

$TT_Reset_pwd_User = null;

if (!defined ('TT_MASTER_PROCESS')) {
	if (function_exists ('version_compare')) {
		$__TTroot = $_COOKIE['TTroot'];
	} else {
		$__TTroot = $HTTP_COOKIE_VARS['TTroot'];
	}
	require_once ($__TTroot . '/kernel/TTinit.pinc');
}

echo (TT_header());

// echo (TT_open_interface ());


$__showform = True;
if (is_object($TT_Reset_pwd_User)) {
	if ($TT_Reset_pwd_User->status == TT_STATUS_OK) {
		$__showform = False;
	} else {
		TT_signal($TT_Reset_pwd_User);
	}
}

if ($__showform) {
	$__text =& new Text ('PWDRESET', $ThisArea);
	$__text->show();

	echo (TT_form_open ($TT['env_server']['PHP_SELF'], 'forgotpwd', $ThisArea));
	echo (TT_setkey ('P'));
	echo ('<table>');
	echo ('<tr>');
	echo ('<td>' . $TT_workspace->get_prompt('USERNM') . ':</td>');
	echo ('<td><input type="text" name="TT_username" size="12" maxlength="12" /></td>');
	echo ('</tr>');
	echo ('<tr>');
	echo ('<td>' . $TT_workspace->get_prompt('EMAIL') . ':</td>');
	echo ('<td><input type="text" name="TT_email" value="' . $__email . '" size="12" maxlength="60" /></td>');
	echo ('</tr>');
	echo ('<tr>');
	echo ('<td colspan="2" align="center">' . TT_form_close($TT_workspace->get_prompt('RESETPWD'))  . '</td>');
	echo ('</tr>');
	echo ('</table>');
	echo ('</form>');
} else {
	$__mail = new Mail (TT_get_config('standard_email')
				,   'PWDRESET'
				,   array('USERNAME' => $TT_Reset_pwd_User->username
					, 'PASSWORD' => $TT_Reset_pwd_User->password)
			);
	$__mail->recipient($TT_Reset_pwd_User->email);
	$__mail->send();
	$__text =& new Text ('PWDRESETTED', $ThisArea);
	$__text->subs['EMAIL'] = $TT_Reset_pwd_User->email;
	$__text->show();
}

// echo (TT_close_interface ());

echo (TT_footer());
?>
Return current item: Terra-Terra, A Virtual Operating System