Back-ported to PHP4 (type-hints removed)
[mailer.git] / 0.2.1 / inc / modules / frametester.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 10/24/2003 *
4  * ===============                              Last change: 06/30/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : frametester.php                                  *
8  * -------------------------------------------------------------------- *
9  * Short description : Test your website against frame killers          *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Testet die Mitgliedsseite gegen Frame-Killer     *
12  * -------------------------------------------------------------------- *
13  *                                                                      *
14  * -------------------------------------------------------------------- *
15  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
16  * For more information visit: http://www.mxchange.org                  *
17  *                                                                      *
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.                                  *
22  *                                                                      *
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.                         *
27  *                                                                      *
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,               *
31  * MA  02110-1301  USA                                                  *
32  ************************************************************************/
33
34 // Some security stuff...
35 if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
36 {
37         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
38         require($INC);
39 }
40
41 $MODE = "guest";
42
43 if (!empty($_GET['order']))
44 {
45         // Order number placed, is he also logged in?
46         if(IS_LOGGED_IN())
47         {
48                 // Ok, test passed... :)
49                 $result = SQL_QUERY_ESC("SELECT subject, url FROM "._MYSQL_PREFIX."_pool WHERE id=%d AND sender=%d AND data_type='TEMP' LIMIT 1",
50                  array(bigintval($_GET['order']), $GLOBALS['userid']), __FILE__, __LINE__);
51
52                 // Finally is the entry valid?
53                 if (SQL_NUMROWS($result) == 1)
54                 {
55                         // Load subject and URL (but forwhat do we need the subject line here???
56                         list($sub, $url) = SQL_FETCHROW($result);
57
58                         // This fixes a white page
59                         $_POST['url'] = $url;
60
61                         // Update his login data
62                         UPDATE_LOGIN_DATA();
63                         $MODE = "member";
64                 }
65                  else
66                 {
67                         // Matching line not found!
68                         LOAD_URL(URL."/modules.php?module=index&amp;what=login");
69                 }
70
71                 // Free memory
72                 SQL_FREERESULT($result);
73         }
74          else
75         {
76                 // He is no longer logged in
77                 LOAD_URL(URL."/modules.php?module=index&amp;what=login");
78         }
79 }
80
81 if ((!empty($_POST['url'])) || (!empty($_GET['url'])) || (!empty($_GET['frame'])))
82 {
83         $url = URL;
84         if (!empty($_POST['url'])) $url = $_POST['url'];
85         if (!empty($_GET['url']))  $url = base64_decode(urldecode(COMPILE_CODE($_GET['url'])));
86         switch ($_GET['frame'])
87         {
88         case "":
89                 switch ($MODE)
90                 {
91                 case "member":
92                         // Build frameset
93                         define('__ORDER_VALUE', bigintval($_GET['order']));
94                         define('__URL_VALUE'  , DEREFERER($url));
95                         LOAD_TEMPLATE("member_order_frametester");
96                         break;
97
98                 case "guest":
99                         define('__URL_VALUE'  , DEREFERER($url));
100                         LOAD_TEMPLATE("guest_frametester");
101                         break;
102                 }
103                 break;
104
105         case "test_top":
106                 OUTPUT_HTML ("<STRONG class=\"guest_done\">".GUEST_FRAMETESTER_TOP."</SPAN>");
107                 break;
108
109         case "back": // Back buttom
110                 LOAD_TEMPLATE("member_order_back", false, $_GET['order']);
111                 break;
112
113         case "send": // Send mail away
114                 LOAD_TEMPLATE("member_order_send", false, $_GET['order']);
115                 break;
116         }
117 }
118  else
119 {
120         // Go away...
121         LOAD_URL(URL."/modules.php?module=login");
122 }
123 //
124 ?>