]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/member/what-order.php
Rewrote 'we' word a little, rewrote mail order to use SQL_INSERTID() instead of anoth...
[mailer.git] / inc / modules / member / what-order.php
index f87c555b36622607d644252c06210bca5f51c8e7..1180b53707d866c478b8926d5244ab6440d3970d 100644 (file)
@@ -198,7 +198,7 @@ ORDER BY
                                getMemberId()
                        ), __FILE__, __LINE__);
 
-               // Do we enougth receivers left?
+               // Are there still receivers left?
                if (SQL_NUMROWS($result) >= postRequestElement('receiver')) {
                        // Load receivers from database
                        $TEST = array(); $count = '0';
@@ -350,6 +350,9 @@ LIMIT 1",
                                                                bigintval(postRequestElement('zip'), true, false),
                                                        ), __FILE__, __LINE__);
                                        }
+
+                                       // Get insert id
+                                       $id = SQL_INSERTID();
                                } else {
                                        // Change current order
                                        if (isExtensionActive('html_mail')) {
@@ -413,24 +416,10 @@ LIMIT 1",
                                        }
                                }
 
-                               // Do we need to get the id number?
-                               if ($id == '0') {
-                                       // Order is placed as temporary. We need to get it's id for the frametester
-                                       $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_pool` WHERE `sender`=%s AND `subject`='%s' AND `payment_id`=%s AND `data_type`='TEMP' AND `timestamp`=UNIX_TIMESTAMP() LIMIT 1",
-                                               array(
-                                                       getMemberId(),
-                                                       postRequestElement('subject'),
-                                                       bigintval(postRequestElement('mail_type'))
-                                               ), __FILE__, __LINE__);
-
-                                       // Get pool id
-                                       list($id) = SQL_FETCHROW($result);
-
-                                       // Free result
-                                       SQL_FREERESULT($result);
-                               } // END - if
+                               // Make sure only valid id numbers can pass
+                               assert((!is_bool($id)) && ($id > 0));
 
-                               // id is received so we can redirect the user, used points will be added when he send's out the mail
+                               // Id is received so we can redirect the user, used points will be added when he send's out the mail
                                $url = 'modules.php?module=frametester&order=' . $id;
                        } elseif ($content['target_send'] == '0') {
                                // Not enougth receivers found which can receive mails