PHP Warning: Undefined array key

This commit is contained in:
Ivor Barhansky 2023-08-29 12:22:15 +03:00
parent 5f48c6f67d
commit 0e832dbbc2

View File

@ -8,7 +8,7 @@ require_once __DIR__ . DIRECTORY_SEPARATOR . '_incl_data/autoload.php';
Config::init(); Config::init();
Database::init(); Database::init();
$u = User::start(); $u = User::start();
$url[2] = '';
$url = explode('?', $_SERVER["REQUEST_URI"]); $url = explode('?', $_SERVER["REQUEST_URI"]);
$url = explode('/', $url[0]); $url = explode('/', $url[0]);
@ -23,7 +23,7 @@ $url = explode('/', $url[0]);
<meta name="viewport" content="width=device-width, initial-scale=0.4, maximum-scale=1.0, user-scalable=yes"/> <meta name="viewport" content="width=device-width, initial-scale=0.4, maximum-scale=1.0, user-scalable=yes"/>
<link rel="stylesheet" type="text/css" href="/i/main.css"> <link rel="stylesheet" type="text/css" href="/i/main.css">
<link href="/i/move/design3.css" rel="stylesheet" type="text/css"> <link href="/i/move/design3.css" rel="stylesheet" type="text/css">
<style type="text/css"> <style>
<!-- <!--
@import url(https://fonts.googleapis.com/css?family=Philosopher&subset=latin,cyrillic); @import url(https://fonts.googleapis.com/css?family=Philosopher&subset=latin,cyrillic);
@ -153,8 +153,8 @@ $url = explode('/', $url[0]);
function MM_preloadImages() { //v3.0 function MM_preloadImages() { //v3.0
var d = document; var d = document;
if (d.images) { if (d.images) {
if (!d.MM_p) d.MM_p = new Array(); if (!d.MM_p) d.MM_p = [];
var i, j = d.MM_p.length, a = MM_preloadImages.arguments; let i, j = d.MM_p.length, a = MM_preloadImages.arguments;
for (i = 0; i < a.length; i++) for (i = 0; i < a.length; i++)
if (a[i].indexOf("#") != 0) { if (a[i].indexOf("#") != 0) {
d.MM_p[j] = new Image; d.MM_p[j] = new Image;
@ -164,12 +164,12 @@ $url = explode('/', $url[0]);
} }
function MM_swapImgRestore() { //v3.0 function MM_swapImgRestore() { //v3.0
var i, x, a = document.MM_sr; let i, x, a = document.MM_sr;
for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
} }
function MM_findObj(n, d) { //v4.01 function MM_findObj(n, d) { //v4.01
var p, i, x; let p, i, x;
if (!d) d = document; if (!d) d = document;
if ((p = n.indexOf("?")) > 0 && parent.frames.length) { if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
d = parent.frames[n.substring(p + 1)].document; d = parent.frames[n.substring(p + 1)].document;
@ -183,8 +183,8 @@ $url = explode('/', $url[0]);
} }
function MM_swapImage() { //v3.0 function MM_swapImage() { //v3.0
var i, j = 0, x, a = MM_swapImage.arguments; let i, j = 0, x, a = MM_swapImage.arguments;
document.MM_sr = new Array; document.MM_sr = [];
for (i = 0; i < (a.length - 2); i += 3) for (i = 0; i < (a.length - 2); i += 3)
if ((x = MM_findObj(a[i])) != null) { if ((x = MM_findObj(a[i])) != null) {
document.MM_sr[j++] = x; document.MM_sr[j++] = x;
@ -240,10 +240,9 @@ $url = explode('/', $url[0]);
<!-- Begin of text --> <!-- Begin of text -->
<style type="text/css"> <style>
.rating, .rating tr, .rating tr td { .rating, .rating tr, .rating tr td {
font-family: Times New Roman; font-family: Georgia, Times, "Times New Roman", serif;
font-size: 14px; font-size: 14px;
border: 1px solid black; border: 1px solid black;
border-collapse: collapse; border-collapse: collapse;
@ -273,7 +272,7 @@ $url = explode('/', $url[0]);
} }
.rating .p { .rating .p {
padding: 0px 5px 0px 5px; padding: 0 5px 0 5px;
} }
.rating .btop { .rating .btop {
@ -312,7 +311,7 @@ $url = explode('/', $url[0]);
h2 { h2 {
text-align: center; text-align: center;
font-family: Times New Roman; font-family: Georgia, Times, "Times New Roman", serif;
font-size: 18px; font-size: 18px;
font-weight: bold; font-weight: bold;
margin: 10px auto 5px; margin: 10px auto 5px;
@ -359,7 +358,7 @@ $url = explode('/', $url[0]);
$sp = mysql_query( $sp = mysql_query(
'SELECT * FROM `aaa_reting_list` WHERE `date` = ' . date( 'SELECT * FROM `aaa_reting_list` WHERE `date` = ' . date(
'dmY' 'dmY'
) . ' ORDER BY '.$bya.' LIMIT 10' ) . ' ORDER BY ' . $bya . ' LIMIT 10'
); );
@ -430,81 +429,84 @@ $url = explode('/', $url[0]);
} }
//----------------------------------------- личный рейтинг //----------------------------------------- личный рейтинг
$spu = mysql_query( if ($u->info) {
'SELECT * FROM `aaa_reting_list` WHERE `date` = "' . date( $spu = mysql_query(
'dmY' 'SELECT * FROM `aaa_reting_list` WHERE `date` = "' . date(
) . '" AND `uid` = "' . $u->info['id'] . '" ORDER BY ' . $bya . ' LIMIT 1' 'dmY'
); ) . '" AND `uid` = "' . $u->info['id'] . '" ORDER BY ' . $bya . ' LIMIT 1'
);
while ($pl = mysql_fetch_array($spu)) {
// while ($pl = mysql_fetch_array($spu)) {
if ($url[2] != 'exp' && $url[2] != 'wins') { //
$last_post = mysql_fetch_array( if ($url[2] != 'exp' && $url[2] != 'wins') {
$last_post = mysql_fetch_array(
mysql_query(
'SELECT `pos` FROM `aaa_reting_list` WHERE `uid` = "' . $pl['uid'] . '" AND `date` != "' . $pl['date'] . '" ORDER BY `id` DESC LIMIT 1'
)
);
}
//
$i++;
$vid = $pl['pos'];
if (isset($last_post['pos']) && $url[2] != 'exp' && $url[2] != 'wins') {
$last_post = $last_post['pos'];
if ($last_post < $pl['pos']) {
$vid = '<img src="//img.new-combats.tech/down_red.png" height="16"> <b>' . $pl['pos'] . '</b> <sup style=\'color:red;\'>-' . ($pl['pos'] - $last_post) . '</sup>';
} elseif ($last_post > $pl['pos']) {
$vid = '<img src="//img.new-combats.tech/up_green.png" height="16"> <b>' . $pl['pos'] . '</b> <sup style=\'color:green;\'>+' . ($last_post - $pl['pos']) . '</sup>';
}
}
//
$html .= "<tr style='border-right: 0px; border-left: 0px;'><td style='border-right: 0px; border-left: 0px;'><b style='color:red;'><big>Ваш рейтинг:</big></b></td><td style='border-right: 0px; border-left: 0px;'></td><td style='border-right: 0px; border-left: 0px;'></td><td style='border-right: 0px; border-left: 0px;'></td></tr>";
$usr = mysql_fetch_array(
mysql_query( mysql_query(
'SELECT `pos` FROM `aaa_reting_list` WHERE `uid` = "' . $pl['uid'] . '" AND `date` != "' . $pl['date'] . '" ORDER BY `id` DESC LIMIT 1' 'SELECT `id`,`login`,`level`,`align`,`align2`,`clan` FROM `users` WHERE `id` = "' . $pl['uid'] . '" LIMIT 1'
) )
); );
} $clrt = '';
// if ('id' . $usr['id'] == $url[2]) {
$i++; $clrt = ' bgcolor="#c3a878"';
$vid = $pl['pos']; }
if (isset($last_post['pos']) && $url[2] != 'exp' && $url[2] != 'wins') { $html .= "<tr" . $clrt . "><td class='vam p' style='font-size: 14pt;'><b>" . $vid . "</b><a name='" . $usr['id'] . "' /></td>
$last_post = $last_post['pos']; <td class='vam al' style='padding-left: 20px;'><img src='//img.new-combats.tech/i/align/align" . $usr['align'] . ".gif' />";
if ($last_post < $pl['pos']) { if ($usr['align2'] > 0) {
$vid = '<img src="//img.new-combats.tech/down_red.png" height="16"> <b>' . $pl['pos'] . '</b> <sup style=\'color:red;\'>-' . ($pl['pos'] - $last_post) . '</sup>'; $html .= '<img src="//img.new-combats.tech/i/align/align' . $usr['align2'] . '.gif" /> ';
} elseif ($last_post > $pl['pos']) { }
$vid = '<img src="//img.new-combats.tech/up_green.png" height="16"> <b>' . $pl['pos'] . '</b> <sup style=\'color:green;\'>+' . ($last_post - $pl['pos']) . '</sup>'; if ($usr['clan'] > 0) {
$html .= '<img src="//img.new-combats.tech/i/clan/' . $usr['clan'] . '.gif" /> ';
}
$html .= '<b>' . $usr['login'] . '</b> [' . $usr['level'] . '] <a href="/info/' . $usr['id'] . '" target="_blank"><img src="//img.new-combats.tech/i/inf_capitalcity.gif" /></a></td>
';
if ($url[2] != 'exp' && $url[2] != 'wins') {
$html .= '<td class=\'vam p\' style=\'font-size: 14pt;\'><b>' . round(
$pl['global'], 2
) . '</b></td>';
} else {
$html .= '<td class=\'vam p\' style=\'font-size: 14pt;\'>' . round(
$pl['global'], 2
) . '</td>';
}
if ($url[2] == 'exp') {
$html .= '<td class=\'vam p\' style=\'font-size: 14pt;\'><b>' . number_format(
$pl['exp_real'], 0, ",", " "
) . '</b></td></tr>';
} elseif ($url[2] == 'wins') {
$html .= '<td class=\'vam p\' style=\'font-size: 14pt;\'><b>' . number_format(
$pl['win'], 0, ",", " "
) . '</b></td></tr>';
} else {
$html .= '<td class=\'vam p\' style=\'font-size: 14pt;\'>' . number_format(
$pl['exp_real'], 0, ",", " "
) . '</td></tr>';
} }
} }
//
$html .= "<tr style='border-right: 0px; border-left: 0px;'><td style='border-right: 0px; border-left: 0px;'><b style='color:red;'><big>Ваш рейтинг:</big></b></td><td style='border-right: 0px; border-left: 0px;'></td><td style='border-right: 0px; border-left: 0px;'></td><td style='border-right: 0px; border-left: 0px;'></td></tr>";
$usr = mysql_fetch_array(
mysql_query(
'SELECT `id`,`login`,`level`,`align`,`align2`,`clan` FROM `users` WHERE `id` = "' . $pl['uid'] . '" LIMIT 1'
)
);
$clrt = '';
if ('id' . $usr['id'] == $url[2]) {
$clrt = ' bgcolor="#c3a878"';
}
$html .= "<tr" . $clrt . "><td class='vam p' style='font-size: 14pt;'><b>" . $vid . "</b><a name='" . $usr['id'] . "' /></td>
<td class='vam al' style='padding-left: 20px;'><img src='//img.new-combats.tech/i/align/align" . $usr['align'] . ".gif' />";
if ($usr['align2'] > 0) {
$html .= '<img src="//img.new-combats.tech/i/align/align' . $usr['align2'] . '.gif" /> ';
}
if ($usr['clan'] > 0) {
$html .= '<img src="//img.new-combats.tech/i/clan/' . $usr['clan'] . '.gif" /> ';
}
$html .= '<b>' . $usr['login'] . '</b> [' . $usr['level'] . '] <a href="/info/' . $usr['id'] . '" target="_blank"><img src="//img.new-combats.tech/i/inf_capitalcity.gif" /></a></td>
';
if ($url[2] != 'exp' && $url[2] != 'wins') {
$html .= '<td class=\'vam p\' style=\'font-size: 14pt;\'><b>' . round(
$pl['global'], 2
) . '</b></td>';
} else {
$html .= '<td class=\'vam p\' style=\'font-size: 14pt;\'>' . round(
$pl['global'], 2
) . '</td>';
}
if ($url[2] == 'exp') {
$html .= '<td class=\'vam p\' style=\'font-size: 14pt;\'><b>' . number_format( echo $html;
$pl['exp_real'], 0, ",", " " unset($html);
) . '</b></td></tr>';
} elseif ($url[2] == 'wins') {
$html .= '<td class=\'vam p\' style=\'font-size: 14pt;\'><b>' . number_format(
$pl['win'], 0, ",", " "
) . '</b></td></tr>';
} else {
$html .= '<td class=\'vam p\' style=\'font-size: 14pt;\'>' . number_format(
$pl['exp_real'], 0, ",", " "
) . '</td></tr>';
}
} }
echo $html;
unset($html);
?> ?>
</table> </table>