示例#1
0
$udm = new UserDataInput($dbcon, $modin);
if (!$udm->isLive()) {
    ampredirect(AMP_CONTENT_URL_INDEX);
    exit;
}
// User ID.
$uid = isset($_REQUEST['uid']) ? intval($_REQUEST['uid']) : false;
$otp = isset($_REQUEST['otp']) ? $_REQUEST['otp'] : null;
// Check for duplicates, setting $uid if found.
if (!$uid) {
    $uid = $udm->findDuplicates();
}
// Check for authentication, sending authentication mail if necessary.
if ($uid) {
    // Set authentication token if uid present
    $auth = $udm->authenticate($uid, $otp);
}
// Fetch or save user data.
if ((!$uid || $auth) && $udm->submitted) {
    // Save only if submitted data is present, and the user is
    // authenticated, or if the submission is anonymous (i.e., !$uid)
    $udm->saveUser();
} elseif ($uid && $auth && !$udm->submitted) {
    // Fetch the user data for $uid if there is no submitted data
    // and the user is authenticated.
    $udm->getUser($uid);
}
/* Now Output the Form.

   Any necessary changes to the form should have been registered
   before now, including any error messages, notices, or
示例#2
0
$udm = new UserDataInput($dbcon, $modin);
$mod_id = $udm->modTemplateID;
require_once 'AMP/BaseTemplate.php';
if (strlen($_REQUEST['Email']) < 5) {
    unset($_REQUEST['Email']);
}
// Check fo rduplicates, setting $uid if found.
if (!$uid) {
    $uid = $udm->findDuplicates();
}
// Check for authentication, sending authentication mail if necessary.
if ($uid) {
    $oldSelf = $_SERVER['PHP_SELF'];
    $_SERVER['PHP_SELF'] = "/modinput4.php";
    // Set authentication token if uid present
    $auth = $udm->authenticate($uid);
    $_SERVER['PHP_SELF'] = $oldSelf;
    ?>

<p>
An email containing login information has been sent to <?php 
    echo $_REQUEST['Email'];
    ?>
. Follow the link contained in the email to login, or enter the password in the form below.
</p>

<form name="login" action="modinput4.php" method="GET">

	<input type="hidden" name="uid" value="<?php 
    echo $uid;
    ?>