TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 219
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 115
  • Total: 115

errors log

Started by osquitar, July 21, 2007, 02:03:35 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

osquitar

I have made a php article. In the errors log of my forum there are a lot of messages like this:

8: Undefined variable: elegidos
Archivo: /home/content/o/s/c/oscarorellana/html/elburrero/foro/Themes/default/TPortal.template.php (eval?)
Línea: 22

or this:

8: Undefined index: idCaballo
Archivo: /home/content/o/s/c/oscarorellana/html/elburrero/foro/Themes/default/TPortal.template.php (eval?)
Línea: 16

I an reading the code and I don't understand what is going on, neither what does the message mean.

Any idea?

I know that this topic should be posted in SMF Forum, but I like this forum  :)

G6Cad

Never seen that error before, but from the looks of it, i think you have some other mod installed that causes it.
What mods besides TP do you have ?
Member ID mod or similar ?

osquitar

I think that the mod you are talking about may be my own php article. I tought that I leave some variables in the code but I checked it and I don't found anything.


G6Cad

Can you post the code with in codetags please so we can see how you have it made, it's impossible to know unless we can see it.

osquitar

#4
the code is:

if (!defined('SMF'))
die('Hacking attempt...');

require_once('/home/content/o/s/c/oscarorellana/html/elburrero/foro/SSI.php');

if ($context['user']['is_guest']) {
echo "Para entrar en esta sección, usted debe ser un usuario registrado<br>";
ssi_login();
echo "Si aún no lo has hecho, <a href='http://foro.elburrero.com/index.php?action=register'>Regístrate</a>";
} else {

$p = "smf_Monterrico";
$tarea = $_GET['tarea'];
$fecha = $_GET['fecha'];
$referencia = $_GET['referencia'];
$idCaballo = $_GET['idCaballo'];

$estilos['TituloCarrera']="<font size=+1 color='red'>";
$estilos['TituloCarrera']="<font size=+1 color='red'>";


if ($elegidos) {
echo "<table><tr>";
foreach($elegidos as $nombre) {
echo celda($nombre, "", "", "");
}
echo "</tr></table>";
}

switch ($tarea) {
case 1:
reunion($fecha);
break;
case 2:
carrera($fecha,$referencia);
break;
case 3:
carrera($fecha,$referencia);
referencias($fecha,$referencia,$idCaballo);
break;
default:
fechas();
break;
}

}

function fechas() {
$instruccion = "SELECT DISTINCT fecha FROM smf_Monterrico_reuCarSem";
$consulta = db_query($instruccion, __FILE__, __LINE__);
echo "<div align='center'><b>";
echo "Elija el día de la reunión<br><br>";

while ($fila = mysql_fetch_assoc($consulta)) {
echo "<A HREF = 'index.php?page=6&tarea=1&fecha=" . $fila['fecha'] . "'>" . fechaPeru($fila['fecha']) . "</A><br>";
}
echo "</b></div>";
echo "<br><I>En las siguientes páginas usted encontrará no sólo una forma de ver los programas de la carreras del Hipódromo de Monterrico, sino también un panel de estudios interactivo. En cada carrera se puede ver el estudio técnico de cada ejemplar, así como sus aprontes. También puede usted marcar sus caballos elegidos en cada carrera y solicitar una elección al azar entre ellos.<br><br>";
echo "Esperamos que disfrute de este sitio web. Siéntase libre de escribir un mensaje en el foro con cualquier sugerencia para mejorarlo, así como también cualquier consulta para su uso.</I><br><br>";
echo "<center><IMG SRC='/tp-images/Image/Claudio-y-su-hijo-recibe-pr.jpg'></center>";

}

function reunion($f) {
$instruccion = "SELECT * FROM smf_Monterrico_reuCarSem WHERE fecha = '$f' ORDER BY orden";
$consulta = db_query($instruccion, __FILE__, __LINE__);
echo "<B>" . fechaPeru($f) . "<br>";
echo "Elija la carrera:</B>";
echo "<table border='1'>";
while ($fila = mysql_fetch_assoc($consulta)) {
echo "<tr>";
echo celda(ordenacion($fila['orden']), "<B>", "","", "", "6", "2", $f, $fila['referencia']);
echo celda($fila['distancia'], "", "", "");
echo celda(pista($fila['pista']), "", "", "");
echo celda($fila['condiciones'], "", "", "");
echo celda($fila['clasico'], "", "", "");
echo "</tr>";
}
echo "</table><br>";
echo "<a href = 'index.php?page=6'><b>Elegir otro día</b></a>";
}

