<?php
/****m*
* NAME
* index.php --- Starting point for the TT Guest application
*
* DESCRIPTION
*
*
* AUTHOR
* Oscar van Eijk, Oveas Functionality Provider
*
* COPYRIGHT
* (c) 2004 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: index.php,v 1.2 2005/07/19 18:17:34 tt_oscar Exp $
*/
if (!defined('TT_ROOT')) {
/*
* This is a check to see if this page was called directly. If so,
* the TT environment was not loaded, and the user is redirected to
* the TT starting point (which is 2 levels up from all application
* directories).
*/
echo ("<html>\n");
echo ("<head>\n");
echo (" <title>Redirecting to the Terra-Terra workspace...</title>\n");
echo (" <meta http-equiv=refresh content=\"5; url='../../index.php'\" />\n");
echo ("</head>\n");
echo ("<body>\n");
echo ("This page cannot be called directly. Please <a href='../../index.php'>click here</a>\n");
echo ("if you are not redirected to the Terra-Terra workspace in 5 seconds...\n");
echo ("</body>\n");
echo ("</html>\n");
exit();
}
function TT_GUESTS_register ($formdata) {
global $TT_NewUser;
$TT_NewUser = new User ($formdata['TT_username'], 'C');
if ($TT_NewUser->status != TT_STATUS_OK) {
return;
}
$TT_NewUser->create ('G', $formdata['TT_email']);
}
function TT_GUESTS_reset_password ($formdata) {
global $TT_db;
global $TT_Reset_pwd_User;
$TT_Reset_pwd_User = new User ($formdata['TT_username'], 'R', $formdata['TT_email']);
if ($TT_Reset_pwd_User->status != TT_STATUS_OK) {
return;
}
$TT_Reset_pwd_User->gen_passwd ();
}
/*
* This function has to exist; it is called directly bye the TT kernel
* The return value is evaluated by the TT kernel.
*/
function TT_process_form ($formdata)
{
global $TT;
global $TT_session;
global $_Status;
if (!$formdata['TTform_action']) {
return (DATA_NOACTION);
}
if ($formdata['TTform_action'] == 'register') {
TT_GUESTS_register ($formdata);
} elseif ($formdata['TTform_action'] == 'forgotpwd') {
TT_GUESTS_reset_password ($formdata);
} else {
$_Status->new_arg('DPROC_ACTION', $formdata['TTform_action']);
return (DATA_IVACTION);
}
return (TT_STATUS_OK);
}
?>