2 /************************************************************************
3 * MXChange v0.2.1 Start: 10/19/2003 *
4 * =============== Last change: 08/26/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-order.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Order mails here *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Hier koennen Ihre Mitglieder Mails buchen *
12 * -------------------------------------------------------------------- *
14 * -------------------------------------------------------------------- *
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
16 * For more information visit: http://www.mxchange.org *
18 * This program is free software; you can redistribute it and/or modify *
19 * it under the terms of the GNU General Public License as published by *
20 * the Free Software Foundation; either version 2 of the License, or *
21 * (at your option) any later version. *
23 * This program is distributed in the hope that it will be useful, *
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
26 * GNU General Public License for more details. *
28 * You should have received a copy of the GNU General Public License *
29 * along with this program; if not, write to the Free Software *
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
32 ************************************************************************/
34 // Some security stuff...
35 if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
37 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
40 elseif (!IS_LOGGED_IN())
42 LOAD_URL(URL."/modules.php?module=index");
44 elseif ((!EXT_IS_ACTIVE("order")) && (!IS_ADMIN()))
46 ADD_FATAL(EXTENSION_PROBLEM_EXT_INACTIVE, "order");
50 // Add description as navigation point
51 ADD_DESCR("member", basename(__FILE__));
54 $WHERE = " WHERE visible='Y'";
56 // Set undefined array elements
57 if (empty($_GET['msg'])) $_GET['msg'] = "";
58 if (empty($_POST['zip'])) $_POST['zip'] = "";
59 if (empty($_POST['html'])) $_POST['html'] = "";
60 if (empty($_POST['receiver'])) $_POST['receiver'] = "";
61 if (is_admin()) $WHERE = "";
63 // Add slashes to every value
64 foreach($_POST as $key=>$value)
66 // Skip submit buttons
67 if (($key != "data") && ($key != "frametester")) $_POST[$key] = addslashes($value);
70 // Minimum mails / order
71 define('__MIN_VALUE', $CONFIG['order_min']);
73 // Count unconfirmed mails
74 $result_links = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_links WHERE userid=%d",
75 array($GLOBALS['userid']), __FILE__, __LINE__);
76 $links = SQL_NUMROWS($result_links);
77 SQL_FREERESULT($result_links);
79 // Does the user has more than 0 mails per day set?
81 if (GET_EXT_VERSION("holiday") >= "0.1.3")
83 // Fetch also holiday activation data
84 $HOLIDAY = "holiday_active";
87 $result_mmails = SQL_QUERY_ESC("SELECT userid, receive_mails, mail_orders, ".$HOLIDAY."
88 FROM "._MYSQL_PREFIX."_user_data
89 WHERE userid=%d AND max_mails > 0 LIMIT 1",
90 array($GLOBALS['userid']), __FILE__, __LINE__);
92 $mmails = SQL_NUMROWS($result_mmails);
93 list($DMY, $MAXI, $ORDERS, $HOLIDAY) = SQL_FETCHROW($result_mmails);
94 SQL_FREERESULT($result_mmails);
95 if ($HOLIDAY == $DMY) $HOLIDAY="N";
97 $ALLOWED = $MAXI - $ORDERS;
98 if ($CONFIG['order_max'] == "MAX") $ALLOWED = $MAXI;
100 // Check HTML extension
101 $HTML_EXT = EXT_IS_ACTIVE("html_mail");
103 // Now check his points amount
104 $result_p = SQL_QUERY_ESC("SELECT SUM(points) FROM "._MYSQL_PREFIX."_user_points WHERE userid=%d",
105 array($GLOBALS['userid']), __FILE__, __LINE__);
108 if (SQL_NUMROWS($result_p) > 0)
111 list($TOTAL) = SQL_FETCHROW($result_p);
112 SQL_FREERESULT($result_p);
114 // And subtract his used points...
115 $result_p = SQL_QUERY_ESC("SELECT used_points FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1",
116 array($GLOBALS['userid']), __FILE__, __LINE__);
118 list($p) = SQL_FETCHROW($result_p);
119 SQL_FREERESULT($result_p);
122 // Add (maybe) missing three zeros
123 if (!ereg(".", $TOTAL)) $TOTAL .= ".00000";
126 if (($HOLIDAY == "Y") && (GET_EXT_VERSION("holiday") >= "0.1.3"))
128 // Holiday is active!
129 SQL_FREERESULT($result_p);
130 LOAD_TEMPLATE("admin_settings_saved", false, HOLIDAY_ORDER_NOT_POSSIBLE);
132 elseif ((!empty($_POST['frametester'])) && ($ALLOWED > 0) && ($_POST['receiver'] > 0))
134 // Continue with the frametester, we first need to store the data temporary in the pool
136 // First we would like to store the data and get it's pool position back...
137 $result = SQL_QUERY_ESC("SELECT id, data_type FROM "._MYSQL_PREFIX."_pool WHERE sender=%d AND url='%s' AND timestamp > %d LIMIT 1",
138 array($GLOBALS['userid'], $_POST['url'], bigintval(time() - $CONFIG['url_tlock'])), __FILE__, __LINE__);
140 $type = "TEMP"; $id = "0";
141 if (SQL_NUMROWS($result) == 1)
143 list($id, $type) = SQL_FETCHROW($result);
144 SQL_FREERESULT($result);
148 // No entry found, so we need to check out the stats table as well... :)
149 // We have to add that suff here, now we continue WITHOUT checking and check the text and subject against some filters
151 if ($CONFIG['test_text'] == "Y")
153 // Test submitted text against some filters (length, URLs in text etc.)
154 if ((strpos(strtolower($_POST['text']), "https://") > -1) || (strpos(strtolower($_POST['text']), "http://") > -1) || (strpos(strtolower($_POST['text']), "www") > -1))
157 $URL = URL."/modules.php?module=login&what=order&msg=".CODE_URL_FOUND;
159 $TEST = str_replace("\n", "", str_replace("\r", "", addslashes($_POST['text'])));
160 if (strlen($TEST) > $CONFIG['max_tlength'])
163 $URL = URL."/modules.php?module=login&what=order&msg=".CODE_OVERLENGTH;
166 // Shall I test the subject line against URLs?
167 if ($CONFIG['test_subj'] == "Y")
169 // Check the subject line for issues
170 $_POST['subject'] = str_replace("\\", "[nl]", substr($_POST['subject'], 0, 200));
171 if ((strpos(strtolower($_POST['subject']), "http://") > -1) || (strpos(strtolower($_POST['subject']), "www") > -1))
173 // URL in subject found
174 $URL = URL."/modules.php?module=login&what=order&msg=".CODE_SUBJ_URL;
177 // And shall I check that his URL is not in the black list?
178 if ($CONFIG['url_blacklist'] == "Y")
180 // Ok, I do that for you know...
181 $result = SQL_QUERY_ESC("SELECT timestamp FROM "._MYSQL_PREFIX."_url_blist WHERE url='%s' LIMIT 1",
182 array($_POST['url']), __FILE__, __LINE__);
184 if (SQL_NUMROWS($result) == 1)
186 // Jupp, we got one listed
187 list($blist) = SQL_FETCHROW($result);
188 SQL_FREERESULT($result);
189 $URL = URL."/modules.php?module=login&what=order&msg=".CODE_BLIST_URL."&blist=".$blist;
192 if (($_POST['receiver'] < $CONFIG['order_min']) && (!IS_ADMIN()))
194 // Less than allowed receivers entered!
195 $URL = URL."/modules.php?module=login&what=order&msg=".CODE_MORE_RECEIVERS3;
199 if (!VALIDATE_URL($_POST['url']))
202 $URL = URL."/modules.php?module=login&what=order&msg=".CODE_INVALID_URL;
205 // Probe for HTML extension
208 if ($_POST['html'] == "Y")
210 // Chek for valid HTML tags
211 $_POST['text'] = HTML_CHECK_TAGS($_POST['text']);
213 // Maybe invalid tags found?
214 if (empty($_POST['text'])) $URL = URL."/modules.php?module=login&what=order&msg=".CODE_INVALID_TAGS."&id=".$id;
218 // Remove any HTML code
219 $_POST['text'] = str_replace("<", "{OPEN_HTML}", str_replace(">", "{CLOSE_HTML}", $_POST['text']));
225 // He has already sent a mail within a specific time
226 $URL = URL."/modules.php?module=login&what=order&msg=".CODE_URL_TLOCK."&id=".$id;
230 // Check if category and number of receivers is okay
232 if (($CONFIG['order_multi_page'] == "Y") && (!empty($_POST['zip']))) $ADD = "AND d.zip LIKE '".bigintval($_POST['zip'])."{PER}'";
235 $result = SQL_QUERY_ESC("SELECT DISTINCT c.userid FROM "._MYSQL_PREFIX."_user_cats AS c
236 LEFT JOIN "._MYSQL_PREFIX."_user_data AS d
238 WHERE c.cat_id=%d AND c.userid != '%s' AND d.status='CONFIRMED' AND d.receive_mails > 0
242 bigintval($_POST['cat']),
244 $CONFIG['order_select'],
245 $CONFIG['order_mode'],
246 ), __FILE__, __LINE__);
248 // Do we enougth receivers left?
249 if (SQL_NUMROWS($result) >= $_POST['receiver'])
251 // Check for holiday extensions
253 if (GET_EXT_VERSION("holiday") >= "0.1.3")
255 // Include checking for users in holiday
259 // Load receivers from database
260 $TEST = array(); $cnt = 0;
261 while (list($REC) = SQL_FETCHROW($result))
265 // Check for his holiday status
266 $result_holiday = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_holidays
267 WHERE userid=%d AND holiday_start < ".time()." AND holiday_end > ".time()." LIMIT 1",
268 array(bigintval($REC)), __FILE__, __LINE__);
269 if (SQL_NUMROWS($result_holiday) == 1) $REC = 0; // Exclude user who are in holiday
272 SQL_FREERESULT($result_holiday);
284 SQL_FREERESULT($result);
286 // Implode array into string for the sending pool
287 $RECEIVER = implode($TEST, ";");
289 // Count array for maximum sent
290 $MAX_SEND = count($TEST);
292 // Update receiver list
293 $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET receive_mails=receive_mails-1 WHERE userid IN (%s) LIMIT %s",
294 array(str_replace(";", ", ", $RECEIVER), $MAX_SEND), __FILE__, __LINE__);
296 // Is calculated max receivers larger than wanted receivers then reset it
297 if ($MAX_SEND > $_POST['receiver']) $MAX_SEND = $_POST['receiver'];
299 // Calculate used points
300 $USED = $MAX_SEND * GET_PAY_POINTS(bigintval($_POST['type']));
302 // Check if he has enougth points for this order and selected more than 0 receivers
303 if (($USED > 0) && ($USED <= $TOTAL) && ($MAX_SEND > 0))
305 // Gettings points is okay, so we can add $USED later from
307 if (($id == "0") || ($type != "TEMP"))
313 // HTML extension is active
314 $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)
315 VALUES ('%s', '%s', '%s', '%s', '%s', 'TEMP', '%s', '%s', '%s', '%s', '%s', '%s')",
318 addslashes($_POST['subject']),
319 addslashes($_POST['text']),
321 bigintval($_POST['type']),
324 bigintval($_POST['cat']),
326 bigintval($_POST['zip']),
328 ), __FILE__, __LINE__);
332 // No HTML extension is active
333 $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_pool (sender, subject, text, receivers, payment_id, data_type, timestamp, url, cat_id, target_send, zip)
334 VALUES ('%s', '%s', '%s', '%s', '%s', 'TEMP', '%s', '%s', '%s', '%s', '%s')",
337 addslashes($_POST['subject']),
338 addslashes($_POST['text']),
340 bigintval($_POST['type']),
343 bigintval($_POST['cat']),
345 bigintval($_POST['zip']),
346 ), __FILE__, __LINE__);
351 // Change current order
354 // HTML extension is active
355 $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_pool SET
360 timestamp=UNIX_TIMESTAMP(),
366 WHERE id=%d LIMIT 1",
371 bigintval($_POST['type']),
373 bigintval($_POST['cat']),
375 bigintval($_POST['zip']),
378 ), __FILE__, __LINE__);
382 // No HTML extension is active
383 $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_pool SET
388 timestamp=UNIX_TIMESTAMP(),
393 WHERE id=%d LIMIT 1",
398 bigintval($_POST['type']),
400 bigintval($_POST['cat']),
402 bigintval($_POST['zip']),
404 ), __FILE__, __LINE__);
408 // Do we need to get the ID number?
410 // Order is placed as temporary. We need to get it's id for the frametester
411 $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_pool WHERE sender=%d AND subject='%s' AND payment_id=%d AND data_type='TEMP' AND timestamp=%d LIMIT 1",
415 bigintval($_POST['type']),
417 ), __FILE__, __LINE__);
419 list($id) = SQL_FETCHROW($result);
420 SQL_FREERESULT($result);
423 // ID is received so we can redirect the user, used points will be added when he send's out the mail
424 $URL = URL."/modules.php?module=frametester&order=".$id."";
426 elseif ($MAX_SEND == 0)
428 // Not enougth receivers found which can receive mails
429 $URL = URL."/modules.php?module=login&what=order&msg=".CODE_MORE_RECEIVERS2;
433 // No enougth points left!
434 $URL = URL."/modules.php?module=login&what=order&msg=".CODE_MORE_POINTS;
439 // Ordered more mails than he can send in this category
440 $URL = URL."/modules.php?module=login&what=order&msg=".CODE_NO_RECS_LEFT;
444 elseif ($_POST['receiver'] == "0")
446 // Not enougth receivers selected
447 $URL = URL."/modules.php?module=login&what=order&msg=".CODE_MORE_RECEIVERS1;
449 elseif (($ALLOWED == 0) && ($CONFIG['order_max'] == "ORDER"))
451 // No more mail orders allowed
452 LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_ORDER_ALLOWED_EXHAUSTED);
454 elseif (($links < $CONFIG['unconfirmed']) && ($mmails == "1"))
456 // Display order form
457 $result_cats = SQL_QUERY("SELECT id, cat FROM "._MYSQL_PREFIX."_cats".$WHERE." ORDER BY sort", __FILE__, __LINE__);
458 if (SQL_NUMROWS($result_cats) > 0)
462 // Initialize array...
469 // Enable HTML checking
470 $HTML = ""; $HOLIDAY = false; $HOL_STRING = "";
471 if (($HTML_EXT) && ($_POST['html'] == "Y")) $HTML = " AND html='Y'";
472 if (GET_EXT_VERSION("holiday") >= "0.1.3")
474 // Extension's version is fine
475 $HOLIDAY = true; $HOL_STRING = " AND holiday_active='N'";
478 // ... and begin loading stuff
479 while (list($id, $cat) = SQL_FETCHROW($result_cats))
481 $CATS['id'][] = bigintval($id);
482 $CATS['name'][] = $cat;
484 // Select users in current category
485 $result_uids = SQL_QUERY_ESC("SELECT userid FROM "._MYSQL_PREFIX."_user_cats WHERE cat_id=%d AND userid != '%s' ORDER BY userid",
486 array(bigintval($id), $GLOBALS['userid']), __FILE__, __LINE__);
489 while (list($ucat) = SQL_FETCHROW($result_uids))
491 // Check for holiday system
495 // Check user's holiday status
496 $result_holiday = SQL_QUERY_ESC("SELECT DISTINCT d.userid FROM "._MYSQL_PREFIX."_user_data AS d
497 LEFT JOIN "._MYSQL_PREFIX."_user_holidays AS h
499 WHERE d.userid=%d AND d.receive_mails > 0 AND d.status='CONFIRMED' AND d.holiday_active='Y'
500 AND h.holiday_start < ".time()." AND h.holiday_end > ".time()."
501 LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
502 if (SQL_NUMROWS($result_holiday) == 1)
504 // Holiday is active!
509 SQL_FREERESULT($result_holiday);
514 // Check if the user want's to receive mails?
515 $result_ver = SQL_QUERY_ESC("SELECT zip FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d".$HTML." AND receive_mails > 0 AND status='CONFIRMED' LIMIT 1",
516 array(bigintval($ucat)), __FILE__, __LINE__);
518 if ((SQL_NUMROWS($result_ver) == 1) && (!empty($_POST['zip'])) && ($CONFIG['order_multi_page'] == "Y"))
520 list($zip) = SQL_FETCHROW($result_ver);
521 SQL_FREERESULT($result_ver);
522 if (substr($zip, 0, strlen($_POST['zip'])) == $_POST['zip'])
524 // Ok, ZIP part is found
531 $uid_cnt += SQL_NUMROWS($result_ver);
537 SQL_FREERESULT($result_uids);
538 $CATS['uids'][] = $uid_cnt;
542 SQL_FREERESULT($result_cats);
544 // Now we need to load the mail types...
545 $result = SQL_QUERY("SELECT id, price, payment, mail_title FROM "._MYSQL_PREFIX."_payments ORDER BY payment", __FILE__, __LINE__);
548 if (SQL_NUMROWS($result) > 0)
550 // Check for message ID in URL
552 switch ($_GET['msg'])
555 $result = SQL_QUERY_ESC("SELECT timestamp FROM "._MYSQL_PREFIX."_pool WHERE id=%d LIMIT 1",
556 array(bigintval($_GET['id'])), __FILE__, __LINE__);
558 // Load timestamp from last order
559 list($LORDER) = SQL_FETCHROW($result);
560 $LORDER = MAKE_DATETIME($LORDER, "1");
563 SQL_FREERESULT($result);
565 // Calculate hours...
566 $STD = round($CONFIG['url_tlock'] / 60 / 60);
569 $MIN = round(($CONFIG['url_tlock'] - $STD * 60 * 60) / 60);
572 $SEC = $CONFIG['url_tlock'] - $STD * 60 * 60 - $MIN * 60;
574 // Finally contruct the message
575 $MSG = MEMBER_URL_TIME_LOCK."<BR>".CONFIG_URL_TLOCK." ".$STD." ".
576 HOURS.", ".$MIN." ".MINS." "._AND." ".$SEC." ".SECS."<BR>".
577 MEMBER_LAST_TLOCK.": ".$LORDER;
580 case CODE_OVERLENGTH:
581 $MSG = MEMBER_TEXT_OVERLENGTH;
585 $MSG = MEMBER_TEXT_CONTAINS_URL;
589 $MSG = MEMBER_SUBJ_CONTAINS_URL;
593 $MSG = MEMBER_URL_BLACK_LISTED."<BR>
594 ".MEMBER_BLIST_TIME.": ".MAKE_DATETIME($_GET['blist'], "0");
597 case CODE_NO_RECS_LEFT:
598 $MSG = MEMBER_SELECTED_MORE_RECS;
601 case CODE_INVALID_TAGS:
602 $MSG = MEMBER_HTML_INVALID_TAGS;
605 case CODE_MORE_POINTS:
606 $MSG = MEMBER_MORE_POINTS_NEEDED;
609 case CODE_MORE_RECEIVERS1:
610 $MSG = MEMBER_ENTER_MORE_RECEIVERS;
613 case CODE_MORE_RECEIVERS2:
614 $MSG = MEMBER_NO_MORE_RECEIVERS_FOUND;
617 case CODE_MORE_RECEIVERS3:
618 $MSG = MEMBER_ENTER_MORE_MIN_RECEIVERS_1.$CONFIG['order_min'].MEMBER_ENTER_MORE_MIN_RECEIVERS_2;
621 case CODE_INVALID_URL:
622 $MSG = MEMBER_ENTER_INVALID_URL;
625 case "": // When no error code is included in the URL we do not need to output an error message as well...
629 $MSG = UNKNOWN_CODE_1.$_GET['msg'].UNKNOWN_CODE_2;
634 // We got system message so we drop it out to the user
635 LOAD_TEMPLATE("admin_settings_saved", false, $MSG);
638 // Load all email types...
639 while ($TYPES[] = SQL_FETCHROW($result))
641 // Nothing to do here... ;-)
645 SQL_FREERESULT($result);
647 // Output user's points
648 $TOTAL = TRANSLATE_COMMA($TOTAL);
650 // Check how many mail orders he has placed today and how many he's allowed to send
651 switch ($CONFIG['order_max'])
653 case "MAX": // He is allowed to send as much as possible
654 define('ORDER_MAX_VALUE', ORDER_ALLOED_MAX);
657 case "ORDER": // He is allowed to send as much as he setup the receiving value
658 define('ORDER_MAX_VALUE', ORDER_ALLOWED_RECEIVE_1.$ALLOWED.ORDER_ALLOWED_RECEIVE_2.$MAXI.ORDER_ALLOWED_RECEIVE_3);
662 // Load final template
663 LOAD_TEMPLATE("member_order_points", false, $TOTAL);
666 $OLD_ORDER = false; $subject = ""; $text = ""; $target = "";
668 // Check if we already have an order placed and make it editable
669 $result = SQL_QUERY_ESC("SELECT subject, text, payment_id, timestamp, url, target_send, cat_id, zip FROM "._MYSQL_PREFIX."_pool WHERE sender=%d AND data_type='TEMP' LIMIT 1",
670 array($GLOBALS['userid']), __FILE__, __LINE__);
672 if (SQL_NUMROWS($result) == 1)
675 list($subject, $text, $payment, $tstamp, $url, $target, $cat, $zip) = SQL_FETCHROW($result);
676 SQL_FREERESULT($result);
678 // Fix max receivers when it is too much
679 if ($target > $CATS['uids'][$cat]) $target = $CATS['uids'][$cat];
681 // Old order is grabbed
686 // Default output for that your members don't forget it...
690 // 01 2 21 12 2 23 443 3 3210
691 if ((!empty($_POST['data'])) || (($CONFIG['order_multi_page'] == "N") && ((!IS_ADMIN()) && (!$HTML_EXT))))
693 // Pre-output categories
695 foreach ($CATS['id'] as $key=>$value)
697 $CAT .= " <OPTION value=\"".$value."\"";
698 if (($OLD_ORDER) && ($cat == $value)) $CAT .= " selected=\"selected\"";
699 $CAT .= ">".$CATS['name'][$key]." (".$CATS['uids'][$key]." ".USER_IN_CAT.")</OPTION>\n";
703 foreach ($TYPES as $key=>$value)
705 $P = TRANSLATE_COMMA($TYPES[$key][1]);
706 if (is_array($value))
708 // Output option line
709 $TYPE .= " <OPTION value=\"".$TYPES[$key][0]."\"";
710 if (($OLD_ORDER) && ($payment == $TYPES[$key][0])) $TYPE .= " selected=\"selected\"";
711 $TYPE .= ">".$P." ".PER_MAIL." - ".$TYPES[$key][3]." - ".round($TYPES[$key][2])." ".PAYMENT."</OPTION>\n";
715 // Put all in constants for the template
716 define('CATEGORY_SELECTION', $CAT);
717 define('TYPE_SELECTION', $TYPE);
718 define('TARGET', $target);
719 define('SUBJECT', $subject);
720 define('TEXT', COMPILE_CODE($text));
721 define('T_URL', $url);
723 if (!empty($_POST['zip']))
725 // Output entered ZIP code
726 define('ZIP_OUTPUT', LOAD_TEMPLATE("member_order-zip2", true, $_POST['zip']));
730 define('ZIP_OUTPUT', "<TR><TD colspan=\"5\" height=\"5\" class=\"seperator\"> </TD></TR>");
733 if (($HTML_EXT) && ($_POST['html'] == "Y"))
735 // Extension is active so output valid HTML tags
736 define('MEMBER_HTML_EXTENSION', LOAD_TEMPLATE("member_order-html_ext", true, HTML_ADD_VALID_TAGS()));
740 // Extension not active and/or class not uploaded
741 define('MEMBER_HTML_EXTENSION', "<TR><TD colspan=\"5\"><INPUT type=\"hidden\" name=\"html\" value=\"N\"></TD></TR>");
744 // Output form for page 2
745 LOAD_TEMPLATE("member_order_page2");
749 // Remember maybe entered ZIP code in constant
753 // Add some content when html extension is active
754 if (($CONFIG['order_multi_page'] == "Y") || (IS_ADMIN())) $ADD = "<TR><TD colspan=\"2\" class=\"seperator bottom2\" height=\"5\"> </TD></TR>\n";
755 define('MEMBER_HTML_EXTENSION', LOAD_TEMPLATE("member_order-html_intro", true));
759 // No HTML extension installed
760 define('MEMBER_HTML_EXTENSION', "<TR><TD colspan=\"2\"><INPUT type=\"hidden\" name=\"html\" value=\"N\"></TD></TR>");
762 // Do we want ZIP code or not?
763 if (($CONFIG['order_multi_page'] == "Y") || (IS_ADMIN()))
767 'zip' => $_POST['zip'],
770 define('MEMBER_ZIP_CONTENT', LOAD_TEMPLATE("member_order-zip1", true, $content));
775 define('MEMBER_ZIP_CONTENT', "");
778 // Output form for page 1 (ZIP code or HTML)
779 LOAD_TEMPLATE("member_order_page1");
784 // No mail types defined
785 OUTPUT_HTML ("<STRONG><SPAN class=\"member_failed\">".MEMBER_NO_PAYMENTS."</SPAN></STRONG>");
791 OUTPUT_HTML ("<STRONG><SPAN class=\"member_failed\">".MEMBER_NO_POINTS."</SPAN></STRONG>");
796 // No cateogries are defined yet
797 OUTPUT_HTML ("<STRONG><SPAN class=\"member_failed\">".MEMBER_NO_CATS."</SPAN></STRONG>");
800 elseif ($mmails == "0")
802 // Please set more than 0 mails per day!
803 LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_HAS_ZERO_MMAILS);
807 // Please confirm some mails first!
808 LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_LINKS_LEFT_1.$links.MEMBER_LINKS_LEFT_2.$CONFIG['unconfirmed'].MEMBER_LINKS_LEFT_3);
813 // Redirect to requested URL