function carrera($f,$r) {
$elegidos = $_POST['elegidos'];
$instruccion = "SELECT * FROM smf_Monterrico_reuCarSem WHERE fecha = '$f' AND referencia = '$r' ORDER BY referencia";
$consulta = db_query($instruccion, __FILE__, __LINE__);
$fila = mysql_fetch_assoc($consulta);
echo "<table>";
echo "<tr>";
echo celda(fechaPeru($fila['fecha']),"<B>");
echo "</tr>";
echo "<tr>";
echo celda(ordenacion($fila['orden']) . " carrera " . $fila['distancia'] . " mts. " . pista($fila['pista']). " " .
$fila['condiciones'], "<B>");
echo "</tr></table>";

$instruccion = "SELECT * FROM smf_Monterrico_reuCabSem WHERE fecha = '$f' AND referencia = '$r' ORDER BY realCajon";
$consulta = db_query($instruccion, __FILE__, __LINE__);
$link = "'index.php?page=6&tarea=2&fecha=" . $f . "&referencia=" . $r . "'";
echo "<table border = '1'>";
echo "<form name='formulario' method='post' action=" . $link;
echo "<tr align = 'center'><td>#<td>Caballo<td>Vot.<td>Hd<td>kg<td>Jinete<td>Prep.<td>CC<td>CG<td>Dist<td>Arena<td>Césped<td></tr>";
while ($fila = mysql_fetch_assoc($consulta)) {
echo "<tr>";
echo celda($fila['cajon'], "<B>", "", "");
echo celda($fila['nombre'], "<B>", "", "","", "6", 3, $f, $r, $fila[idCaballo]);
echo celda($fila['votos'], "", "", "","center");
echo celda($fila['handicap'], "", "", "");
echo celda($fila['kilos'], "", "", "");
echo celda($fila['jinete'], "", "", "");
echo celda($fila['preparador'], "", "", "");
echo celda($fila['corridas'], "", "", "","center");
echo celda($fila['ganadas'], "", "", "","center");
echo celda($fila['corDis'] . "-" . $fila['ganDis'], "", "", "","center");
echo celda($fila['corAre'] . "-" . $fila['ganAre'], "", "", "","center");
echo celda($fila['corCes'] . "-" . $fila['ganCes'], "", "", "","center");
/*
echo celda($fila['corDis'], "", "", "","right");
echo celda($fila['ganDis'], "", "", "","right");
echo celda($fila['corAre'], "", "", "","right");
echo celda($fila['ganAre'], "", "", "","right");
echo celda($fila['corCes'], "", "", "","right");
echo celda($fila['ganCes'], "", "", "","right");
*/

if ($elegidos) {
foreach($elegidos as $nombre) {
if ($nombre == $fila['nombre']) {$marca = "checked"; break;} else {$marca = "";}
}
echo "<td>". boton("checkbox", "elegidos[]", $fila['nombre'], $marca) . "</td>";
} else {
echo "<td>". boton("checkbox", "elegidos[]", $fila['nombre'], "checked") . "</td>";
}
echo "</tr>";
}
echo "</table><br>";
echo "<a href = 'index.php?page=6&tarea=1&fecha=" . $f . "'><b>Elegir otra carrera</b></a><br><br>";
echo "<input type = 'submit' name = 'submit' value = 'Sugiérame uno al azar entre los elegidos'><br>";
echo "</form><br>";
$pronostico =rand(1,count($elegidos));
$contador = 1;
if ($elegidos) {
echo "<table border='1'><tr>";
foreach($elegidos as $nombre) {
if ($contador == $pronostico) {
echo celda($nombre, "<B>", "red", "yellow");
} else {
echo celda($nombre);
}
$contador += 1;
}
echo "</tr></table>";
}
}

