|
Foros
valor hits de la tabla juegos estropeado
|
Autor
|
Fecha: 26 de Mayo del 2007 a las 15:23:11
Descripción: Ninguna
|
Sexo: Masculino
Mensajes: 344
|
Hola, ahora este valor no cuenta los hits, siempre los pone a 0, a pesar de haber ido al juego muchas veces, está el extra auto_increment, pero no se lo que puede passar, alguien me ayuda?
Podría subir otra vez la tabla de nuevo, pero, entonces perdería los juegos, lo suyo sería volver a subir solo ese valor, pero no se como se hace.
Saludos.
|
|
|
|
Autor
|
Fecha: 26 de Mayo del 2007 a las 16:47:58
Descripción: Ninguna
|
Sexo: Masculino
Mensajes: 344
|
Hola luis, en el jugar.php llama al votar.php mediante una acción, estas son las acciones que realiza en votar.php:
Código 
$cvot = sql_query("select Vot, Med from ".$prefix."_juegos where 1 AND id='$juego'", $dbi);
if (!$cvot) die ("<center><h3>"._RAT0."</h3></center>");
list($Vot, $Med) = sql_fetch_row($cvot, $dbi);
$calc1= ($Vot * $Med);
$calc2= ($puntos + $calc1);
$calc3= ($calc2 / ($Vot+1));
$rat= sql_query("update ".$prefix."_juegos set Vot=Vot+1, Med='$calc3' where 1 AND id='$juego'", $dbi);
if (!$rat) {
OpenTable();
echo "<center><h3>"._RAT1."</h3></center>";
CloseTable();
include ("footer.php");
exit;
}
Captura tabla juegos:
Edito: Ya guarde esta captura, trata de solo aportar la parte necesaria. Algun listillo con esa captura, te hubiera hackeado sin problemas.
Este mensaje fue editado por última vez el 26 de Mayo del 2007 a las 17:38:15 por luis_adolfo.
|
|
|
|
Autor
|
Fecha: 27 de Mayo del 2007 a las 01:48:03
Descripción: Ninguna
|
Sexo: Masculino
Mensajes: 344
|
Aquí está:
Código 
<?php
/************************************************************************/
/* Modulo especial para la gestion de juegos en phpnuke */
/* =========================== */
/* */
/* Copyright (c) 2004 by panzher ( panzher@internetadictos.com */
/* http://www.internetadictos.com */
/* */
/* Este modulo es gratuito. Puedes copiarlo y redistribuirlo libremente */
/* bajo los terminos de la licencia publica GNU. */
/* No elimines el copyright, respeta el trabajo que hacen los demas */
/* NO SEAS LAMMER */
/************************************************************************/
/* 01/11/2004 --- panzher@internetadictos.com */
/************************************************************************/
if (!eregi("modules.php", $PHP_SELF)) {
die ("You can't access this file directly...");
}
require_once("mainfile.php");
global $prefix, $dbi;
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
include ("variables.php");
$index = 0;
include ('header.php');
######################
$juego = $_GET[juego];
$juego = intval($juego);
$prjuego = sql_query("select id, Nomb, Cat, Descr, Img, Swf, An, Al, Hits, Med, Vot from ".$prefix."_juegos where 1 AND id='$juego'", $dbi);
if (!$prjuego) die("ERROR EN LA CONSULTA A LA BASE DE DATOS");
list($id, $Nomb, $Cat, $Descr, $Img, $Swf, $An, $Al, $Hits, $Med, $Vot) = sql_fetch_row($prjuego, $dbi);
$Descr = nl2br($Descr);
$nombre = sql_query("select nombre, reg, hits from ".$prefix."_juegos_cat where 1 AND id='$Cat'", $dbi);
list($cate, $reg, $hits) = sql_fetch_row($nombre, $dbi);
if ($reg == 2 AND !is_user($user) AND !is_admin($admin)) {
OpenTable();
echo "<center><h3>"._SOLOREG."</h3>";
echo "<br><a href="juegos-flash.html"><b>"._MENU."</b></a></center>";
CloseTable();
include ("footer.php");
exit; }
if (!$id) {
OpenTable();
echo "<center><h3>"._NOGAME."</h3>";
echo "<br><a href="juegos-flash.html"><b>"._MENU."</b></a></center>";
CloseTable();
include ("footer.php");
exit; }
$varan = $An;
$varal = $Al;
if ($An > 600) {
$varan = ($An*80)/100;
$varal = ($Al*80)/100;
}
if ($Al > 480) {
$varan = ($An*80)/100;
$varal = ($Al*80)/100;
}
?>
<style type="text/css">
table td.img1 {
width: 9px;
height: 9px;
background: url(http://www.zptweb.net/themes/iCGstation/images/t_01.gif) no-repeat;
}
table td.img2 {
background: url(http://www.zptweb.net/themes/iCGstation/images/t_02.gif) repeat-x;
}
table td.img3 {
width: 9px;
height: 9px;
background: url(http://www.zptweb.net/themes/iCGstation/images/t_03.gif) no-repeat;
}
table td.img4 {
background: url(http://www.zptweb.net/themes/iCGstation/images/t_04.gif) repeat-y;
}
table td.img5 {
background: url(http://www.zptweb.net/themes/iCGstation/images/t_05.gif) repeat-y;
}
table td.img6 {
height: 9px;
background: url(http://www.zptweb.net/themes/iCGstation/images/t_06.gif) no-repeat;
}
table td.img7 {
background: url(http://www.zptweb.net/themes/iCGstation/images/t_07.gif) repeat-x;
}
table td.img8 {
height: 9px;
background: url(http://www.zptweb.net/themes/iCGstation/images/t_08.gif) no-repeat;
}
</style>
</head>
<body>
<br><table align="center" cellpadding="0" cellspacing="0" border="0">
<tr><td class="img1"></td><td class="img2"></td><td class="img3"></td></tr>
<tr><td class="img4"></td><td>
<?php
echo "
<div align='center'><font style='font-size: 30px;' size='2' face='Verdana, Arial, Helvetica, sans-serif'><b>$Nomb<hr></div></b></font>";
?>
<div align="center">
<table width="<?php echo "$varan";?>" height="<?php echo "$varal";?>" border="1" cellpadding="1" cellspacing="1" bordercolor="#006cff">
<tr>
<td><div align="center">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="<?php echo "$varan";?>" height="<?php echo "$varal";?>">
<param name="movie" value="<?php echo"$Swf"; ?>">
<param name="quality" value="high">
<param name="SCALE" value="noborder">
<embed src="<?php echo "$Swf";?>" width="<?php echo "$varan";?>" height="<?php echo "$varal";?>" quality="high"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" scale="noborder"></embed> </object>
</div></td>
</tr>
</table>
<br>
</div>
<table width="140" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000">
<tr>
<td> <form name="form1" method="post" action="<?php echo "modules.php?name=$module_name&file=votar";?>">
<table width="140" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="center">
<select name="puntos" id="puntos">
<option value="10">10</option>
<option value="9">9</option>
<option value="8">8</option>
<option value="7">7</option>
<option value="6">6</option>
<option value="5">5</option>
<option value="4">4</option>
<option value="3">3</option>
<option value="2">2</option>
<option value="1">1</option>
</select>
</div></td>
<td><div align="center">
<input name="voto" type="submit" id="voto" value="Votar">
<input name="juego" type="hidden" id="juego" value="<?php echo "$juego";?>">
</div></td>
</tr>
</table>
</form></td>
</tr>
</table>
<?php
echo "
<div align='center'><font size='2' face='Verdana, Arial, Helvetica, sans-serif'><b>Votos:$Med ($Vot Votos) | Partidas: $Hits </div></b></font></font>";
?>
</td><td class="img5"></td></tr>
<tr><td class="img6"></td><td class="img7"></td><td class="img8"></td></tr>
</table>
<?php
OpenTable();
echo "<div align='center'><center><strong>$Nomb</strong><br>";
echo "<img src='$Img'><br><strong>$Nomb</strong><hr>$Descr</div></center>";
CloseTable();
Opentable();
?>
<center>Para ver correctamente este juego debes tener instalado estos plugins:<br><a target="_blank" href="http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash?Lang=Spanish&P5_Language=Spanish"><img width="88" height="31" border="0" alt="Descargar Plugin Flash Player" src="http://www.zptweb.net/images/get_flash_player.gif" /></a>
<a target="_blank" href="http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=Shockwave?Lang=Spanish&P5_Language=Spanish"><img width="88" height="31" border="0" alt="" src="http://www.zptweb.net/images/get_shockwave_player.gif" /></a></center>
<?php
include ("footer.php");
?>
Saludos.
|
|
|
|
Autor
|
Fecha: 28 de Mayo del 2007 a las 12:58:55
Descripción: Ninguna
|
Sexo: Masculino
Edad: 21 años
Ubicación: Poza Rica, Veracruz
País:
Mensajes: 1269
|
Bueno, ya entendi. El problema esta en que modificaste el archivo y lo echaste a perder; quitaste instrucciones sql que no debiste haber quitado.
Entonces, si no te actualiza las partidas, es porque no tienes la instrucción para ello... tan fácil como añadirlas. El lugar donde las pondrás, será más o menos el mismo que donde estaban por defecto.
Coloca justo después de:
Código PHP 
echo "<img src='$Img'><br><strong>$Nomb</strong><hr>$Descr</div></center>";
CloseTable();
Opentable();
El siguiente código:
Código PHP 
$hits++; $Hits++;
$up1 = sql_query("update ".$prefix."_juegos_cat set hits='$hits' where id='$Cat'", $dbi);
$up2 = sql_query("update ".$prefix."_juegos set Hits='$Hits' where id='$juego'", $dbi);
Es el código original... saludos
|
|
|
|