Mira ese es todo el codigo del archivo lo que quiero hacer yo es q me suba el valor level, si $xpminier es >= que $XpMinierUp
como podria quedar, soy nuevo en esto de programar php
Código PHP :
<?php include("config.php"); session_start(); ?>
<head>
<title>War Weapon 1.0</title>
<link REL="shortcut icon" HREF="images/favicon.ico">
<link rel=stylesheet type="text/css" href="css/un_main2.css"/>
<meta name="content-language" content="en"/>
<meta http-equiv="imagetoolbar" content="no"/>
<script src="scripts/m_un2.js" type=text/javascript></script>
<style type="text/css" media="screen"></style></head>
<?php
if (!session_is_registered("user") || !session_is_registered("pass")) {
include("sub/sidebar.php");
print "la seccion ha expirado, vuelve a iniciar seccion.";
print "<META http-equiv=refresh content=2;URL=index.php>";
exit;
}
$stat = mysql_fetch_array(mysql_query("select * from players where user='$user' and pass='$pass'"));
if (empty ($stat[id])) {
include("sub/sidebar.php");
print "Identificacion invalida, vuelve a probar.";
exit;
}
$ctime = time();
mysql_query("update players set lpv=$ctime where id=$stat[id]");
$ip = "$HTTP_SERVER_VARS[REMOTE_ADDR]";
mysql_query("update players set ip='$ip' where id=$stat[id]");
mysql_query("update players set page='$title' where id=$stat[id]");
//Ascender de nivel
//NO funciona todavia
$XpMinierUp = $stat[level] * 50; //experiencia maxima
$XpMinier = $stat[exp]; //experiencia
$LvlUpMinier = $stat[level] + 1; //1nivel mas
if ($XpMinier >= $XpMinierUp) {
$QryUpdatePlayer = "UPDATE {{table}} SET ";
$QryUpdatePlayer .= "level = '".$LvlUpMinier."', ";
$QryUpdatePlayer .= "WHERE ";
$QryUpdatePlayer .= "id = '". $stat[id] ."';";
doquery( $QryUpdatePlayer, players);
}
?>
<center>
<table width=1010 class=td cellpadding=0 cellspacing=0>
<tr><td align=center background=images/wars.gif height=140 valign=middle>
</td>
</tr>
</table>
<table width=900 valign=top class=td cellpadding=0 cellspacing=0>
<?php include("toolbar.php"); ?>
</td></tr>
<tr><td>
<table>
<tr><td valign=top width=185 >
<table cellpadding=0 cellspacing=0 class=td width=100%>
<tr><td style="border-bottom: solid black 1px;" text=eeeeee align=center background=images/separador.gif>
<b><font color="white">Estadisticas</font></b>
</td></tr>
<tr><td background=images/border.gif>
<?php
print "<center><b><u>$stat[user]</b></u> ($stat[id])</center><br>";
print "<b>Nivel:</b> $stat[level]<br>";
$expn = (($stat[level] * 50) + ($stat[level] * 15));
$pct = (($stat[exp]/$expn) * 100);
$pct = round($pct,"0");
print "<b>Exp:</b> $stat[exp]/$expn ($pct%)<br>";?>
<?php
print "<b>Vida:</b> $stat[hp]/$stat[max_hp]<br>";
print "<b>Energia:</b> $stat[energy]/$stat[max_energy]<br><br>";
print "<b>Creditos:</b> $stat[credits]<br>";
print "<b>Deposito:</b> $stat[bank]<br>";
print "<b>Oro:</b> $stat[platinum]<br>";
if ($stat[mines] > 0) {
print "<b>Burelia:</b> $stat[burelia]<br>";
print "<b>Alethite:</b> $stat[alethite]<br>";
}
?>
</td></tr>
</table>
<img src="images/separadorw2.gif" width="186" height="20"><br>
<br>
<table cellpadding=0 cellspacing=0 class=td width=100% background=images/border.gif >
<tr><td style="border-bottom: solid black 1px;" bgcolor=eeeeee align=center background=images/separador.gif>
<b><font color="white">Navegacion</font></b>
</td></tr>
<tr><td style="background-image: url(images/border.gif); background-position: bottom left; background-repeat: no-repeat;">
- <a href=stats.php>Vision General</a><br>
- <a href=equip.php>Equipo</a><br>
<?php
$numlog = mysql_num_rows(mysql_query("select * from log where unread='F' and owner=$stat[id]"));
print "- <a href=log.php>Eventos</a> [$numlog]<br><br>";
?>
- <a href=city.php>Ciudad</a><br>
- <a href=battle.php>Arena</a><br>
<?php
$healneed = ($stat[max_hp] - $stat[hp]);
print "- <a href=hospital.php>Hospital</a> [$healneed cr]<br>";
?>
<?php
if ($stat[tribe]) {
print "- <a href=tribes.php?view=my>Tribu</a><br>";
}
?>
- <a href=bank.php>Banco</a><br><br>
- <a href=forums.php?view=topics>Foros</a><br>
<?php
$psel = mysql_query("select * from players where page='Chat'");
$ctime = time();
while ($pl = mysql_fetch_array($psel)) {
$span = ($ctime - $pl[lpv]);
if ($span <= 180) {
$numoc = ($numoc + 1);
}
}
$numoc = ($numoc + 0);
print "- <a href=chat.php>Chat</a> [$numoc]<br><br>";
?>
<?php
if ($stat[rank] == Admin) {
print "<br>- <a href=admin.php>Admin</a>";
}
?>
<?php
if ($stat[rank] == Staff) {
print "<br>- <a href=sub/Admin/staff.php>Staff</a>";
}
?>
<img src="images/separadorw2.gif" width="186" height="20"></td>
</tr>
</table>
</td><td width=400 valign=top>
<table cellpadding=0 cellspacing=0 class=td width=500>
<tr><td style="border-bottom: solid black 1px;" bgcolor=eeeeee align=center background=images/separador3.gif>
<?php print "<b>$title</b>"; ?>
</td></tr>
<tr><td>
</div>
Perdon si molesto