function referencias($fReu,$fRef,$idCaballo) {
$instruccion = "SELECT * FROM smf_Monterrico_reuCabSem WHERE referencia = '$fRef'
AND idCaballo = '$idCaballo'";
$consulta = db_query($instruccion, __FILE__, __LINE__);
$fila = mysql_fetch_assoc($consulta);

echo "<B>". "<font size=+1>" . $fila['cajon'] . " " . $fila['nombre'] . "</font><br>" . sexo($fila['sexo']) . " " . color($fila['color']) . " " . $fila['edad'] . " años, <br>" . $fila['padre'] . " en " . $fila['madre'] . " por " . $fila['abuelo'] . ". Stud: " . $fila['stud'] . ". Haras: " . $fila['criador']. "</B><br>";


// encuentra la fecha de la última carrera para filtrar (más abajo) los aprontes

$instruccion = "SELECT * FROM smf_Monterrico_reuReferencias WHERE fReferencia = '$fRef'
AND idCaballo = '$idCaballo' ORDER BY fecha DESC, referencia DESC";
$consulta = db_query($instruccion, __FILE__, __LINE__);
$fila = mysql_fetch_assoc($consulta);
$ultimaCarrera = $fila['fecha'];
if (mysql_num_rows($consulta) !== 0) { $debutante = 1; } else { $debutante = 0;}



$instruccion = "SELECT * FROM smf_Monterrico_reuReferencias WHERE fReferencia = '$fRef'
AND idCaballo = '$idCaballo' ORDER BY fecha DESC, referencia DESC";
$consulta = db_query($instruccion, __FILE__, __LINE__);

if ($debutante !== 0) {

// primera parte del estudio

$contratiempos = "* ";
echo "<table border='1'>";
echo "<tr>";
echo "<td>Fecha<td>Ref.<td>Kg.<td>Jinete<td>Cj.<td>Dist.<td>Tmpo<td>Cor<td>Pto.<td>Div<td>Sep.<td>Ganador<td>TH<td>Pfis<td>*</tr>";
echo "</tr>";
while ($fila = mysql_fetch_assoc($consulta)) {
if ($fila['contra'] !== "") {
$contratiempos .= $fila['contra'] . ": " . $fila['contratiempo'] . ". ";
}
echo "<tr>";
echo celda($fila['fecha']);
echo celda($fila['referencia']);
echo celda($fila['kilos']);
echo celda($fila['jinete']);
echo celda($fila['cajon']);
echo celda($fila['distancia'] . " " . $fila['pista'] . " " . nadasicero($fila['baranda']));
echo celda(QuiToTmpo($fila['tiempo']));
echo celda($fila['corrieron']);
echo celda($fila['puesto'] . "º");
echo celda($fila['dividendo']);
echo celda($fila['separacion']);
echo celda($fila['primero']);
echo celda($fila['handicap']);
echo celda($fila['pesoFisico']);
echo celda($fila['contra']);
echo "</tr>";
}
echo "</table><br>";

// segunda parte del estudio

$instruccion = "SELECT * FROM smf_Monterrico_reuReferencias WHERE fReferencia = '$fRef'
AND idCaballo = '$idCaballo' ORDER BY fecha DESC, referencia DESC";
$consulta = db_query($instruccion, __FILE__, __LINE__);
echo "<table border='1'>";
echo "<tr>";
echo "<td>Ref<td>Condic.<td>Desarr.<td>Pto.<td>Primero<td>Segundo<td>Tercero<td>Cuarto</tr>";
echo "</tr>";
while ($fila = mysql_fetch_assoc($consulta)) {
echo "<tr>";
echo celda($fila['referencia']);
echo celda($fila['condiciones']);
echo celda($fila['desarrollo']);
echo celda($fila['puesto'] . "º");
switch ($fila['inteli_1']) {
case 0:
echo celda($fila['primero']);
break;
case 1:
echo celda(strtoupper($fila['primero']),"<B>","red","yellow");
break;
case 2:
echo celda($fila['primero'],"<B>","white","red");
break;
}
switch ($fila['inteli_2']) {
case 0:
echo celda($fila['segundo']);
break;
case 1:
echo celda(strtoupper($fila['segundo']),"<B>","red","yellow");
break;
case 2:
echo celda($fila['segundo'],"<B>","white","red");
break;
}
switch ($fila['inteli_3']) {
case 0:
echo celda($fila['tercero']);
break;
case 1:
echo celda(strtoupper($fila['tercero']),"<B>","red","yellow");
break;
case 2:
echo celda($fila['tercero'],"<B>","white","red");
break;
}
switch ($fila['inteli_4']) {
case 0:
echo celda($fila['cuarto']);
break;
case 1:
echo celda(strtoupper($fila['cuarto']),"<B>","red","yellow");
break;
case 2:
echo celda($fila['cuarto'],"<B>","white","red");
break;
}
echo "</tr>";
}
echo "</table>";
echo $contratiempos . "<br><br>";
} else {
echo "Debutante<br>";
}

// Aprontes

$instruccion = "SELECT * FROM smf_Monterrico_aprontes WHERE idCaballo = '$idCaballo'
AND fecha > '$ultimaCarrera' ORDER BY fecha DESC";
$consulta = db_query($instruccion, __FILE__, __LINE__);
if (mysql_num_rows($consulta) !== 0) {
echo "Aprontes:<br>";
$apro = 1;
} else {
$apro = 0;
}
echo "<table border='1'>";
while ($fila = mysql_fetch_assoc($consulta)) {
echo "<tr>";
echo celda($fila['fecha']);
echo celda($fila['jinete']);
echo celda($fila['distancia']);
echo celda(QuiToTmpo($fila['tiempo']));
echo celda(nadasicero($fila['disFin1']));
echo celda(nadasicerotmpo($fila['tpoFin1']));
echo celda(nadasicero($fila['disFin2']));
echo celda(nadasicerotmpo($fila['tpoFin2']));
echo celda($fila['pista']);
echo celda($fila['calificacion']);
echo "</tr>";
}
echo "</table><br>";
if ($apro == 1) {
echo "<I>Nota: Tanto el estudio como los aprontes están ordenados con la fecha más reciente arriba</I>";
} else {
echo "<I>Nota: El estudio está ordenado con la fecha más reciente arriba</I>";
}
}

