]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/guest/what-sponsor_login.php
Updated copyright year.
[mailer.git] / inc / modules / guest / what-sponsor_login.php
index 82a49d2b5525f730c27eec1dffc9613e6c98e651..4228bd3cf08bd7de2ccb92ecec62454cef071afd 100644 (file)
  * -------------------------------------------------------------------- *
  * 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 *
@@ -37,7 +32,7 @@
 
 // Some security stuff...
 if (!defined('__SECURITY')) {
-       die();
+       exit();
 } // END - if
 
 // Add description as navigation point
@@ -52,9 +47,9 @@ if ((!isExtensionActive('sponsor'))) {
 }
 
 $mode = '';
-if (isGetRequestElementSet('mode')) {
+if (isGetRequestElementSet('do')) {
        // A "special" mode of the login system was requested
-       switch (getRequestElement('mode')) {
+       switch (getRequestElement('do')) {
                case 'activate' : $mode = 'activate';  break; // Activation link requested
                case 'lost_pass': $mode = 'lost_pass'; break; // Request new password
        } // END - switch
@@ -63,11 +58,11 @@ if (isGetRequestElementSet('mode')) {
 // 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
@@ -76,14 +71,14 @@ 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',
@@ -99,7 +94,7 @@ LIMIT 1",
                                ), __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);
@@ -115,7 +110,7 @@ LIMIT 1",
                        }
                } elseif ($data['status'] == 'EMAIL') {
                        // Changed email adress need to be confirmed
-                       SQL_QUERY_ESC("UPDATE
+                       sqlQueryEscaped("UPDATE
        `{?_MYSQL_PREFIX?}_sponsor_data`
 SET
        `status`='CONFIRMED',
@@ -128,7 +123,7 @@ LIMIT 1",
                                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 {
@@ -145,18 +140,24 @@ LIMIT 1",
        }
 
        // 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`
@@ -167,9 +168,9 @@ LIMIT 1",
                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']);
@@ -192,22 +193,27 @@ LIMIT 1",
                }
 
                // 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`
@@ -219,9 +225,9 @@ LIMIT 1",
                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();
@@ -232,7 +238,7 @@ LIMIT 1",
                        sendEmail(postRequestElement('email'), '{--SPONSOR_LOST_PASSWORD_SUBJECT--}', $message_sponsor);
 
                        // Update password
-                       SQL_QUERY_ESC("UPDATE
+                       sqlQueryEscaped("UPDATE
        `{?_MYSQL_PREFIX?}_sponsor_data`
 SET
        `password`='%s'
@@ -249,14 +255,14 @@ LIMIT 1",
                }
 
                // 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`
@@ -269,16 +275,16 @@ LIMIT 1",
                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 {
@@ -304,7 +310,7 @@ LIMIT 1",
        }
 
        // Free memory
-       SQL_FREERESULT($result);
+       sqlFreeResult($result);
 } else {
        // Login formular and other links
        loadTemplate('guest_sponsor_login');