Reset status points php page
Hello RageZone community
Another little page to make reset to the status points of char.
Problems: No sure if it works if a user is under attack and also if a char was deleveled...
Anyway this script use an extra table called _Char_Reset with the camps char_id and last_reset both can be varchar.
Mind that a player can only reset 1 time each 7 days...
Mind also that you must have the variable char in GET method with number of the char (charID)
PHP Code:
<?php
//check that the user is logged
if(!isset($_SESSION)){
session_start();
}
if (isset($_SESSION['name'])) {
$userID = $_SESSION['name'];
}
else {
echo "<script>location.href='index.php'</script>";
die;
}
//makesure that the the variable char is present
if(!isset($_GET["char"])){
echo "<script>location.href='controlpanel.php'</script>";
die;
}
/*************************************
*convert a date in the format AAAA-MM-DD
*into numbers of days passed from 2000-01-01
*************************************/
function date2int($end) {
$start="2000-01-01";
$start_ts = strtotime($start);
$end_ts = strtotime($end);
$diff = $end_ts - $start_ts;
return round($diff / 86400);
}
$titulo="Reset your status points";
require_once("./modules/include/Config.php");
require_once("./modules/include/sqlConn.php");
require_once("./modules/include/Security.php");
$check = new security();
$message = null;
if($check->is_secure($_GET['char']) == false) $message[] = "";
if(count($message) > 0) {
// char isnt safe
echo "<script>location.href='index.php'</script>";
die;
}
mssql_select_db($dbName1, $dbConn) or die ("Couln't select database $dbName1");
//select the JID from this account
$getUserJID = mssql_query("select * from TB_User where StrUserID = '".$_SESSION["name"]."'");
while ($row = mssql_fetch_array($getUserJID)) {
$userJID = $row['JID'];
//$userGM = $row['sec_content'];
}
mssql_select_db($dbName2, $dbConn) or die ("Couln't select database $dbName2");
//check that the char belong to te logged account
$getCharID = mssql_query("select * from _User where UserJID = '$userJID'");
$charnumeros=0;
while ($row = mssql_fetch_array($getCharID)) {
$charID2 = $row['CharID'];
if($charID2==$_GET['char']){
$charnumeros++;
}
}
if($charnumeros==0){
echo "<script>location.href='index.php'</script>";
die;
}
//select char informations needed to reset
$getCharInfos = mssql_query("select * from _Char where CharID = ".$_GET['char']);
while ($row2 = mssql_fetch_array($getCharInfos)) {
$charName = $row2['CharName16'];
$charLevel = $row2['CurLevel'];
}
$erro="";
$reset = ($charLevel-1)+20;
$remainStats = ($charLevel-1)*3;
if($_GET["r"]=="true"){
//hoje it's the date from the present day
$hoje=date2int(date("Y-m-d"));
//does this char already made a reset sometime?
$jaDeu=mssql_num_rows(mssql_query("select * from _Char_Reset where char_id='".$_GET['char']."'"));
if($jaDeu>0){
//this is not the first time so let's know when it was
$quandoDeu=mssql_query("select * from _Char_Reset where char_id='".$_GET['char']."'");
while ($row = mssql_fetch_array($quandoDeu)) {
$charLastReset = $row['last_reset'];
}
//how much days ago? (today - last reset)
$passaram=$hoje-$charLastReset;
//if already 7 days passed update else you must wait
if($passaram>6){
mssql_query("update _Char_Reset set last_reset='$hoje' where char_id='".$_GET['char']."'");
}else{
$erro="You must wait ".(7-$passaram)." days to reset $charName again";
}
}else{
//insert that today this char made a reset
mssql_query("insert into _Char_Reset (char_id,last_reset) values ('".$_GET['char']."','$hoje')");
}
if($erro==""){
//here we make the reset itself if no errors occur
$conteudo="<br><br><br><p align='center'><font color='#2ed900'>$charName's Status Points were reseted.</font></p>";
mssql_query("update _Char set Strength=$reset, Intellect=$reset, RemainStatPoint=$remainStats where CharID = ".$_GET['char']);
}else{
$conteudo="<br><br><br><br><br><p align='center'><font color='red'>$erro</font></p>";
}
}else{
//here we have a confirmation if the player is sure he want to make the reset
$conteudo="<br><br><br><p align='center'>Are you sure you want to reset $charName's Status Points?</p><p align='center'>Remember that you can only reset it again after 7 days</font>";
$conteudo=$conteudo."<br><br><p align='center'><a href=\"reset.php?char=".$_GET["char"]."&r=true\"><img src=\"styles/img/cp/reset.png\" alt=\"\" border=\"0\"></a></p>";
}
include("theme.php");
Re: Reset status points php page
Well it's not really seems that my scripts are useful anyway if any one would like a unique script that show the daily unique killers... just tell me.
Re: Reset status points php page
Nice One! :D im using it right now in My Web :P can u share ur unique killer daily rank? :P
Re: Reset status points php page
wow =) That's fine here it is.. this just parses the fatal log and will show up a list off all uniques normals and titans and the last player who killed it.
Fell free of course to modify it and maybe make a database recording if you wanna rank them.
Utility: Player can check if a determinate unique was dead long time ago or not.
Problem: everyday at 00:00 will reset out because it's a new file.
Result will be something like this:
Tiger Girl : _Akashia_ (42 m)
Tiger Girl(Titan) : No Death Today
Cerberus : Mr_Esturra (514 m)
Cerberus(Titan) : No Death Today
Captain Ivy : FairyTaIe (194 m)
Captain Ivy(Titan) : No Death Today
Uruchi : No Death Today
Uruchi(Titan) : No Death Today
Isyutaru : Swedish_Wiz (285 m)
Isyutaru(Titan) : No Death Today
Lord Yarkan : _Natsu_ (264 m)
Lord Yarkan(Titan) : No Death Today
Demon Shaytan : Loki (486 m)
Demon Shaytan(Titan) : No Death Today
SoSo the Black Viper(Titan) : Loki (296 m)
Selket : No Death Today
Neith : No Death Today
Isis : No Death Today
Anubis : No Death Today
PHP Code:
<?php
$tg = "No Death Today";
$tgt = "No Death Today";
$ur = "No Death Today";
$urt = "No Death Today";
$isy = "No Death Today";
$isyt = "No Death Today";
$lord = "No Death Today";
$lordt = "No Death Today";
$sh = "No Death Today";
$sht = "No Death Today";
$cer = "No Death Today";
$cert = "No Death Today";
$ivy = "No Death Today";
$ivyt = "No Death Today";
$selket = "No Death Today";
$neith = "No Death Today";
$anubis = "No Death Today";
$isis = "No Death Today";
$soso = "No Death Today";
function uc2un($str,$char,$min){
global $tg, $tgt, $ur, $urt, $isy, $isyt, $lord, $lordt, $sh, $sht, $cer, $cert, $ivy, $ivyt, $selket, $neith, $anubis, $isis, $soso;
if ($str=="MOB_CH_TIGERWOMAN_L3"){
$tgt="$char ($min m)";
}else if ($str=="MOB_CH_TIGERWOMAN"){
$tg="$char ($min m)";
}else if ($str=="MOB_OA_URUCHI"){
$ur="$char ($min m)";
}else if ($str=="MOB_OA_URUCHI_L3"){
$urt="$char ($min m)";
}else if ($str=="MOB_KK_ISYUTARU"){
$isy="$char ($min m)";
}else if ($str=="MOB_KK_ISYUTARU_L3"){
$isyt="$char ($min m)";
}else if ($str=="MOB_TK_BONELORD"){
$lord="$char ($min m)";
}else if ($str=="MOB_TK_BONELORD_L3"){
$lordt="$char ($min m)";
}else if ($str=="MOB_RM_TAHOMET"){
$sh="$char ($min m)";
}else if ($str=="MOB_RM_TAHOMET_L3"){
$sht="$char ($min m)";
}else if ($str=="MOB_EU_KERBEROS"){
$cer="$char ($min m)";
}else if ($str=="MOB_EU_KERBEROS_L3"){
$cert="$char ($min m)";
}else if ($str=="MOB_AM_IVY"){
$ivy="$char ($min m)";
}else if ($str=="MOB_AM_IVY_L3"){
$ivyt="$char ($min m)";
}else if ($str=="MOB_SD_SELKIS"){
$selket="$char ($min m)";
}else if ($str=="MOB_SD_NEITH"){
$neith="$char ($min m)";
}else if ($str=="MOB_SD_ANUBIS"){
$anubis="$char ($min m)";
}else if ($str=="MOB_SD_ISIS"){
$isis="$char ($min m)";
}elseif ($str=="MOB_TQ_BLACKSNAKE_L3"){
$soso="$char ($min m)";
}
}
$todaydate=date("Y-m-d");
$handle = fopen("c:\\SRO SERVER FILES\\".$todaydate."_FatalLog.txt", "r");
$line=1;
$agoram=date("i");
$agorah=date("H");
$agoram=$agoram+(60*$agorah);
while($line){
$line=fgets($handle);
$server=substr($line,20,15);
if($server=="[SR_GameServer]"){
$uniquekilled=substr($line,36,22);
if($uniquekilled=="Unique Monster Killed!"){
$data=substr($line,0,10);
$hora=substr($line,11,8);
$minutos=substr($hora,3,2);
$hora=substr($hora,0,2);
$minutos=(int)$minutos+(60*(int)$hora);
$passou=$agoram-$minutos;
$fimpos=strrpos($line,"]",66);
$fimpos=$fimpos-66;
$uniquestr=substr($line,66,$fimpos);
$fimpos=strrpos($uniquestr,"]");
$unique=substr($uniquestr,0,$fimpos);
$fimpos+=6;
$char=substr($uniquestr,$fimpos,20);
uc2un($unique,$char,$passou);
}
}
}
fclose($handle);
$titulo="Unique Deaths $todaydate";
$conteudo="<font face='verdana' size='2'><br /><b>   <img src='styles/img/title-shield.png' border='0' /> Unique Deaths $todaydate:</b></font>
<br><br><br>
<table width='100%'>
<tr heigth='10px'>
<td align='right' width='50%'>Tiger Girl : </td>
<td align='left' width='50%'>$tg</td>
</tr>
<tr heigth='10px'>
<td align='right'>Tiger Girl(Titan) : </td>
<td align='left'>$tgt</td>
</tr>
<tr heigth='10px'>
<td align='right'>Cerberus : </td>
<td align='left'>$cer</td>
</tr>
<tr heigth='10px'>
<td align='right'>Cerberus(Titan) : </td>
<td align='left'>$cert</td>
</tr>
<tr heigth='10px'>
<td align='right'>Captain Ivy : </td>
<td align='left'>$ivy</td>
</tr>
<tr heigth='10px'>
<td align='right'>Captain Ivy(Titan) : </td>
<td align='left'>$ivyt</td>
</tr>
<tr heigth='10px'>
<td align='right'>Uruchi : </td>
<td align='left'>$ur</td>
</tr>
<tr heigth='10px'>
<td align='right'>Uruchi(Titan) : </td>
<td align='left'>$urt</td>
</tr>
<tr heigth='10px'>
<td align='right'>Isyutaru : </td>
<td align='left'>$isy</td>
</tr>
<tr heigth='10px'>
<td align='right'>Isyutaru(Titan) : </td>
<td align='left'>$isyt</td>
</tr>
<tr heigth='10px'>
<td align='right'>Lord Yarkan : </td>
<td align='left'>$lord</td>
</tr>
<tr heigth='10px'>
<td align='right'>Lord Yarkan(Titan) : </td>
<td align='left'>$lordt</td>
</tr>
<tr heigth='10px'>
<td align='right'>Demon Shaytan : </td>
<td align='left'>$sh</td>
</tr>
<tr heigth='10px'>
<td align='right'>Demon Shaytan(Titan) : </td>
<td align='left'>$sht</td>
</tr>
<tr heigth='10px'>
<td align='right'>SoSo the Black Viper(Titan) : </td>
<td align='left'>$soso</td>
</tr>
<tr heigth='10px'>
<td align='right'>Selket : </td>
<td align='left'>$selket</td>
</tr>
<tr heigth='10px'>
<td align='right'>Neith : </td>
<td align='left'>$neith</td>
</tr>
<tr heigth='10px'>
<td align='right'>Isis : </td>
<td align='left'>$isis</td>
</tr>
<tr heigth='10px'>
<td align='right'>Anubis : </td>
<td align='left'>$anubis</td>
</table>";
include("theme.php");
?>
I hope you make a good work with that ^__^
And if you want so visit LegiaO SRO - Home
Regards SeiS