function celda($contenido, $bold="", $fontcolor="", $backcolor="", $alineacion="", $page="", $tarea="", $fec="", $ref="", $idC="") {
if ($alineacion !== "") {
$alinea = " align = " . "'" . $alineacion . "'";
} else {
$alinea = "";
}
if ($backcolor !== ""){
$linea = "<td bgcolor=" . "'". $backcolor . "'" . $alinea . ">";
} else {
$linea = "<td" . $alinea . ">";
}
if ($page !== "" ) {
$link .= "<A HREF = 'index.php?page=6";
if ($tarea !== "") {$link .= "&tarea=" . $tarea;}
if ($fec !== "") {$link .= "&fecha=" . $fec;}
if ($ref !== "") {$link .= "&referencia=" . $ref;}
if ($idC !== "") {$link .= "&idCaballo=" . $idC;}
$link .= "'>";
}
$linea .= $link;
$linea .= $bold;
if ($fontcolor !== "") {
$linea .= "<font color=" . "'". $fontcolor. "'>";
}
if ($page !== "") {
$linea .= $contenido . "</A>";
} else {
$linea .= $contenido;
}
if ($bold !== "") {$linea .= str_replace("<", "</", $bold); }
$linea .= "</td>";
return $linea;
}

function boton($tipo, $nombre, $valor, $checked="") {
if ($checked !=="") {$ch = " checked";} else {$ch="";}
return "<input type=" . "'" . $tipo . "'" . " name=" . "'" . $nombre . "'" . " value=" . "'" . $valor . "'" . $ch . ">";
}

function fechaPeru($fecha) {
$ano=substr($fecha,0,4);
$mes=substr($fecha,5,2);
$dia=substr($fecha,8,2);
$fecha=strtotime($fecha);
$meses=array('Nada','Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre');
$dias=array('Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado');
return $dias[date("w",$fecha)] . " " . date("j",$fecha) . " de " . $meses[date("n",$fecha)] . " de " . $ano;
}
function ordenacion($n) {
$ordenado = array('Ninguna','Primera','Segunda','Tercera','Cuarta','Quinta', 'Sexta','Séptima','Octava','Novena','Décima','Undécima','Duodécima');
return $ordenado[$n];  
}
function pista($p) {
if ($p == "C" ) { return "césped"; } else { return "arena"; }
}

function sexo($s) {
switch ($s) {
case "M":
return "Macho";
break;
case "C":
return "Castrado";
break;
case "H":
return "Hembra";
break;
}
}

function color($c) {
switch ($c) {
case "ca":
return "castaño";
break;
case "co":
return "castaño oscuro";
break;
case "al":
return "alazán";
break;
case "za":
return "zaino";
break;
case "to":
return "tordillo";
break;
case "ro":
return "rosillo";
break;
}
}

function QuiToTmpo($q) {
$comillas = '"';
$segundos = intval($q / 5);
$quintos = $q % 5;
$minutos = intval($segundos / 60);
$segundos = $segundos % 60;
return sprintf("%01s'%02s$comillas%s", $minutos,$segundos,$quintos);
}

function nadasicero($a) {
if ($a == 0) {return "";} else {return $a;}
}

function nadasicerotmpo($a) {
if ($a == 0) {return "";} else {return QuiToTmpo($a);}
}

IchBin

Quote from: G6â„¢ on July 21, 2007, 06:35:13 AM
Can you post the code with in codetags please so we can see how you have it made, it's impossible to know unless we can see it.

osquitar

Ok. I did not know how to do it.


if (!defined('SMF'))
die('Hacking attempt...');

require_once('/home/content/o/s/c/oscarorellana/html/elburrero/foro/SSI.php');

