numrows($rs) > $indice){ $this->id = $_conexion->result($rs, $indice, 'id'); $this->idUser = $_conexion->result($rs, $indice, 'idUser'); $this->nSocio = $_conexion->result($rs, $indice, 'nSocio'); $this->nomComplet = $_conexion->result($rs, $indice, 'nomComplet'); $this->poblacio = $_conexion->result($rs, $indice, 'poblacio'); $this->nivell = $_conexion->result($rs, $indice, 'nivell'); $this->tempsMax = $_conexion->result($rs, $indice, 'tempsMax'); $this->clientBrowser = $_conexion->result($rs, $indice, 'clientBrowser'); $this->clientIP = $_conexion->result($rs, $indice, 'clientIP'); $this->dataInici = $_conexion->result($rs, $indice, 'dataInici'); $this->dataFinal = $_conexion->result($rs, $indice, 'dataFinal'); $this->nomatches = $_conexion->result($rs, $indice, 'nomatches'); $this->parelles = $_conexion->result($rs, $indice, 'parelles'); $this->punts = $_conexion->result($rs, $indice, 'punts'); $this->tempsTrigat = $_conexion->result($rs, $indice, 'tempsTrigat'); $this->gcode = $_conexion->result($rs, $indice, 'gcode'); } } function getCantTotal(){ global $_conexion; $sql = "SELECT count(*) as cantidad FROM concursoVerano2015_partidas"; $rs = $_conexion->query($sql); $cant = $_conexion->numrows($rs); return ($cant > 0) ? $_conexion->result($rs, 0, "cantidad") : 0; } //Generamos la funcion de recoger por id; function getById($id){ global $_conexion; $item = new ConcursoVerano2015Partidas(); if($id != ''){ $sql = "SELECT * FROM concursoVerano2015_partidas WHERE id = $id"; $rs = $_conexion->query($sql); $item->cargar($rs, 0); } return $item; } //Generamos la funcion de recoger por id; function getByGcode($gcode){ global $_conexion; $item = new ConcursoVerano2015Partidas(); if($gcode != ''){ $sql = "SELECT * FROM concursoVerano2015_partidas WHERE gcode = '$gcode'"; $rs = $_conexion->query($sql); $item->cargar($rs, 0); $item->lastQuery = $sql; } return $item; } //Generamos el metodo que ejecuta un sql de listado; function getListadoSQL($sql){ global $_conexion; $rs = $_conexion->query($sql); $cant = $_conexion->numrows($rs); $listado = Array(); for($cont = 0; $cont < $cant; $cont++){ $item = new ConcursoVerano2015Partidas(); $item->cargar($rs, $cont); array_push($listado, $item); } return $listado; } //Generamos el metodo que devuelve todo el listado de elementos; function getListado(){ $sql = "SELECT * FROM concursoVerano2015_partidas"; return ConcursoVerano2015Partidas::getListadoSQL($sql); } //Generamos el metodo que devuelve el listado paginado function getListadoPag($cantidad, $pagina, &$cantTotal){ global $_conexion; $inicio = $cantidad * $pagina; $sql = "SELECT count(*) AS cantidad FROM concursoVerano2015_partidas"; $rs = $_conexion->query($sql); $cantTotal = $_conexion->result($rs, 0, "cantidad"); $orden = ""; $sql = "SELECT * FROM concursoVerano2015_partidas $orden LIMIT $inicio, $cantidad"; return ConcursoVerano2015Partidas::getListadoSQL($sql); } function getRankingHoy(){ $sql = " "; $sql .= " SELECT tt.* FROM concursoVerano2015_partidas tt "; $sql .= " INNER JOIN ("; $sql .= " SELECT idUser, MAX(punts) AS maxpuntuacion"; $sql .= " FROM concursoVerano2015_partidas"; $sql .= " WHERE date(dataFinal) = date(now())"; $sql .= " GROUP BY idUser"; $sql .= " ) "; $sql .= " concursoVerano2015_partidas ON tt.idUser = concursoVerano2015_partidas.idUser AND tt.punts = concursoVerano2015_partidas.maxpuntuacion"; $sql .= " WHERE date(tt.dataFinal) = date(now()) "; $sql .= " ORDER BY tt.punts DESC"; return ConcursoVerano2015Partidas::getListadoSQL($sql); } function getListGanadores(){ global $_conexion; //Recogemos los dias en los que ha habido sorteo $sql = "SELECT DISTINCT(date(dataFinal)) AS dataFinal FROM concursoVerano2015_partidas WHERE date(dataFinal) < date(now()) ORDER BY dataFinal DESC"; //echo "sql: ".$sql."
"; $rs = $_conexion->query($sql); $cant = $_conexion->numrows($rs); $listado = Array(); for($cont = 0; $cont < $cant; $cont++){ $fecha = $_conexion->result($rs, $cont, "dataFinal"); $sql2 = "SELECT * FROM concursoVerano2015_partidas as tabla2 WHERE date(dataFinal) = '".$fecha."' AND punts > 0 ORDER BY punts DESC, dataFinal ASC LIMIT 1"; $rs2 = $_conexion->query($sql2); $cant2 = $_conexion->numrows($rs2); if($cant2 > 0){ $item = new ConcursoVerano2015Partidas(); $item->cargar($rs2, 0); array_push($listado, $item); } } $premios = Array(); //Cambiamos los ganadores que han salido mas de 3 veces for($cont = count($listado)-1; $cont >= 0; $cont--){ $ganador = $listado[$cont]; ConcursoVerano2015Partidas::addPremio($premios, $ganador->idUser); if($premios[$ganador->idUser] > 3){ $listado[$cont] = ConcursoVerano2015Partidas::getOtroGanador($ganador->dataFinal, $ganador->idUser); ConcursoVerano2015Partidas::addPremio($premios, $listado[$cont]->idUser); } } return $listado; } function addPremio(&$listado, $idUser){ if(!isset($listado[$idUser])) $listado[$idUser] = 0; $listado[$idUser]++; } function getOtroGanador($fecha, $idUser){ global $_conexion; $ganador = new ConcursoVerano2015Partidas(); /* fechaUsa($fecha) */ $sql = "SELECT * FROM concursoVerano2015_partidas WHERE date(dataFinal) = '".substr($fecha,0,10)."' "; $sql .= " AND idUser != $idUser ORDER BY punts DESC, dataFinal ASC LIMIT 0, 1"; $rs = $_conexion->query($sql); $cant = $_conexion->numrows($rs); if($cant > 0){ $ganador->cargar($rs, 0); } return $ganador; } //Generamos la funcion de guardar function guardar(){ global $_conexion; if($this->idUser == '') $this->idUser = 0; if($this->nivell == '') $this->nivell = 0; if($this->tempsMax == '') $this->tempsMax = 0; if($this->nomatches == '') $this->nomatches = 0; if($this->parelles == '') $this->parelles = 0; if($this->punts == '') $this->punts = 0; if($this->tempsTrigat == '') $this->tempsTrigat = 0; $this->dataFinal = fechaUsa($this->dataFinal); $this->clientBrowser = $_SERVER["HTTP_USER_AGENT"]; $this->clientIP = $_SERVER["REMOTE_ADDR"]; if($this->id == ''){ $this->dataInici = date('Y-m-d H:i:s'); $this->gcode = md5($this->id.$this->idUser.$this->poblacio.$this->dataInici); $sql = "INSERT INTO concursoVerano2015_partidas ("; $sql .= " idUser "; $sql .= ", nSocio "; $sql .= ", nomComplet "; $sql .= ", poblacio "; $sql .= ", nivell "; $sql .= ", tempsMax "; $sql .= ", clientBrowser "; $sql .= ", clientIP "; $sql .= ", nomatches "; $sql .= ", parelles "; $sql .= ", punts "; $sql .= ", tempsTrigat "; $sql .= ", dataInici "; $sql .= ", gcode "; $sql .= ") VALUES ("; $sql .= " '$this->idUser'"; $sql .= ", '$this->nSocio'"; $sql .= ", '$this->nomComplet'"; $sql .= ", '$this->poblacio'"; $sql .= ", '$this->nivell'"; $sql .= ", '$this->tempsMax'"; $sql .= ", '$this->clientBrowser'"; $sql .= ", '$this->clientIP'"; $sql .= ", '0'"; $sql .= ", '0'"; $sql .= ", '0'"; $sql .= ", '0'"; $sql .= ", '$this->dataInici'"; $sql .= ", '$this->gcode'"; $sql .= ")"; $rs = $_conexion->query($sql); $this->id = $_conexion->insertId(); }else{ $this->dataFinal = date('Y-m-d H:i:s'); $this->gcode = "FINAL_". md5($this->id.$this->idUser.$this->poblacio.$this->dataInici); $sql = "UPDATE concursoVerano2015_partidas SET "; $sql .= "idUser = '$this->idUser' "; $sql .= ",nSocio = '$this->nSocio' "; $sql .= ",nomComplet = '$this->nomComplet' "; $sql .= ",poblacio = '$this->poblacio' "; $sql .= ",nivell = '$this->nivell' "; $sql .= ",clientBrowser = '$this->clientBrowser' "; $sql .= ",clientIP = '$this->clientIP' "; $sql .= ",dataFinal = '$this->dataFinal' "; $sql .= ",nomatches = '$this->nomatches' "; $sql .= ",parelles = '$this->parelles' "; $sql .= ",gcode = '$this->gcode' "; if (($this->dataInici != null)&&($this->dataFinal != null)){ $timeFirst = strtotime($this->dataInici); $timeSecond = strtotime($this->dataFinal); $this->tempsTrigat = $timeSecond - $timeFirst; $sql .= ",tempsTrigat = '$this->tempsTrigat' "; } $this->punts = $this->punts + ($this->tempsMax - $this->tempsTrigat)*ConcursoVerano2015Partidas::BONUS_PER_SEGON; $sql .= ",punts = '$this->punts' "; $sql .= " WHERE id = '$this->id'"; $rs = $_conexion->query($sql); } $this->lastQuery = $sql; } function delete($id){ global $_conexion; $sql = "DELETE FROM concursoVerano2015_partidas WHERE id = $id"; $_conexion->query($sql); } } class ConcursoVerano2015Preguntes{ var $id; var $pregunta; var $respuesta; var $opcion_a; var $opcion_b; var $opcion_c; function cargar($rs, $indice){ global $_conexion; if($_conexion->numrows($rs) > $indice){ $this->id = $_conexion->result($rs, $indice, 'id'); $this->pregunta = $_conexion->result($rs, $indice, 'pregunta'); $this->respuesta = $_conexion->result($rs, $indice, 'respuesta'); $this->opcion_a = $_conexion->result($rs, $indice, 'opcion_a'); $this->opcion_b = $_conexion->result($rs, $indice, 'opcion_b'); $this->opcion_c = $_conexion->result($rs, $indice, 'opcion_c'); } } function getCantTotal(){ global $_conexion; $sql = "SELECT count(*) as cantidad FROM concursoVerano2015_preguntas"; $rs = $_conexion->query($sql); $cant = $_conexion->numrows($rs); return ($cant > 0) ? $_conexion->result($rs, 0, "cantidad") : 0; } //Generamos la funcion de recoger por id; function getById($id){ global $_conexion; $item = new ConcursoVerano2015Preguntes(); if($id != ''){ $sql = "SELECT * FROM concursoVerano2015_preguntas WHERE id = '$id'"; $rs = $_conexion->query($sql); $item->cargar($rs, 0); } return $item; } //Generamos la funcion de recoger por id; function getRandomQuestion(){ global $_conexion; $item = new ConcursoVerano2015Preguntes(); $sql = "SELECT * FROM concursoVerano2015_preguntas T JOIN (SELECT FLOOR(MAX(ID)*RAND()) AS ID FROM concursoVerano2015_preguntas) AS x ON T.ID >= x.ID LIMIT 1;"; $rs = $_conexion->query($sql); $item->cargar($rs, 0); return $item; } //Generamos la funcion de recoger por id; function checkIfCorrectAnswer($inIdQuestion, $answered = 0){ global $_conexion; $item = new ConcursoVerano2015Preguntes(); if($inIdQuestion != ''){ $sql = "SELECT * FROM concursoVerano2015_preguntas WHERE id = '$inIdQuestion';"; $rs = $_conexion->query($sql); $item->cargar($rs, 0); } return ($item->respuesta == $answered); } //Generamos el metodo que ejecuta un sql de listado; function getListadoSQL($sql){ global $_conexion; $rs = $_conexion->query($sql); $cant = $_conexion->numrows($rs); $listado = Array(); for($cont = 0; $cont < $cant; $cont++){ $item = new ConcursoVerano2015Preguntes(); $item->cargar($rs, $cont); array_push($listado, $item); } return $listado; } //Generamos el metodo que devuelve todo el listado de elementos; function getListado(){ $sql = "SELECT * FROM concursoVerano2015_preguntas"; return ConcursoVerano2015Preguntes::getListadoSQL($sql); } } ?> Club Geronimo Stilton – El club
Concurso de Verano: Memory

