just a quick uncomment cause some just run and wonder why it dose nothing
[travianx.git] / sysmsg.php
blob86534026f4405e8789e3f28027970793c0c88c26
1 <?php
2 ################################################################################# ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## ## --------------------------------------------------------------------------- ## ## Filename sysmsg.php ## ## Developed by: Dixie ## ## License: TravianX Project ## ## Copyright: TravianX (c) 2010-2011. All rights reserved. ## ## ## #################################################################################
4 include_once("GameEngine/Account.php");
5 $max_per_pass = 1000;
6 mysql_connect(SQL_SERVER, SQL_USER, SQL_PASS);
7 mysql_select_db(SQL_DB);
8 if (mysql_num_rows(mysql_query("SELECT id FROM ".TB_PREFIX."users WHERE access = 9 AND id = ".$session->uid)) != '1') die("Hacking attempt!");
10 if(isset($_GET['del'])){
11 $query="SELECT * FROM ".TB_PREFIX."users ORDER BY id + 0 DESC";
12 $result=mysql_query($query) or die (mysql_error());
13 for ($i=0; $row=mysql_fetch_row($result); $i++) {
14 $updateattquery = mysql_query("UPDATE ".TB_PREFIX."users SET ok = '0' WHERE id = '".$row[0]."'")
15 or die(mysql_error());
19 if (@$_POST['submit'] == "Send")
21 unset ($_SESSION['m_message']);
22 $_SESSION['m_message'] = $_POST['message'];
23 $NextStep = true;
27 if (@isset($_POST['confirm']))
29 if ($_POST['confirm'] == 'No' ) $Interupt = true;
30 if ($_POST['confirm'] == 'Yes'){
32 if(file_exists("Templates/text.tpl")) {
34 $myFile = "Templates/text.tpl";
35 $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: templates/text.tpl");
36 $text = file_get_contents("Templates/text_format.tpl");
37 $text = preg_replace("'%TEKST%'",$_SESSION['m_message'] ,$text);
38 fwrite($fh, $text);
40 $query="SELECT * FROM ".TB_PREFIX."users ORDER BY id + 0 DESC";
41 $result=mysql_query($query) or die (mysql_error());
42 for ($i=0; $row=mysql_fetch_row($result); $i++) {
43 $updateattquery = mysql_query("UPDATE ".TB_PREFIX."users SET ok = '1' WHERE id = '".$row[0]."'")
44 or die(mysql_error());
46 $done = true;
47 } else { die("<br/><br/><br/>wrong"); }
48 }}
50 ?>
51 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
52 <html>
53 <head>
54 <title><?php echo SERVER_NAME ?></title>
55 <link REL="shortcut icon" HREF="favicon.ico"/>
56 <meta http-equiv="cache-control" content="max-age=0" />
57 <meta http-equiv="pragma" content="no-cache" />
58 <meta http-equiv="expires" content="0" />
59 <meta http-equiv="imagetoolbar" content="no" />
60 <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
62 <script src="mt-full.js?0ac36" type="text/javascript"></script>
63 <script src="unx.js?0ac36" type="text/javascript"></script>
64 <script src="new.js?0ac36" type="text/javascript"></script>
65 <link href="<?php echo GP_LOCATE; ?>lang/en/lang.css?f4b7c" rel="stylesheet" type="text/css" />
66 <link href="<?php echo GP_LOCATE; ?>lang/en/compact.css?f4b7c" rel="stylesheet" type="text/css" />
67 <?php
68 if($session->gpack == null || GP_ENABLE == false) {
69 echo "
70 <link href='".GP_LOCATE."travian.css?e21d2' rel='stylesheet' type='text/css' />
71 <link href='".GP_LOCATE."lang/en/lang.css?e21d2' rel='stylesheet' type='text/css' />";
72 } else {
73 echo "
74 <link href='".$session->gpack."travian.css?e21d2' rel='stylesheet' type='text/css' />
75 <link href='".$session->gpack."lang/en/lang.css?e21d2' rel='stylesheet' type='text/css' />";
77 ?>
78 <script type="text/javascript">
80 window.addEvent('domready', start);
81 </script>
82 </head>
83 <?php
84 if($session->gpack == null || GP_ENABLE == false) {
85 echo "
86 <link href='".GP_LOCATE."travian.css?e21d2' rel='stylesheet' type='text/css' />
87 <link href='".GP_LOCATE."lang/en/lang.css?e21d2' rel='stylesheet' type='text/css' />";
88 } else {
89 echo "
90 <link href='".$session->gpack."travian.css?e21d2' rel='stylesheet' type='text/css' />
91 <link href='".$session->gpack."lang/en/lang.css?e21d2' rel='stylesheet' type='text/css' />";
93 ?>
94 <script type="text/javascript">
95 window.addEvent('domready', start);
96 </script>
97 </head>
100 <body class="v35 ie ie8">
101 <div class="wrapper">
102 <img style="filter:chroma();" src="img/x.gif" id="msfilter" alt="" />
103 <div id="dynamic_header">
104 </div>
105 <?php include("Templates/header.tpl"); ?>
106 <div id="mid">
107 <?php include("Templates/menu.tpl"); ?>
109 <div id="content" class="login">
110 <?php if (@!$NextStep && @!$NextStep2 && @!$done){?>
111 <form method="POST" action="sysmsg.php" name="myform" id="myform">
112 <table cellspacing="1" cellpadding="1" class="tbg" style="background-color:#C0C0C0; border: 0px solid #C0C0C0; font-size: 10pt;">
113 <tbody>
114 <tr>
115 <td class="rbg" style="font-size: 10pt; text-align:center;">System Message</td>
116 </tr>
117 <tr>
118 <td style="font-size: 10pt; text-align:center;">Text BBCode:<br><b>[b] txt [/b]</b> - <i>[i] txt [/i]</i> - <u>[u] txt [/u]</u> <br />
119 <textarea class="fm" name="message" cols="60" rows="23"></textarea></td>
120 </tr>
121 <tr>
122 <td style="text-align:center;">All fields required</td>
123 </tr>
124 <tr>
125 <td style="text-align:center;">
126 <input type="submit" value="Send" name="submit" /> </td>
127 </tr>
128 </tbody>
129 </table>
130 </form>
131 <a href="sysmsg.php?del">Delete old System Message</a>
132 <?php }elseif (@$NextStep){?>
133 <form method="POST" action="sysmsg.php">
134 <table cellspacing="1" cellpadding="2" class="tbg">
135 <tbody>
136 <tr>
137 <td class="rbg" colspan="2">Confirmation</td>
138 </tr>
139 <tr>
140 <td style="text-align: left; width: 200px;">Do you really want to send System Message?</td>
141 <td style="text-align: left;">
142 <input type="submit" style="width: 240px;" class="fm" name="confirm" value="Yes">
143 <input type="submit" style="width: 240px;" class="fm" name="confirm" value="No"></td>
144 </tr>
145 </tbody>
146 </table>
147 </form>
148 Example: (BBCode doesn't work over here!)
149 <?php
150 $txt=$_SESSION['m_message'];
151 $txt = preg_replace("/\[b\]/is",'<b>', $txt);
152 $txt = preg_replace("/\[\/b\]/is",'</b>', $txt);
153 $txt = preg_replace("/\[i\]/is",'<i>', $txt);
154 $txt = preg_replace("/\[\/i\]/is",'</i>', $txt);
155 $txt = preg_replace("/\[u\]/is",'<u>', $txt);
156 $txt = preg_replace("/\[\/u\]/is",'</u>', $txt);
157 echo ($txt);
159 }elseif (@$Interupt){?>
160 <b><?php echo MASS_ABORT; ?></b>
162 <?php }elseif (@$done){?>
163 System Message was sent
164 <?php }else{die("Something is wrong");}?>
165 </div>
166 <div id="side_info" class="outgame">
167 </div>
169 <div class="clear"></div>
170 </div>
172 <div class="footer-stopper outgame"></div>
173 <div class="clear"></div>
175 <?php include("Templates/footer.tpl"); ?>
176 <div id="ce"></div>
177 </body>
178 </html>
179 <?php mysql_close(); ?>