if ($context['user']['is_guest']) {
echo "Para entrar en esta sección, usted debe ser un usuario registrado<br>";
ssi_login();
echo "Si aún no lo has hecho, <a href='http://foro.elburrero.com/index.php?action=register'>Regístrate</a>";
} else {

$p = "smf_Monterrico";
$tarea = $_GET['tarea'];
$fecha = $_GET['fecha'];
$referencia = $_GET['referencia'];
$idCaballo = $_GET['idCaballo'];

$estilos['TituloCarrera']="<font size=+1 color='red'>";
$estilos['TituloCarrera']="<font size=+1 color='red'>";


if ($elegidos) {
echo "<table><tr>";
foreach($elegidos as $nombre) {
echo celda($nombre, "", "", "");
}
echo "</tr></table>";
}

switch ($tarea) {
case 1:
// fechas();
reunion($fecha);
break;
case 2:
// fechas();
// reunion($fecha);
carrera($fecha,$referencia);
break;
case 3:
// fechas();
// reunion($fecha);
carrera($fecha,$referencia);
referencias($fecha,$referencia,$idCaballo);
break;
default:
fechas();
break;
}

}

function fechas() {
$instruccion = "SELECT DISTINCT fecha FROM smf_Monterrico_reuCarSem";
$consulta = db_query($instruccion, __FILE__, __LINE__);
echo "<div align='center'><b>";
echo "Elija el día de la reunión<br><br>";

while ($fila = mysql_fetch_assoc($consulta)) {
echo "<A HREF = 'index.php?page=6&tarea=1&fecha=" . $fila['fecha'] . "'>" . fechaPeru($fila['fecha']) . "</A><br>";
}
echo "</b></div>";
echo "<br><I>En las siguientes páginas usted encontrará no sólo una forma de ver los programas de la carreras del Hipódromo de Monterrico, sino también un panel de estudios interactivo. En cada carrera se puede ver el estudio técnico de cada ejemplar, así como sus aprontes. También puede usted marcar sus caballos elegidos en cada carrera y solicitar una elección al azar entre ellos.<br><br>";
echo "Esperamos que disfrute de este sitio web. Siéntase libre de escribir un mensaje en el foro con cualquier sugerencia para mejorarlo, así como también cualquier consulta para su uso.</I><br><br>";
echo "<center><IMG SRC='/tp-images/Image/Claudio-y-su-hijo-recibe-pr.jpg'></center>";

}

function reunion($f) {
$instruccion = "SELECT * FROM smf_Monterrico_reuCarSem WHERE fecha = '$f' ORDER BY orden";
$consulta = db_query($instruccion, __FILE__, __LINE__);
echo "<B>" . fechaPeru($f) . "<br>";
echo "Elija la carrera:</B>";
echo "<table border='1'>";
while ($fila = mysql_fetch_assoc($consulta)) {
echo "<tr>";
echo celda(ordenacion($fila['orden']), "<B>", "","", "", "6", "2", $f, $fila['referencia']);
echo celda($fila['distancia'], "", "", "");
echo celda(pista($fila['pista']), "", "", "");
echo celda($fila['condiciones'], "", "", "");
echo celda($fila['clasico'], "", "", "");
echo "</tr>";
}
echo "</table><br>";
echo "<a href = 'index.php?page=6'><b>Elegir otro día</b></a>";
}

