Con lo del Regex:
Código
function tecla2($cadena) { // Si es una letra o numero de 1 caracter de logitud, se le añadira <div class="tecla"> // Pero si coincide con las palabras flechas,enter etc... se le añadira <img src="" /> $buscarRegex = array('/^([A-ZñÑ0-9]{1})$/i','/^(flechas|enter|control|alt|espacio|der|izq|mover|shift|letras|letrasflechas)$/i','/^([0-9]) - ([0-9])$/i'); $reemplazo = array('<div class="tecla">$1</div>','<img src="ico/$1.png" alt="tecla-$1" />', '<span class="tecla">$1</span> - <span class="tecla">$2</span>'); // Si las sustituciones son menores a 1, significa que no se ha encontrado el patrón. if($contador <= 6){return $mag;}else{return 'desconocida';} }
Cuando me pongo 1 - 6, por ejemplo, me sale este error:
Citar
Notice: unserialize() [function.unserialize]: Error at offset 82 of 102 bytes in /home/vol12/eshost.es/eshos_12426320/ikillcraft.a0001.net/htdocs/game.php on line 72
Con lo del los juegos:
Código
$id = (int)$_GET['id']; $query2 = "SELECT linkjuego,tipo,ancho,alto,code,id FROM juegos WHERE id=".$id." LIMIT 1"; $tipo_juego=$rs['tipo']; // Comprobamos que tipo de juego es: if($tipo_juego==='unity'){ echo '<div class="game" style="width:'.$rs['ancho'].'px; height:'.$rs['alto'].'px;"> <object id="GameObject" classid="clsid:444785F1-DE89-4295-863A-D46C3A781394" width="100%" height="100%" codebase="http://webplayer.unity3d.com/download_webplayer-2.x/UnityWebPlayer.cab#version=2,0,0,0"> <param name="src" value="'.$rs['linkjuego'].'"> <param name="allowScriptAccess" value="true"> <embed allowscriptaccess="true" id="UnityEmbed" src="'.$rs['linkjuego'].'" width="100%" height="100%" type="application/vnd.unity" pluginspage="http://www.unity3d.com/unity-web-player-2.x"> </object></div>'; } elseif($tipo_juego==='flash'){ echo '<div class="game" style="width:'.$rs['ancho'].'px; height:'.$rs['alto'].'px;"> <object id="GameObject"" wmode="direct" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="100%" height="100%"> <param name="allowFullScreen" value="true"> <param name="allowScriptAccess" value="true"> <param name="movie" value="'.$rs['linkjuego'].'"> <param name="wmode" value="direct"> <param name="quality" value="high"> <param name="flashvars" value=""> <embed allowscriptaccess="true" flashvars="" wmode="direct" src="http://www.minijuegosgratis.com/flash1234/no_hotlink/zombiewestthereandbackagain.swf" allowfullscreen="true" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100%" height="100%" class="FlashGame" id="FlashGame2"> </object></div>'; } elseif($tipo_juego==='iframe'){ echo '<div class="game" style="width:'.$rs['ancho'].'px; height:'.$rs['alto'].'px;"> <object id="GameObject" type="text/html" data="'.$rs['linkjuego'].'" style="width:100%; height:100%;">Tu navegador no soporta Object!</object></div>'; } elseif($tipo_juego==='java'){ echo '<div class="game" style="width:'.$rs['ancho'].'px; height:'.$rs['alto'].'px;"><APPLET id="GameObject" CODE="'.$rs['linkjuego'].'" WIDTH="100%" HEIGHT="100%"> </APPLET></div>'; } elseif($tipo_juego==='otro'){ echo $rs['code']; } else { echo '<div class="game" style="width:'.$rs['ancho'].'px; height:'.$rs['alto'].'px;">Tipo de juego desconocido. Link:'.$rs['linkjuego'].'</div>'; } }
Cuando pongo id=1, o id=3, se carga igual el juego que ahi en la id=20, y es la una id que hay el link de juego.
Y con el Starrating:
Código: http://msteigerwalt.com/widgets/ratings/v1.5/ratings.php
Demo.php
Código
<? // Released under LGPL 2.1 <http://creativecommons.org/licenses/LGPL/2.1/> ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <?php require_once("ratings.php"); $rr = new RabidRatings(); ?> <title>Rate Things!</title> <!-- Make sure you change these to point to your actual files. --> <script type="text/javascript" src="mootools-1.2b1.js"></script> <script type="text/javascript" src="ratings.js"></script> <link rel="stylesheet" href="ratings.css" /> </head> <body> <?php for ($i = 1; $i < 5; $i++) { $rr->showStars("myArticle$i"); } $rr->showStars("anotherGreatArticle"); ?> </body> </html>
Error:
Citar
RabidRatings couldn't connect to the database. Please make sure your configuration is correct.
En la demo si me va, pero luego en http://ikillcraft.a0001.net/game.php?id=1 no va.
http://ikillcraft.a0001.net/demo.php
Un saludo.
PD: Si lo pongo por aquí es que ya me he hartado de buscar y cambiar cosas... Todo lo que he hecho no va.