This repository has been archived by the owner on Jan 17, 2024. It is now read-only.
forked from iopietro/Travianz-Legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sysmsg.php
180 lines (159 loc) · 6.53 KB
/
sysmsg.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<?php
#################################################################################
## -= 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. ##
## ##
#################################################################################
use App\Utils\AccessLogger;
include_once("GameEngine/Account.php");
AccessLogger::logRequest();
$max_per_pass = 1000;
if (mysqli_num_rows(mysqli_query($database->dblink,"SELECT id FROM ".TB_PREFIX."users WHERE access = 9 AND id = ".$session->uid)) != '1') die("Hacking attempt!");
if(isset($_GET['del'])){
mysqli_query($database->dblink, "UPDATE ".TB_PREFIX."users SET ok = 0");
}
if (@$_POST['submit'] == "Send")
{
unset ($_SESSION['m_message']);
$_SESSION['m_message'] = $_POST['message'];
$NextStep = true;
}
if (@isset($_POST['confirm']))
{
if ($_POST['confirm'] == 'No' ) $Interupt = true;
if ($_POST['confirm'] == 'Yes'){
if(file_exists("Templates/text.tpl")) {
$myFile = "Templates/text.tpl";
$fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: templates/text.tpl");
$text = file_get_contents("Templates/text_format.tpl");
$text = preg_replace("'%TEKST%'",str_replace('"', '\\"', $_SESSION['m_message']) ,$text);
// the following is not really needed and results in fhe file starting with BOM which gets displayed when the message is shown
// ... also, this very much depends on the underlying system and utf8_encode() is only good if the system is defaulted to ISO-8859-1
// $text = utf8_encode($text);
fwrite($fh, $text);
mysqli_query($database->dblink, "UPDATE ".TB_PREFIX."users SET ok = 1");
$done = true;
} else { die("<br/><br/><br/>wrong"); }
}}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title><?php echo SERVER_NAME ?> - System Message</title>
<link rel="shortcut icon" href="favicon.ico"/>
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="imagetoolbar" content="no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script src="mt-full.js?0ac37" type="text/javascript"></script>
<script src="unx.js?f4b7h" type="text/javascript"></script>
<script src="new.js?0ac37" type="text/javascript"></script>
<link href="<?php echo GP_LOCATE; ?>lang/en/lang.css?f4b7d" rel="stylesheet" type="text/css" />
<link href="<?php echo GP_LOCATE; ?>lang/en/compact.css?f4b7i" rel="stylesheet" type="text/css" />
<?php
if($session->gpack == null || GP_ENABLE == false) {
echo "
<link href='".GP_LOCATE."travian.css?e21d2' rel='stylesheet' type='text/css' />
<link href='".GP_LOCATE."lang/en/lang.css?e21d2' rel='stylesheet' type='text/css' />";
} else {
echo "
<link href='".$session->gpack."travian.css?e21d2' rel='stylesheet' type='text/css' />
<link href='".$session->gpack."lang/en/lang.css?e21d2' rel='stylesheet' type='text/css' />";
}
?>
<script type="text/javascript">
window.addEvent('domready', start);
</script>
<?php
if($session->gpack == null || GP_ENABLE == false) {
echo "
<link href='".GP_LOCATE."travian.css?e21d2' rel='stylesheet' type='text/css' />
<link href='".GP_LOCATE."lang/en/lang.css?e21d2' rel='stylesheet' type='text/css' />";
} else {
echo "
<link href='".$session->gpack."travian.css?e21d2' rel='stylesheet' type='text/css' />
<link href='".$session->gpack."lang/en/lang.css?e21d2' rel='stylesheet' type='text/css' />";
}
?>
<script type="text/javascript">
window.addEvent('domready', start);
</script>
</head>
<body class="v35 ie ie8">
<div class="wrapper">
<img style="filter:chroma();" src="img/x.gif" id="msfilter" alt="" />
<div id="dynamic_header">
</div>
<?php include("Templates/header.tpl"); ?>
<div id="mid">
<?php include("Templates/menu.tpl"); ?>
<div id="content" class="login">
<?php if (@!$NextStep && @!$NextStep2 && @!$done){?>
<form method="post" action="sysmsg.php" name="myform" id="myform">
<table cellspacing="1" cellpadding="1" class="tbg" style="background-color:#C0C0C0; border: 0px solid #C0C0C0; font-size: 10pt;">
<tbody>
<tr>
<td class="rbg" style="font-size: 10pt; text-align:center;">System Message</td>
</tr>
<tr>
<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 />
<textarea class="fm" name="message" cols="60" rows="23"></textarea></td>
</tr>
<tr>
<td style="text-align:center;">All fields required</td>
</tr>
<tr>
<td style="text-align:center;">
<input type="submit" value="Send" name="submit" /> </td>
</tr>
</tbody>
</table>
</form>
<a href="sysmsg.php?del">Delete old System Message</a>
<?php }elseif (@$NextStep){?>
<form method="post" action="sysmsg.php">
<table cellspacing="1" cellpadding="2" class="tbg">
<tbody>
<tr>
<td class="rbg" colspan="2">Confirmation</td>
</tr>
<tr>
<td style="text-align: left; width: 200px;">Do you really want to send System Message?</td>
<td style="text-align: left;">
<input type="submit" style="width: 240px;" class="fm" name="confirm" value="Yes" />
<input type="submit" style="width: 240px;" class="fm" name="confirm" value="No" /></td>
</tr>
</tbody>
</table>
</form>
Example: (BBCode or quotation marks (" ") doesn't work over here!)
<?php
$txt=$_SESSION['m_message'];
$txt = preg_replace("/\[b\]/is",'<b>', $txt);
$txt = preg_replace("/\[\/b\]/is",'</b>', $txt);
$txt = preg_replace("/\[i\]/is",'<i>', $txt);
$txt = preg_replace("/\[\/i\]/is",'</i>', $txt);
$txt = preg_replace("/\[u\]/is",'<u>', $txt);
$txt = preg_replace("/\[\/u\]/is",'</u>', $txt);
echo ($txt);
}elseif (@$Interupt){?>
<b><?php echo MASS_ABORT; ?></b>
<?php }elseif (@$done){?>
System Message was sent
<?php }else{die("Something is wrong");}?>
</div>
<div id="side_info" class="outgame">
</div>
<div class="clear"></div>
</div>
<div class="footer-stopper outgame"></div>
<div class="clear"></div>
<?php include("Templates/footer.tpl"); ?>
<div id="ce"></div>
</body>
</html>