El Club Geronimo Stilton > Concursos


¡Por mil gatos pardos! Muchíiiiiiisimas gracias a tod@s por participar en el Memory del verano! ¡Espero que hayáis puesto a prueba vuestra memoria ratuna! ¡Requetebigotes! ¡Ya tenemos el nombre de l@s ganador@s del concurso!


Carpeta + libreta
Fecha Nombre Puntos
02/07/15 23:14 MIGUEL RUBIO 3750
03/07/15 10:44 GUILLEM GELPI 4030
04/07/15 15:10 CARMEN AGUIRRE 3850
05/07/15 16:58 DIEGO ROMAGNOLI 3970
06/07/15 14:16 DIEGO ROMAGNOLI 4110
07/07/15 13:07 GUILLEM GELPI 3862
08/07/15 14:04 IVÁN CHUDYK 4020
09/07/15 10:48 ELENA VILLALONGA 3680
10/07/15 22:03 JORDI G. AGUIRRE 4200
11/07/15 15:01 IVÁN CHUDYK 4090
12/07/15 16:59 MARIA GALLEGO 4020
13/07/15 23:52 VLADIMIR CHUDYK 4060
14/07/15 10:26 JORDI G. AGUIRRE 3964
15/07/15 13:15 GUILLEM GELPI 4040
16/07/15 17:51 DANIEL JIMENEZ 4050
17/07/15 13:53 CARMEN AGUIRRE 4000
18/07/15 15:50 JOSE ANTONIO HERRERA 3780
19/07/15 19:27 ALEJANDRA FORNELL 3690
20/07/15 13:05 SILVIA M 3810
21/07/15 00:06 ANTONIO HERNANDEZ 3990
22/07/15 13:46 JORDI G. AGUIRRE 3874
23/07/15 12:43 BIEL GELPI 3862
24/07/15 10:10 PABLO TORRADO 3830
25/07/15 12:27 PAULA CHANA 3770
26/07/15 09:31 PAULA CHANA 3920
27/07/15 19:28 JUDIT JIMENEZ 4090
28/07/15 12:32 CARMEN AGUIRRE 4030
29/07/15 11:13 ANTONIO MANUEL TORRADO 3970
30/07/15 15:05 PABLO TORRADO 3900
31/07/15 08:43 ANTONIO MANUEL TORRADO 3880
01/08/15 18:01 PAULA CHANA 3930
02/08/15 12:50 NOELIA CERRATO 3960
03/08/15 13:00 PABLO TORRADO 3930
04/08/15 11:27 ANTONIO MANUEL TORRADO 3900
05/08/15 12:51 BIEL GELPI 4030
06/08/15 18:38 NOELIA CERRATO 3870
07/08/15 19:53 DANIEL JIMENEZ 4080
08/08/15 12:04 NOELIA CERRATO 3970
09/08/15 12:58 JOSE ANTONIO HERRERA 3770
10/08/15 11:29 BIEL GELPI 3920
11/08/15 10:30 LAURA SAN MILLÁN 3690
12/08/15 02:12 SOFÍA ALVAREZ 3660
13/08/15 18:11 DANIELA CHANA 3800
14/08/15 00:28 SOFÍA ALVAREZ 3650
15/08/15 10:24 NARA MEJIAS 3880
16/08/15 10:24 NARA MEJIAS 3850
17/08/15 09:42 DANIELA CHANA 3720
18/08/15 00:27 MARINA CASTILLO 3960
19/08/15 20:31 DANIELA CHANA 3870
20/08/15 12:18 ANNA PALOMERAS 3750
21/08/15 08:43 MIREIA PALOMERAS 3760
22/08/15 15:01 GONZALO GARCIA 3740
23/08/15 20:41 ALEJANDRA FORNELL 3650
24/08/15 11:35 ALEJANDRA FORNELL 3670
25/08/15 21:00 NARA MEJIAS 3860
26/08/15 19:48 SOFÍA ALVAREZ 3630
27/08/15 15:37 ANNA PALOMERAS 3910
28/08/15 11:38 MIREIA PALOMERAS 3860
29/08/15 11:56 ELENA ZABALA 3630
30/08/15 21:38 MANUEL ZABALA 3580
31/08/15 10:34 ATTENERI CASQUERO 3640
01/09/15 16:58 IVÁN CHUDYK 4130
02/09/15 15:36 VLADIMIR CHUDYK 3980
03/09/15 11:43 ATTENERI CASQUERO 3680
04/09/15 16:17 LUCIA-ALBA ORTIZ 3680
05/09/15 21:01 SILVIA M 3960
06/09/15 18:00 VLADIMIR CHUDYK 4230
07/09/15 12:54 TOñO RIOS 3660
08/09/15 08:05 DAVID DOñATE 3330

