X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fguest%2Fwhat-sponsor_login.php;h=215d31782bf4ecbfa808b7f417e48787407cab21;hb=8d2c9b91eb82ea74fac58b2541982f760d0f77fc;hp=f93c825652987f2ef015a1e1b8b59fbb6ac2c8db;hpb=5c2b2ca5b6829690b9f3bbfa55d896e40a71b8dd;p=mailer.git diff --git a/inc/modules/guest/what-sponsor_login.php b/inc/modules/guest/what-sponsor_login.php index f93c825652..215d31782b 100644 --- a/inc/modules/guest/what-sponsor_login.php +++ b/inc/modules/guest/what-sponsor_login.php @@ -14,8 +14,6 @@ * $Date:: $ * * $Tag:: 0.2.1-FINAL $ * * $Author:: $ * - * Needs to be in all Files and every File needs "svn propset * - * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * * Copyright (c) 2009, 2010 by Mailer Developer Team * @@ -48,7 +46,10 @@ addMenuDescription('guest', __FILE__); if ((!isExtensionActive('sponsor'))) { loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('sponsor')); return; -} // END - if +} elseif (isSponsor()) { + // Is already a logged-in sponsor + redirectToUrl('modules.php?module=sponsor'); +} $mode = ''; if (isGetRequestParameterSet('mode')) { @@ -70,7 +71,10 @@ if (isGetRequestParameterSet('hash')) { FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE - `hash='%s' AND (`status`='UNCONFIRMED' OR `status`='EMAIL') + `hash`='%s' AND ( + `status`='UNCONFIRMED' OR + `status`='EMAIL' + ) LIMIT 1", array(getRequestParameter('hash')), __FILE__, __LINE__); if (SQL_NUMROWS($result) == 1) { // Sponsor found, load his data... @@ -82,10 +86,11 @@ LIMIT 1", array(getRequestParameter('hash')), __FILE__, __LINE__); SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_sponsor_data` SET - `status`='PENDING' + `status`='PENDING', + `hash`=NULL WHERE `id`=%s AND - hash='%s' AND + `hash`='%s' AND `status`='UNCONFIRMED' LIMIT 1", array( @@ -113,9 +118,10 @@ LIMIT 1", SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_sponsor_data` SET - `status`='CONFIRMED' + `status`='CONFIRMED', + `hash`=NULL WHERE - `id`='%s' AND + `id`=%s AND `hash`='%s' AND `status`='EMAIL' LIMIT 1", @@ -149,9 +155,15 @@ LIMIT 1", if (isFormSent()) { // Check email - $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", + $result = SQL_QUERY_ESC("SELECT + `id`, `hash`, `status`, `remote_addr`, `gender`, `surname`, `family`, + UNIX_TIMESTAMP(`sponsor_created`) AS `sponsor_created` +FROM + `{?_MYSQL_PREFIX?}_sponsor_data` +WHERE + `email`='%s' AND + (`status`='UNCONFIRMED' OR `status`='EMAIL') +LIMIT 1", array(postRequestParameter('email')), __FILE__, __LINE__); // Entry found? @@ -194,9 +206,16 @@ WHERE email='%s' AND (`status`='UNCONFIRMED' OR `status`='EMAIL') LIMIT 1", if (isFormSent()) { // Check email - $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", + $result = SQL_QUERY_ESC("SELECT + `id`, `hash`, `remote_addr`, `gender`, `surname`, `family`, + UNIX_TIMESTAMP(`sponsor_created`) AS `sponsor_created` +FROM + `{?_MYSQL_PREFIX?}_sponsor_data` +WHERE + `email`='%s' AND + `id`=%s AND + `status`='CONFIRMED' +LIMIT 1", array(postRequestParameter('email'), bigintval(postRequestParameter('id'))), __FILE__, __LINE__); // Entry found? @@ -204,12 +223,9 @@ WHERE `email`='%s' AND `id`='%s' AND `status`='CONFIRMED' LIMIT 1", // Unconfirmed sponsor account found so let's load the requested data $DATA = SQL_FETCHARRAY($result); - // Translate some data - $DATA['gender'] = translateGender($DATA['gender']); - $DATA['sponsor_created'] = generateDateTime($DATA['sponsor_created']); - - // Generate password + // Generate password/translate some data $DATA['password'] = generatePassword(); + $DATA['sponsor_created'] = generateDateTime($DATA['sponsor_created']); // Prepare email and send it to the sponsor $message_sponsor = loadEmailTemplate('sponsor_lost', $DATA); @@ -259,7 +275,7 @@ LIMIT 1", if ($status == 'CONFIRMED') { // Is confirmed so both is fine and we can continue with login procedure $login = ((setSession('sponsor_id' , bigintval(postRequestParameter('sponsor_id')))) && - (setSession('sponsorpass', md5(postRequestParameter('password')) )) + (setSession('sponsor_pass', md5(postRequestParameter('password')) )) ); if ($login === true) { @@ -267,7 +283,7 @@ LIMIT 1", redirectToUrl('modules.php?module=sponsor'); } else { // Cookie setup failed! - loadTemplate('admin_settings_saved', false, '{--SPONSPOR_COOKIE_SETUP_FAILED--}'); + loadTemplate('admin_settings_saved', false, '{--SPONSOR_COOKIE_SETUP_FAILED--}'); // Login formular and other links loadTemplate('guest_sponsor_login');