function carrera($f,$r) {
$elegidos = $_POST['elegidos'];
$instruccion = "SELECT * FROM smf_Monterrico_reuCarSem WHERE fecha = '$f' AND referencia = '$r' ORDER BY referencia";
$consulta = db_query($instruccion, __FILE__, __LINE__);
$fila = mysql_fetch_assoc($consulta);
echo "<table>";
echo "<tr>";
// echo "<tr><td><font size=+1 color='red'>";
echo celda(fechaPeru($fila['fecha']),"<B>");
echo "</tr>";
echo "<tr>";
echo celda(ordenacion($fila['orden']) . " carrera " . $fila['distancia'] . " mts. " . pista($fila['pista']). " " .
$fila['condiciones'], "<B>");
echo "</tr></table>";

$instruccion = "SELECT * FROM smf_Monterrico_reuCabSem WHERE fecha = '$f' AND referencia = '$r' ORDER BY realCajon";
$consulta = db_query($instruccion, __FILE__, __LINE__);
$link = "'index.php?page=6&tarea=2&fecha=" . $f . "&referencia=" . $r . "'";
echo "<table border = '1'>";
echo "<form name='formulario' method='post' action=" . $link;
// echo "<tr><td>#<td>Caballo<td>Vot.<td>Hd<td>kg<td>Jinete<td>Prep.<td>CC<td>CG<td>CD<td>GD<td>CA<td>GA<td>CC<td>GC<td></tr>";
echo "<tr align = 'center'><td>#<td>Caballo<td>Vot.<td>Hd<td>kg<td>Jinete<td>Prep.<td>CC<td>CG<td>Dist<td>Arena<td>Césped<td></tr>";
while ($fila = mysql_fetch_assoc($consulta)) {
echo "<tr>";
echo celda($fila['cajon'], "<B>", "", "");
echo celda($fila['nombre'], "<B>", "", "","", "6", 3, $f, $r, $fila[idCaballo]);
echo celda($fila['votos'], "", "", "","center");
echo celda($fila['handicap'], "", "", "");
echo celda($fila['kilos'], "", "", "");
echo celda($fila['jinete'], "", "", "");
echo celda($fila['preparador'], "", "", "");
// echo celda($fila['stud'], "", "", "");
// echo celda($fila['edad'], "", "", "","right");
echo celda($fila['corridas'], "", "", "","center");
echo celda($fila['ganadas'], "", "", "","center");
echo celda($fila['corDis'] . "-" . $fila['ganDis'], "", "", "","center");
echo celda($fila['corAre'] . "-" . $fila['ganAre'], "", "", "","center");
echo celda($fila['corCes'] . "-" . $fila['ganCes'], "", "", "","center");
/*
echo celda($fila['corDis'], "", "", "","right");
echo celda($fila['ganDis'], "", "", "","right");
echo celda($fila['corAre'], "", "", "","right");
echo celda($fila['ganAre'], "", "", "","right");
echo celda($fila['corCes'], "", "", "","right");
echo celda($fila['ganCes'], "", "", "","right");
*/

if ($elegidos) {
foreach($elegidos as $nombre) {
if ($nombre == $fila['nombre']) {$marca = "checked"; break;} else {$marca = "";}
}
echo "<td>". boton("checkbox", "elegidos[]", $fila['nombre'], $marca) . "</td>";
} else {
echo "<td>". boton("checkbox", "elegidos[]", $fila['nombre'], "checked") . "</td>";
}
echo "</tr>";
}
echo "</table><br>";
echo "<a href = 'index.php?page=6&tarea=1&fecha=" . $f . "'><b>Elegir otra carrera</b></a><br><br>";
echo "<input type = 'submit' name = 'submit' value = 'Sugiérame uno al azar entre los elegidos'><br>";
echo "</form><br>";
$pronostico =rand(1,count($elegidos));
$contador = 1;
if ($elegidos) {
echo "<table border='1'><tr>";
foreach($elegidos as $nombre) {
if ($contador == $pronostico) {
echo celda($nombre, "<B>", "red", "yellow");
} else {
echo celda($nombre);
}
$contador += 1;
}
echo "</tr></table>";
}
}

