-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathoption2.php
118 lines (106 loc) · 3.29 KB
/
option2.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
<?php
// Blacknova Traders - A web-based massively multiplayer space combat and trading game
// Copyright (C) 2001-2012 Ron Harwood and the BNT development team
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// File: option2.php
include "config/config.php";
if (checklogin () )
{
die ();
}
global $l_opt2_title;
$title = $l_opt2_title;
if ($newpass1 == $newpass2 && $password == $oldpass && $newpass1 != "")
{
$shared_function = new shared();
$ip_array = $shared_function->sortIP();
$user_ip_address = $ip_array[0];
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$user_host = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$cookie_session_id = md5($user_agent);
$data = array('username'=>$username, 'password'=>$cookie_session_id,'user_id'=>$user_ship_id,'user_ip'=>$user_ip_address,'user_host'=>$user_host,'user_agent'=>$user_agent);
$data=serialize($data);
setcookie("userID", $data, time() + (3600*24)*365, $gamepath, $gamedomain);
}
if (!preg_match("/^[\w]+$/", $newlang))
{
$newlang = $default_lang;
}
else
{
$lang = $_POST['newlang'];
}
// New database driven language entries
load_languages($db, $lang, array('option2', 'common', 'global_includes', 'global_funcs', 'combat', 'footer', 'news'), $langvars, $db_logging);
include "header.php";
?>
<div class="tablecell content both-border">
<div class="pad">
<?
bigtitle ();
if ($newpass1 == "" && $newpass2 == "")
{
echo $l_opt2_passunchanged . "<br><br>";
}
elseif ($password != $oldpass)
{
echo $l_opt2_srcpassfalse . "<br><br>";
}
elseif ($newpass1 != $newpass2)
{
echo $l_opt2_newpassnomatch . "<br><br>";
}
else
{
$res = $db->Execute("SELECT ship_id,password FROM {$db->prefix}ships WHERE ship_id='$user_ship_id'");
db_op_result ($db, $res, __LINE__, __FILE__, $db_logging);
$playerinfo = $res->fields;
if ($oldpass != $playerinfo['password'])
{
echo $l_opt2_srcpassfalse;
}
else
{
$res = $db->Execute("UPDATE {$db->prefix}ships SET password='$newpass1' WHERE ship_id=$playerinfo[ship_id]");
db_op_result ($db, $res, __LINE__, __FILE__, $db_logging);
if ($res)
{
echo $l_opt2_passchanged . "<br><br>";
}
else
{
echo $l_opt2_passchangeerr . "<br><br>";
}
}
}
$res = $db->Execute("UPDATE {$db->prefix}ships SET lang='$lang' WHERE ship_id='$user_ship_id'");
db_op_result ($db, $res, __LINE__, __FILE__, $db_logging);
foreach ($avail_lang as $curlang)
{
if ($lang == $curlang['file'])
{
$l_opt2_chlang = str_replace("[lang]", "$curlang[name]", $l_opt2_chlang);
echo $l_opt2_chlang . "<p>";
break;
}
}
echo "<br>";
TEXT_GOTOMAIN();
?>
</div></div>
<?
include "footer.php";
?>