]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/member/what-order.php
Direct registration added, typo fixed, admin session on missing/failed login fixed...
[mailer.git] / inc / modules / member / what-order.php
index 1053b26427d0fefd4842e8a0547028097e6e7d84..1f216e16b72a314189dd5c00b6e46a1c7ce3f801 100644 (file)
@@ -43,7 +43,7 @@ if (!defined('__SECURITY')) {
 }
 
 // Add description as navigation point
-ADD_DESCR("member", basename(__FILE__));
+ADD_DESCR("member", __FILE__);
 
 $URL = ""; $id = 0;
 $whereStatement = " WHERE visible='Y'";
@@ -53,14 +53,7 @@ if (empty($_GET['msg']))       $_GET['msg']       = "";
 if (empty($_POST['zip']))      $_POST['zip']      = "";
 if (empty($_POST['html']))     $_POST['html']     = "";
 if (empty($_POST['receiver'])) $_POST['receiver'] = "";
-if (is_admin()) $whereStatement = "";
-
-// Add slashes to every value
-foreach($_POST as $key => $value)
-{
-       // Skip submit buttons
-       if (($key != "data") && ($key != "frametester")) $_POST[$key] = addslashes($value);
-}
+if (IS_ADMIN()) $whereStatement = "";
 
 // Minimum mails / order
 define('__MIN_VALUE', $_CONFIG['order_min']);
@@ -96,16 +89,9 @@ if ($_CONFIG['order_max_full'] == "MAX") $ALLOWED = $MAXI;
 $HTML_EXT = EXT_IS_ACTIVE("html_mail");
 
 // Now check his points amount
-$result_p = SQL_QUERY_ESC("SELECT SUM(points) FROM "._MYSQL_PREFIX."_user_points WHERE userid=%s",
- array($GLOBALS['userid']), __FILE__, __LINE__);
-
-$TOTAL = 0;
-if (SQL_NUMROWS($result_p) > 0)
-{
-       // Load points
-       list($TOTAL) = SQL_FETCHROW($result_p);
-       SQL_FREERESULT($result_p);
+$TOTAL = GET_TOTAL_DATA($GLOBALS['userid'], "user_points", "points");
 
+if ($TOTAL > 0) {
        // And subtract his used points...
        $TOTAL -= GET_TOTAL_DATA($GLOBALS['userid'], "user_data", "used_points");
 
@@ -113,14 +99,11 @@ if (SQL_NUMROWS($result_p) > 0)
        if (!ereg(".", $TOTAL)) $TOTAL .= ".00000";
 }
 
-if (($HOLIDAY == "Y") && (GET_EXT_VERSION("holiday") >= "0.1.3"))
-{
+if (($HOLIDAY == "Y") && (GET_EXT_VERSION("holiday") >= "0.1.3")) {
        // Holiday is active!
        SQL_FREERESULT($result_p);
        LOAD_TEMPLATE("admin_settings_saved", false, HOLIDAY_ORDER_NOT_POSSIBLE);
-}
- elseif ((!empty($_POST['frametester'])) && ($ALLOWED > 0) && ($_POST['receiver'] > 0))
-{
+} elseif ((!empty($_POST['frametester'])) && ($ALLOWED > 0) && ($_POST['receiver'] > 0)) {
        // Continue with the frametester, we first need to store the data temporary in the pool
        //
        // First we would like to store the data and get it's pool position back...
@@ -148,7 +131,7 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
                                // URL found!
                                $URL = URL."/modules.php?module=login&what=order&msg=".CODE_URL_FOUND;
                        }
-                       $TEST = str_replace("\n", "", str_replace("\r", "", addslashes($_POST['text'])));
+                       $TEST = str_replace("\n", "", str_replace("\r", "", $_POST['text']));
                        if (strlen($TEST) > $_CONFIG['max_tlength'])
                        {
                                // Text is too long!
@@ -221,14 +204,16 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
        {
                // Check if category and number of receivers is okay
                $ADD = "";
-               if (($_CONFIG['order_multi_page'] == "Y") && (!empty($_POST['zip']))) $ADD = "AND d.zip LIKE '".bigintval($_POST['zip'])."{PER}'";
+               if (($_CONFIG['order_multi_page'] == "Y") && (!empty($_POST['zip']))) {
+                       // Choose recipients by ZIP code
+                       $ADD = " AND d.zip LIKE '".bigintval($_POST['zip'])."{PER}'";
+               } // END - if
 
                // Check for userids
                $result = SQL_QUERY_ESC("SELECT DISTINCT c.userid FROM "._MYSQL_PREFIX."_user_cats AS c
 LEFT JOIN "._MYSQL_PREFIX."_user_data AS d
 ON c.userid=d.userid
-WHERE c.cat_id=%s AND c.userid != '%s' AND d.status='CONFIRMED' AND d.receive_mails > 0
-".$ADD."
+WHERE c.cat_id=%s AND c.userid != '%s' AND d.status='CONFIRMED' AND d.receive_mails > 0".$ADD."
 ORDER BY d.%s %s",
  array(
        bigintval($_POST['cat']),
@@ -304,11 +289,11 @@ WHERE userid=%s AND holiday_start < UNIX_TIMESTAMP() AND holiday_end > UNIX_TIME
                                        {
                                                // HTML extension is active
                                                $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_pool (sender, subject, text, receivers, payment_id, data_type, timestamp, url, cat_id, target_send, zip, html_msg)
- VALUES ('%s', '%s', '%s', '%s', '%s', 'TEMP', '%s', '%s', '%s', '%s', '%s', '%s')",
+ VALUES ('%s','%s','%s','%s','%s','TEMP','%s','%s','%s','%s','%s','%s')",
 array(
        $GLOBALS['userid'],
-       addslashes($_POST['subject']),
-       addslashes($_POST['text']),
+       $_POST['subject'],
+       $_POST['text'],
        $RECEIVER,
        bigintval($_POST['type']),
        $TIME,
@@ -323,11 +308,11 @@ array(
                                        {
                                                // No HTML extension is active
                                                $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_pool (sender, subject, text, receivers, payment_id, data_type, timestamp, url, cat_id, target_send, zip)
- VALUES ('%s', '%s', '%s', '%s', '%s', 'TEMP', '%s', '%s', '%s', '%s', '%s')",
+ VALUES ('%s','%s','%s','%s','%s','TEMP','%s','%s','%s','%s','%s')",
 array(
        $GLOBALS['userid'],
-       addslashes($_POST['subject']),
-       addslashes($_POST['text']),
+       $_POST['subject'],
+       $_POST['text'],
        $RECEIVER,
        bigintval($_POST['type']),
        $TIME,