function referencias($fReu,$fRef,$idCaballo) {
$instruccion = "SELECT * FROM smf_Monterrico_reuCabSem WHERE referencia = '$fRef'
AND idCaballo = '$idCaballo'";
$consulta = db_query($instruccion, __FILE__, __LINE__);
$fila = mysql_fetch_assoc($consulta);

echo "<B>". "<font size=+1>" . $fila['cajon'] . " " . $fila['nombre'] . "</font><br>" . sexo($fila['sexo']) . " " . color($fila['color']) . " " . $fila['edad'] . " años, <br>" . $fila['padre'] . " en " . $fila['madre'] . " por " . $fila['abuelo'] . ". Stud: " . $fila['stud'] . ". Haras: " . $fila['criador']. "</B><br>";


// encuentra la fecha de la última carrera para filtrar (más abajo) los aprontes

$instruccion = "SELECT * FROM smf_Monterrico_reuReferencias WHERE fReferencia = '$fRef'
AND idCaballo = '$idCaballo' ORDER BY fecha DESC, referencia DESC";
$consulta = db_query($instruccion, __FILE__, __LINE__);
$fila = mysql_fetch_assoc($consulta);
$ultimaCarrera = $fila['fecha'];
if (mysql_num_rows($consulta) !== 0) { $debutante = 1; } else { $debutante = 0;}



$instruccion = "SELECT * FROM smf_Monterrico_reuReferencias WHERE fReferencia = '$fRef'
AND idCaballo = '$idCaballo' ORDER BY fecha DESC, referencia DESC";
$consulta = db_query($instruccion, __FILE__, __LINE__);

if ($debutante !== 0) {

// primera parte del estudio

$contratiempos = "* ";
echo "<table border='1'>";
echo "<tr>";
echo "<td>Fecha<td>Ref.<td>Kg.<td>Jinete<td>Cj.<td>Dist.<td>Tmpo<td>Cor<td>Pto.<td>Div<td>Sep.<td>Ganador<td>TH<td>Pfis<td>*</tr>";
echo "</tr>";
while ($fila = mysql_fetch_assoc($consulta)) {
if ($fila['contra'] !== "") {
$contratiempos .= $fila['contra'] . ": " . $fila['contratiempo'] . ". ";
}
echo "<tr>";
echo celda($fila['fecha']);
echo celda($fila['referencia']);
echo celda($fila['kilos']);
echo celda($fila['jinete']);
echo celda($fila['cajon']);
echo celda($fila['distancia'] . " " . $fila['pista'] . " " . nadasicero($fila['baranda']));
// echo celda($fila['pista'] . nadasicero($fila['baranda']));
echo celda(QuiToTmpo($fila['tiempo']));
echo celda($fila['corrieron']);
echo celda($fila['puesto'] . "Ã,º");
echo celda($fila['dividendo']);
echo celda($fila['separacion']);
echo celda($fila['primero']);
echo celda($fila['handicap']);
echo celda($fila['pesoFisico']);
echo celda($fila['contra']);
echo "</tr>";
}
echo "</table><br>";

// segunda parte del estudio

$instruccion = "SELECT * FROM smf_Monterrico_reuReferencias WHERE fReferencia = '$fRef'
AND idCaballo = '$idCaballo' ORDER BY fecha DESC, referencia DESC";
$consulta = db_query($instruccion, __FILE__, __LINE__);
echo "<table border='1'>";
echo "<tr>";
echo "<td>Ref<td>Condic.<td>Desarr.<td>Pto.<td>Primero<td>Segundo<td>Tercero<td>Cuarto</tr>";
echo "</tr>";
while ($fila = mysql_fetch_assoc($consulta)) {
echo "<tr>";
echo celda($fila['referencia']);
echo celda($fila['condiciones']);
echo celda($fila['desarrollo']);
echo celda($fila['puesto'] . "Ã,º");
switch ($fila['inteli_1']) {
case 0:
echo celda($fila['primero']);
break;
case 1:
echo celda(strtoupper($fila['primero']),"<B>","red","yellow");
break;
case 2:
echo celda($fila['primero'],"<B>","white","red");
break;
}
switch ($fila['inteli_2']) {
case 0:
echo celda($fila['segundo']);
break;
case 1:
echo celda(strtoupper($fila['segundo']),"<B>","red","yellow");
break;
case 2:
echo celda($fila['segundo'],"<B>","white","red");
break;
}
switch ($fila['inteli_3']) {
case 0:
echo celda($fila['tercero']);
break;
case 1:
echo celda(strtoupper($fila['tercero']),"<B>","red","yellow");
break;
case 2:
echo celda($fila['tercero'],"<B>","white","red");
break;
}
switch ($fila['inteli_4']) {
case 0:
echo celda($fila['cuarto']);
break;
case 1:
echo celda(strtoupper($fila['cuarto']),"<B>","red","yellow");
break;
case 2:
echo celda($fila['cuarto'],"<B>","white","red");
break;
}
echo "</tr>";
}
echo "</table>";
echo $contratiempos . "<br><br>";
} else {
echo "Debutante<br>";
}

// Aprontes

$instruccion = "SELECT * FROM smf_Monterrico_aprontes WHERE idCaballo = '$idCaballo'
AND fecha > '$ultimaCarrera' ORDER BY fecha DESC";
$consulta = db_query($instruccion, __FILE__, __LINE__);
if (mysql_num_rows($consulta) !== 0) {
echo "Aprontes:<br>";
$apro = 1;
} else {
$apro = 0;
}
echo "<table border='1'>";
while ($fila = mysql_fetch_assoc($consulta)) {
echo "<tr>";
echo celda($fila['fecha']);
echo celda($fila['jinete']);
echo celda($fila['distancia']);
echo celda(QuiToTmpo($fila['tiempo']));
echo celda(nadasicero($fila['disFin1']));
echo celda(nadasicerotmpo($fila['tpoFin1']));
echo celda(nadasicero($fila['disFin2']));
echo celda(nadasicerotmpo($fila['tpoFin2']));
echo celda($fila['pista']);
echo celda($fila['calificacion']);
echo "</tr>";
}
echo "</table><br>";
if ($apro == 1) {
echo "<I>Nota: Tanto el estudio como los aprontes están ordenados con la fecha más reciente arriba</I>";
} else {
echo "<I>Nota: El estudio está ordenado con la fecha más reciente arriba</I>";
}
}

