<?php
/************************************************************************
- * MXChange v0.2.1 Start: 06/10/2005 *
- * =============== Last change: 05/18/2008 *
+ * Mailer v0.2.1-FINAL Start: 06/10/2005 *
+ * =================== Last change: 05/18/2008 *
* *
* -------------------------------------------------------------------- *
* File : what-sponsor_login.php *
} // END - if
$mode = '';
-if (isGetRequestElementSet('mode')) {
+if (isGetRequestParameterSet('mode')) {
// A "special" mode of the login system was requested
- switch (getRequestElement('mode')) {
+ switch (getRequestParameter('mode')) {
case 'activate' : $mode = 'activate'; break; // Activation link requested
case 'lost_pass': $mode = 'lost_pass'; break; // Request new password
} // END - switch
} // END - if
// Check if hash for confirmation of email address is given...
-if (isGetRequestElementSet('hash')) {
+if (isGetRequestParameterSet('hash')) {
// Lookup sponsor
$result = SQL_QUERY_ESC("SELECT
`id`, `status`, `gender`, `surname`, `family`,
`{?_MYSQL_PREFIX?}_sponsor_data`
WHERE
`hash='%s' AND (`status`='UNCONFIRMED' OR `status`='EMAIL')
-LIMIT 1", array(getRequestElement('hash')), __FILE__, __LINE__);
+LIMIT 1", array(getRequestParameter('hash')), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Sponsor found, load his data...
- $SPONSOR = SQL_FETCHARRAY($result);
+ $data = SQL_FETCHARRAY($result);
// Translate gender and comma
- $SPONSOR['gender'] = translateGender($SPONSOR['gender']);
- $SPONSOR['points'] = translateComma($SPONSOR['points']);
- $SPONSOR['pay'] = translateComma($SPONSOR['pay']);
+ $data['gender'] = translateGender($data['gender']);
+ $data['points'] = translateComma($data['points']);
+ $data['pay'] = translateComma($data['pay']);
// Unconfirmed account or changed email address?
- if ($SPONSOR['status'] == 'UNCONFIRMED') {
+ if ($data['status'] == 'UNCONFIRMED') {
// Set account to pending
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_sponsor_data` SET `status`='PENDING'
WHERE `id`='%s' AND hash='%s' AND `status`='UNCONFIRMED' LIMIT 1",
- array(bigintval($SPONSOR['id']), getRequestElement('hash')), __FILE__, __LINE__);
+ array(bigintval($data['id']), getRequestParameter('hash')), __FILE__, __LINE__);
// Check on success
if (SQL_AFFECTEDROWS() == 1) {
// Prepare mail and send it to the sponsor
- $message = loadEmailTemplate('sponsor_pending', $SPONSOR);
- sendEmail($SPONSOR['email'], getMessage('SPONSOR_ACCOUNT_PENDING_SUBJ'), $message);
+ $message = loadEmailTemplate('sponsor_pending', $data);
+ sendEmail($data['email'], getMessage('SPONSOR_ACCOUNT_PENDING_SUBJ'), $message);
// Send email to admin
- sendAdminNotification(getMessage('ADMIN_NEW_SPONSOR'), 'admin_sponsor_pending', $SPONSOR);
+ sendAdminNotification(getMessage('ADMIN_NEW_SPONSOR'), 'admin_sponsor_pending', $data);
// Sponsor account set to pending
loadTemplate('admin_settings_saved', false, getMessage('SPONSOR_ACCOUNT_IS_PENDING'));
// Could not unlock account!
loadTemplate('admin_settings_saved', false, getMessage('SPONSOR_ACCOUNT_PENDING_FAILED'));
}
- } elseif ($SPONSOR['status'] == 'EMAIL') {
+ } elseif ($data['status'] == 'EMAIL') {
// Changed email adress need to be confirmed
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_sponsor_data` SET `status`='CONFIRMED'
-WHERE `id`='%s' AND hash='%s' AND `status`='EMAIL' LIMIT 1",
- array(bigintval($SPONSOR['id']), getRequestElement('hash')), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE
+ `{?_MYSQL_PREFIX?}_sponsor_data`
+SET
+ `status`='CONFIRMED'
+WHERE
+ `id`='%s' AND
+ `hash`='%s' AND
+ `status`='EMAIL'
+LIMIT 1",
+ array(bigintval($data['id']), getRequestParameter('hash')), __FILE__, __LINE__);
// Check on success
if (SQL_AFFECTEDROWS() == 1) {
}
} else {
// No sponsor found
- loadTemplate('admin_settings_saved', false, sprintf(getMessage('SPONSOR_ACCOUNT_404'), getRequestElement('hash')));
+ loadTemplate('admin_settings_saved', false, sprintf(getMessage('SPONSOR_ACCOUNT_404'), getRequestParameter('hash')));
}
// Free memory
// Send activation link again
if (isFormSent()) {
// Check submitted data
- if (!isPostRequestElementSet('email')) unsetPostRequestElement('ok');
+ if (!isPostRequestParameterSet('email')) unsetPostRequestParameter('ok');
}
if (isFormSent()) {
$result = SQL_QUERY_ESC("SELECT id, hash, status, remote_addr, gender, surname, family, sponsor_created
FROM `{?_MYSQL_PREFIX?}_sponsor_data`
WHERE email='%s' AND (`status`='UNCONFIRMED' OR `status`='EMAIL') LIMIT 1",
- array(postRequestElement('email')), __FILE__, __LINE__);
+ array(postRequestParameter('email')), __FILE__, __LINE__);
// Entry found?
if (SQL_NUMROWS($result) == 1) {
// Unconfirmed sponsor account found so let's load the requested data
- $SPONSOR = SQL_FETCHARRAY($result);
+ $data = SQL_FETCHARRAY($result);
// Translate some data
- $SPONSOR['gender'] = translateGender($SPONSOR['gender']);
- $SPONSOR['sponsor_created'] = generateDateTime($SPONSOR['sponsor_created']);
+ $data['gender'] = translateGender($data['gender']);
+ $data['sponsor_created'] = generateDateTime($data['sponsor_created']);
// Prepare email and send it to the sponsor
- if ($SPONSOR['status'] == 'UNCONFIRMED') {
+ if ($data['status'] == 'UNCONFIRMED') {
// Unconfirmed accounts
- $message_sponsor = loadEmailTemplate('sponsor_activate', $SPONSOR);
+ $message_sponsor = loadEmailTemplate('sponsor_activate', $data);
} else {
// Confirmed email address
- $message_sponsor = loadEmailTemplate('sponsor_email', $SPONSOR);
+ $message_sponsor = loadEmailTemplate('sponsor_email', $data);
}
- sendEmail(postRequestElement('email'), getMessage('SPONSOR_ACTIVATION_LINK_SUBJ'), $message_sponsor);
+ sendEmail(postRequestParameter('email'), getMessage('SPONSOR_ACTIVATION_LINK_SUBJ'), $message_sponsor);
// Output message
loadTemplate('admin_settings_saved', false, getMessage('SPONSOR_ACTIVATION_LINK_SENT'));
// Send new password
if (isFormSent()) {
// Check submitted data
- if (!isPostRequestElementSet('email')) unsetPostRequestElement('ok');
+ if (!isPostRequestParameterSet('email')) unsetPostRequestParameter('ok');
} // END - if
if (isFormSent()) {
$result = SQL_QUERY_ESC("SELECT `id`, `hash`, `remote_addr`, `gender`, `surname`, `family`, `sponsor_created`
FROM `{?_MYSQL_PREFIX?}_sponsor_data`
WHERE `email`='%s' AND `id`='%s' AND `status`='CONFIRMED' LIMIT 1",
- array(postRequestElement('email'), bigintval(postRequestElement('id'))), __FILE__, __LINE__);
+ array(postRequestParameter('email'), bigintval(postRequestParameter('id'))), __FILE__, __LINE__);
// Entry found?
if (SQL_NUMROWS($result) == 1) {
$DATA = SQL_FETCHARRAY($result);
// Translate some data
- $DATA['gender'] = translateGender($DATA['gender']);
+ $DATA['gender'] = translateGender($DATA['gender']);
$DATA['sponsor_created'] = generateDateTime($DATA['sponsor_created']);
// Generate password
// Prepare email and send it to the sponsor
$message_sponsor = loadEmailTemplate('sponsor_lost', $DATA);
- sendEmail(postRequestElement('email'), getMessage('SPONSOR_LOST_PASSWORD_SUBJ'), $message_sponsor);
+ sendEmail(postRequestParameter('email'), getMessage('SPONSOR_LOST_PASSWORD_SUBJ'), $message_sponsor);
// Update password
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_sponsor_data` SET `password`='%s'
// Check status and login data ...
$result = SQL_QUERY_ESC("SELECT status FROM `{?_MYSQL_PREFIX?}_sponsor_data`
WHERE `id`='%s' AND password='%s' LIMIT 1",
- array(bigintval(postRequestElement('sponsorid')), md5(postRequestElement('pass'))), __FILE__, __LINE__);
+ array(bigintval(postRequestParameter('sponsorid')), md5(postRequestParameter('pass'))), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Okay, first login data check passed, now has he/she an approved (CONFIRMED) account?
list($status) = SQL_FETCHROW($result);
if ($status == 'CONFIRMED') {
// Is confirmed so both is fine and we can continue with login procedure
- $login = ((setSession('sponsorid' , bigintval(postRequestElement('sponsorid')))) &&
- (setSession('sponsorpass', md5(postRequestElement('pass')) ))
+ $login = ((setSession('sponsorid' , bigintval(postRequestParameter('sponsorid')))) &&
+ (setSession('sponsorpass', md5(postRequestParameter('pass')) ))
);
if ($login === true) {