* -------------------------------------------------------------------- *
* Kurzbeschreibung : Loginformular und Neues Passwort fuer Sponsor *
* -------------------------------------------------------------------- *
- * $Revision:: $ *
- * $Date:: $ *
- * $Tag:: 0.2.1-FINAL $ *
- * $Author:: $ *
- * -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
- * Copyright (c) 2009 - 2011 by Mailer Developer Team *
+ * Copyright (c) 2009 - 2016 by Mailer Developer Team *
* For more information visit: http://mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
// Some security stuff...
if (!defined('__SECURITY')) {
- die();
+ exit();
} // END - if
// Add description as navigation point
// Check if hash for confirmation of email address is given...
if (isGetRequestElementSet('hash')) {
// Lookup sponsor
- $result = SQL_QUERY_ESC("SELECT
- `id`,`status`,`gender`,`surname`,`family`,
- `company`,`position`,`tax_ident`,
- `street_nr1`,`street_nr2`,`country`,`zip`,`city`,`email`,`phone`,`fax`,`cell`,
- `points_amount` AS `points`,`last_payment`,`last_currency`
+ $result = sqlQueryEscaped("SELECT
+ `id`, `status`, `gender`, `surname`, `family`,
+ `company`, `position`, `tax_ident`,
+ `street_nr1`, `street_nr2`, `country`, `zip`, `city`, `email`, `phone`, `fax`, `cell`,
+ `points_amount` AS `points`, `last_payment`, `last_currency`
FROM
`{?_MYSQL_PREFIX?}_sponsor_data`
WHERE
`status`='EMAIL'
)
LIMIT 1", array(getRequestElement('hash')), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1) {
+ if (sqlNumRows($result) == 1) {
// Sponsor found, load his data...
- $data = SQL_FETCHARRAY($result);
+ $data = sqlFetchArray($result);
// Unconfirmed account or changed email address?
if ($data['status'] == 'UNCONFIRMED') {
// Set account to pending
- SQL_QUERY_ESC("UPDATE
+ sqlQueryEscaped("UPDATE
`{?_MYSQL_PREFIX?}_sponsor_data`
SET
`status`='PENDING',
), __FILE__, __LINE__);
// Check on success
- if (!SQL_HASZEROAFFECTED()) {
+ if (!ifSqlHasZeroAffectedRows()) {
// Prepare mail and send it to the sponsor
$message = loadEmailTemplate('sponsor_pending', $data);
sendEmail($data['email'], '{--SPONSOR_ACCOUNT_PENDING_SUBJECT--}', $message);
}
} elseif ($data['status'] == 'EMAIL') {
// Changed email adress need to be confirmed
- SQL_QUERY_ESC("UPDATE
+ sqlQueryEscaped("UPDATE
`{?_MYSQL_PREFIX?}_sponsor_data`
SET
`status`='CONFIRMED',
array(bigintval($data['id']), getRequestElement('hash')), __FILE__, __LINE__);
// Check on success
- if (!SQL_HASZEROAFFECTED()) {
+ if (!ifSqlHasZeroAffectedRows()) {
// Sponsor account is unlocked again
displayMessage('{--SPONSOR_ACCOUNT_IS_CONFIRMED_AGAIN--}');
} else {
}
// Free memory
- SQL_FREERESULT($result);
+ sqlFreeResult($result);
} elseif ($mode == 'activate') {
// Send activation link again
- if (isFormSent()) {
+ if (isFormSent('login')) {
// Check submitted data
- if (!isPostRequestElementSet('email')) unsetPostRequestElement('ok');
+ if (!isPostRequestElementSet('email')) unsetPostRequestElement('login');
}
- if (isFormSent()) {
+ if (isFormSent('login')) {
// Check email
- $result = SQL_QUERY_ESC("SELECT
- `id`,`hash`,`status`,`remote_addr`,`gender`,`surname`,`family`,
+ $result = sqlQueryEscaped("SELECT
+ `id`,
+ `hash`,
+ `status`,
+ `remote_addr`,
+ `gender`,
+ `surname`,
+ `family`,
UNIX_TIMESTAMP(`sponsor_created`) AS `sponsor_created`
FROM
`{?_MYSQL_PREFIX?}_sponsor_data`
array(postRequestElement('email')), __FILE__, __LINE__);
// Entry found?
- if (SQL_NUMROWS($result) == 1) {
+ if (sqlNumRows($result) == 1) {
// Unconfirmed sponsor account found so let's load the requested data
- $data = SQL_FETCHARRAY($result);
+ $data = sqlFetchArray($result);
// Translate some data
$data['sponsor_created'] = generateDateTime($data['sponsor_created']);
}
// Free memory
- SQL_FREERESULT($result);
+ sqlFreeResult($result);
} else {
// Load form
loadTemplate('guest_sponsor_activate');
}
} elseif ($mode == 'lost_pass') {
// Send new password
- if (isFormSent()) {
+ if (isFormSent('login')) {
// Check submitted data
- if (!isPostRequestElementSet('email')) unsetPostRequestElement('ok');
+ if (!isPostRequestElementSet('email')) unsetPostRequestElement('login');
} // END - if
- if (isFormSent()) {
+ if (isFormSent('login')) {
// Check email
- $result = SQL_QUERY_ESC("SELECT
- `id`,`hash`,`remote_addr`,`gender`,`surname`,`family`,
+ $result = sqlQueryEscaped("SELECT
+ `id`,
+ `hash`,
+ `remote_addr`,
+ `gender`,
+ `surname`,
+ `family`,
UNIX_TIMESTAMP(`sponsor_created`) AS `sponsor_created`
FROM
`{?_MYSQL_PREFIX?}_sponsor_data`
array(postRequestElement('email'), bigintval(postRequestElement('id'))), __FILE__, __LINE__);
// Entry found?
- if (SQL_NUMROWS($result) == 1) {
+ if (sqlNumRows($result) == 1) {
// Unconfirmed sponsor account found so let's load the requested data
- $content = SQL_FETCHARRAY($result);
+ $content = sqlFetchArray($result);
// Generate password/translate some data
$content['password'] = generatePassword();
sendEmail(postRequestElement('email'), '{--SPONSOR_LOST_PASSWORD_SUBJECT--}', $message_sponsor);
// Update password
- SQL_QUERY_ESC("UPDATE
+ sqlQueryEscaped("UPDATE
`{?_MYSQL_PREFIX?}_sponsor_data`
SET
`password`='%s'
}
// Free memory
- SQL_FREERESULT($result);
+ sqlFreeResult($result);
} else {
// Load form
loadTemplate('guest_sponsor_lost');
}
-} elseif (isFormSent()) {
+} elseif (isFormSent('login')) {
// Check status and login data ...
- $result = SQL_QUERY_ESC("SELECT
+ $result = sqlQueryEscaped("SELECT
`status`
FROM
`{?_MYSQL_PREFIX?}_sponsor_data`
md5(postRequestElement('password'))
), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1) {
+ if (sqlNumRows($result) == 1) {
// Okay, first login data check passed, now has he/she an approved (CONFIRMED) account?
- list($status) = SQL_FETCHROW($result);
+ list($status) = sqlFetchRow($result);
if ($status == 'CONFIRMED') {
// Is confirmed so both is fine and we can continue with login procedure
$login = ((setSession('sponsor_id' , bigintval(postRequestElement('sponsor_id')))) &&
(setSession('sponsor_pass', md5(postRequestElement('password')) ))
);
- if ($login === true) {
+ if ($login === TRUE) {
// Cookie setup successfull so we can forward to sponsor area
redirectToUrl('modules.php?module=sponsor');
} else {
}
// Free memory
- SQL_FREERESULT($result);
+ sqlFreeResult($result);
} else {
// Login formular and other links
loadTemplate('guest_sponsor_login');