function celda($contenido, $bold="", $fontcolor="", $backcolor="", $alineacion="", $page="", $tarea="", $fec="", $ref="", $idC="") {
if ($alineacion !== "") {
$alinea = " align = " . "'" . $alineacion . "'";
} else {
$alinea = "";
}
if ($backcolor !== ""){
$linea = "<td bgcolor=" . "'". $backcolor . "'" . $alinea . ">";
} else {
$linea = "<td" . $alinea . ">";
}
if ($page !== "" ) {
$link .= "<A HREF = 'index.php?page=6";
if ($tarea !== "") {$link .= "&tarea=" . $tarea;}
if ($fec !== "") {$link .= "&fecha=" . $fec;}
if ($ref !== "") {$link .= "&referencia=" . $ref;}
if ($idC !== "") {$link .= "&idCaballo=" . $idC;}
$link .= "'>";
}
$linea .= $link;
$linea .= $bold;
if ($fontcolor !== "") {
$linea .= "<font color=" . "'". $fontcolor. "'>";
}
if ($page !== "") {
$linea .= $contenido . "</A>";
} else {
$linea .= $contenido;
}
if ($bold !== "") {$linea .= str_replace("<", "</", $bold); }
$linea .= "</td>";
return $linea;
}

function boton($tipo, $nombre, $valor, $checked="") {
if ($checked !=="") {$ch = " checked";} else {$ch="";}
return "<input type=" . "'" . $tipo . "'" . " name=" . "'" . $nombre . "'" . " value=" . "'" . $valor . "'" . $ch . ">";
}

function fechaPeru($fecha) {
$ano=substr($fecha,0,4);
$mes=substr($fecha,5,2);
$dia=substr($fecha,8,2);
$fecha=strtotime($fecha);
$meses=array('Nada','Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre');
$dias=array('Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado');
return $dias[date("w",$fecha)] . " " . date("j",$fecha) . " de " . $meses[date("n",$fecha)] . " de " . $ano;
}
function ordenacion($n) {
$ordenado = array('Ninguna','Primera','Segunda','Tercera','Cuarta','Quinta', 'Sexta','Séptima','Octava','Novena','Décima','Undécima','Duodécima');
return $ordenado[$n];  
}
function pista($p) {
if ($p == "C" ) { return "césped"; } else { return "arena"; }
}

function sexo($s) {
switch ($s) {
case "M":
return "Macho";
break;
case "C":
return "Castrado";
break;
case "H":
return "Hembra";
break;
}
}

function color($c) {
switch ($c) {
case "ca":
return "castaño";
break;
case "co":
return "castaño oscuro";
break;
case "al":
return "alazán";
break;
case "za":
return "zaino";
break;
case "to":
return "tordillo";
break;
case "ro":
return "rosillo";
break;
}
}

function QuiToTmpo($q) {
$comillas = '"';
$segundos = intval($q / 5);
$quintos = $q % 5;
$minutos = intval($segundos / 60);
$segundos = $segundos % 60;
return sprintf("%01s'%02s$comillas%s", $minutos,$segundos,$quintos);
}

function nadasicero($a) {
if ($a == 0) {return "";} else {return $a;}
}

function nadasicerotmpo($a) {
if ($a == 0) {return "";} else {return QuiToTmpo($a);}
}

IchBin

For the first error you have this to start approx line #23:

   if ($elegidos)

This variable is undefined. In other words $elegidos has not be assigned to any value.

Second error you have is idCaballo needs single quotes:
echo celda($fila['nombre'], "<B>", "", "","", "6", 3, $f, $r, $fila['idCaballo']);


osquitar

So I must write if(defined($elegidos)) instead?

IchBin

No that is not what you need to do. Let me try to explain.

If you notice in this code the only place you have the $elegidos variable  is in the "if" statement.
if (!defined('SMF'))
die('Hacking attempt...');

require_once('/home/content/o/s/c/oscarorellana/html/elburrero/foro/SSI.php');

if ($context['user']['is_guest']) {
echo "Para entrar en esta sección, usted debe ser un usuario registrado<br>";
ssi_login();
echo "Si aún no lo has hecho, <a href='http://foro.elburrero.com/index.php?action=register'>Regístrate</a>";
} else {

$p = "smf_Monterrico";
$tarea = $_GET['tarea'];
$fecha = $_GET['fecha'];
$referencia = $_GET['referencia'];
$idCaballo = $_GET['idCaballo'];

$estilos['TituloCarrera']="<font size=+1 color='red'>";
$estilos['TituloCarrera']="<font size=+1 color='red'>";


if ($elegidos) {
echo "<table><tr>";
foreach($elegidos as $nombre) {
echo celda($nombre, "", "", "");
}
echo "</tr></table>";
}


PHP is telling you that it does not know what $elegidos is. Because you have not assigned it to any value "yet". What is elegidos supposed to be? Not knowing your language I don't know what this script is trying to do really.

This website is proudly hosted on Crocweb Cloud Website Hosting.