=?UTF-8?B?TcOkbmdnZ2dnZ2dnZ2dnZ2dnZ2dnLi4uLi4uLiBGaWxlIDMu?=
From
Keegi ikka@21:1/5 to
All on Tue Aug 16 22:48:14 2022
process.php
<?php
class Table1 {
var $playername;
var $playerscore;
function __construct($aa,$bb) {
$this->playername=$aa;
$this->playerscore=$bb;
}
}
function mysort($aa, $bb)
{
$a00=0;
if($aa->playerscore<$bb->playerscore) $a00=1; else $a00=-1;
return $a00;
}
$scores=array();
$filePath = getcwd().DIRECTORY_SEPARATOR."yyyyyyyyyyyyyyyy";
if(file_exists($filePath)) {
$objData = file_get_contents($filePath);
$scores = unserialize($objData);
if($scores==null) $scores=array();
} else {
$f=fopen($filePath, "w+");
chmod($filePath, 0777);
fclose($f);
}
$playername=null;
$playerscore=null;
$action=$_POST['action'];
if($action=="add") {
$playername=$_POST['playername'];
$playername=strip_tags($playername);
$playername=str_replace(" "," ",$playername);
if(strlen($playername)>554254) exit(0);
$playerscore=$_POST['playerscore'];
}
if($action=="add") {
if($playername!=""&&$playerscore>0&&$playerscore<923254) {
$obj = new Table1($playername,$playerscore);
$scores[]=$obj;
$objData = serialize( $scores);
$add00000=true;
if(($_POST['playername']=="") || ($_POST['playername']==null)
|| ($_POST['playername']==0)|| ($_POST['playername']=='null')) $add00000=false;
if(is_writable($filePath)&&$add00000==true) {
$fffa=fopen($filePath, "w+");
fwrite($fffa, $objData);
fclose($fffa);
}
}
} else if($action=="get") {
usort($scores, "mysort");
echo json_encode($scores,true);
}
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)