Agenda del Reino de la Fantasía
Nombre Población Puntos
VLADIMIR CHUDYK Guadalajara 4230
JORDI G. AGUIRRE Blanes 4200
IVÁN CHUDYK Guadalajara 4130
DIEGO ROMAGNOLI Astillero 4110
JUDIT JIMENEZ Dosbarrios 4090
DANIEL JIMENEZ Dosbarrios 4080
GUILLEM GELPI Malgrat de Mar 4040
BIEL GELPI Malgrat de Mar 4030
CARMEN AGUIRRE Blanes 4030
MARIA GALLEGO Dosbarrios 4020
ADRIAN ARIZA utebo 4000
ANTONIO HERNANDEZ Murcia 3990
NOELIA CERRATO Badajoz 3970
ANTONIO MANUEL TORRADO Badajoz 3970
SILVIA M Barcelona 3960
MARINA CASTILLO Málaga 3960
PABLO TORRADO Badajoz 3960
NARA MEJIAS Terrassa 3940
PAULA CHANA Ezcaray 3930
DANIELA CHANA Logroño 3910
ANNA PALOMERAS Barcelona 3910
JOSE ANTONIO HERRERA castellar de la frontera 3904
ELENA VILLALONGA mao 3870
MIREIA PALOMERAS Barcelona 3860
SOFÍA ALVAREZ La Felguera 3760
MIGUEL RUBIO Molina de Segura 3750
GONZALO GARCIA PUERTO DEL ROSARIO 3740
NAIARA ESCRICHE Terrassa 3730
ALEJANDRA FORNELL TARIFA 3710
LUCIA-ALBA ORTIZ Velilla de San Antonio 3700
CECILIA LAIñO La Orotava 3700
LAURA SAN MILLÁN Villaobispo de las Regueras 3690
ELENA ZABALA Fene 3690
MIGUEL REQUENA La Font de la Figuera 3680
MANUEL ZABALA Fene 3680
ATTENERI CASQUERO El Rosario 3680
ALBA SÁNCHEZ Noalla-Sanxenxo 3680
ÁLVARO RODRÍGUEZ Lucillos 3670
JULIA RAMIL Viveiro 3660
TOñO RIOS Majadahonda 3660
PAULA LARROSA Vidreres 3650
MARIA FÀBREGAS Barcelona 3630
SARA NIETO Montijo 3620
OIARTZ AGIRRE Mungia 3620
EVA MORA València 3620
MALENA SANCHEZ Jerez de la Frontera 3600
NEREA SÁNCHEZ Guadalajara 3600
CURRO RIVERO Dos Hermanas 3600
MARIA MARMOL VICENTE Jumilla 3598
PAULA SEMPERE BARCELONA 3590
IVÁN LÓPEZ DE LA NIETA Madrid 3590

¡Una superratónica Tablet!
Lucia Santamaria Carretero
(Talavera de la Reina)
¡Muchas gracias a tod@s por haber participado en el concurso!
Premios - Bases Legales