Skip to content

Commit

Permalink
🖊Some functions are handled by the back-end
Browse files Browse the repository at this point in the history
$area->show only country
  • Loading branch information
arcxingye committed Oct 12, 2022
1 parent 1d349f4 commit 0361057
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 28 deletions.
44 changes: 40 additions & 4 deletions SubmitResults.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,47 @@
$score = preg_replace($str, "", $arr[0]);
$name = preg_replace($str, "", $arr[1]);
$t = preg_replace($str, "", $arr[2]);
$system = preg_replace($str, "", $arr[3]);
$area = preg_replace($str, "", $arr[4]);
$message = preg_replace($str, "", $arr[5]);
$message = preg_replace($str, "", $arr[3]);

This comment has been minimized.

Copy link
@W345tyu

W345tyu Oct 23, 2023

Gfvbnmjhgfrewedfguhiujhgvfdretfghjkyu6t5rfg not cool man not cool

if ((!empty($name)) && (strlen($name) <= 30) && (strlen($message) <= 150) && (is_numeric($score)) && ($score < 300) && ($t == $_SESSION['t'])) {

if(getenv('HTTP_CLIENT_IP')){
$onlineip = getenv('HTTP_CLIENT_IP');
}
elseif(getenv('HTTP_X_FORWARDED_FOR')){
$onlineip = getenv('HTTP_X_FORWARDED_FOR');
}
elseif(getenv('REMOTE_ADDR')){
$onlineip = getenv('REMOTE_ADDR');
}
else{
$onlineip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
}
$url = file_get_contents("http://ip.taobao.com/outGetIpInfo?ip=".$onlineip."&accessKey=alibaba-inc");
$ipdata = json_decode($url,true);
$area=$ipdata['data']['country']?$ipdata['data']['country']:'Unknown';

$agent = strtolower($_SERVER['HTTP_USER_AGENT']);
if(strpos($agent, 'windows nt')) {
$system = 'Windows';
} elseif(strpos($agent, 'macintosh')) {
$system = 'Mac';
} elseif(strpos($agent, 'ipod')) {
$system = 'Ipod';
} elseif(strpos($agent, 'ipad')) {
$system = 'Ipad';
} elseif(strpos($agent, 'iphone')) {
$system = 'Iphone';
} elseif (strpos($agent, 'android')) {
$system = 'Android';
} elseif(strpos($agent, 'unix')) {
$system = 'Unix';
} elseif(strpos($agent, 'linux')) {
$system = 'Linux';
} else {
$system = 'Other';
}

if ((!empty($name)) && (strlen($name) <= 30) && (strlen($system) <= 30) && (strlen($area) <= 30) && (strlen($message) <= 150) && (is_numeric($score)) && ($score < 300) && ($t == $_SESSION['t'])) {
@require 'conn.php';
$score_sql = "SELECT `score`,`attempts` FROM " . $ranking . " WHERE `name`=?";
$score_stmt = $link->prepare($score_sql);
Expand Down
1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0, width=device-width,target-densitydpi=device-dpi" />
<link href="./static/index.css" rel="stylesheet" type="text/css">
<script src="https://pv.sohu.com/cityjson?ie=utf-8"></script>
<script src="https://code.createjs.com/1.0.0/createjs.min.js"></script>
<script src="https://passport.cnblogs.com/scripts/jsencrypt.min.js"></script>
<link href="https://cdn.staticfile.org/twitter-bootstrap/5.1.1/css/bootstrap.min.css" rel="stylesheet">
Expand Down
1 change: 0 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0, width=device-width,target-densitydpi=device-dpi" />
<link href="./static/index.css" rel="stylesheet" type="text/css">
<script src="https://pv.sohu.com/cityjson?ie=utf-8"></script>
<script src="https://code.createjs.com/1.0.0/createjs.min.js"></script>
<script src="https://passport.cnblogs.com/scripts/jsencrypt.min.js"></script>
<link href="https://cdn.staticfile.org/twitter-bootstrap/5.1.1/css/bootstrap.min.css" rel="stylesheet">
Expand Down
23 changes: 1 addition & 22 deletions static/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,35 +278,14 @@ const MODE_NORMAL = 1, MODE_ENDLESS = 2, MODE_PRACTICE = 3;
}

function SubmitResults() {
let system = "其他操作系统";
let area = "异世界";
if ($("#username").val() && _gameSettingNum === 20) {
const systems = [
['Win', 'Windows'],
['like Mac', 'iOS'],
['Mac', 'Macintosh'],
['Android', 'Android'],
['Linux', 'Linux'],
];

for (let sys of systems) {
if (navigator.appVersion.indexOf(sys[0]) !== -1) {
system = sys[1];
break;
}
}

if (returnCitySN && returnCitySN['cname']) {
area = returnCitySN['cname']
}

let httpRequest = new XMLHttpRequest();
httpRequest.open('POST', './SubmitResults.php', true);
httpRequest.setRequestHeader("Content-type", "application/json");
let name = $("#username").val();
let message = $("#message").val();
let test = "|_|";
httpRequest.send(encrypt(_gameScore + test + name + test + tj + test + system + test + area + test + message));
httpRequest.send(encrypt(_gameScore + test + name + test + tj + test + message));
}
}

Expand Down

2 comments on commit 0361057

@sinan-sin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good

@W345tyu
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not gang

Please sign in to comment.