Visualizzazione risultati 1 fino 5 di 5

Discussione: Dove sta l' errore?

  1. #1
    Guest

    Predefinito Dove sta l' errore?

    Avevo creato questo 'script' in php per estrarre dalla pagina scelta una stringa, ovvero la data di registrazione. Se metto il codice senza l' elseif funziona correttamente (http://exabyte.altervista.org/data.php , per provare inserite ad esempio armadillo) ma se metto con le elseif per far in modo che si può scegliere un posto diverso (dovete sapere che questo gioco è in tutto il mondo, quindi ha diversi domini con diversa gente e ho necessità di far in modo che si possano scegliere tutti gli hotel).. Avevo scritto questo ma non funziona, non so perchè:

    Codice PHP:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <link href="css.css" type="text/css" rel="stylesheet">
    <title>#exabyte</title>
    </head>
    <body>
    <div class="area_header">
    <div class="area_menu">
    <div class="menu"><a href="index.php">Home</a> | <font color="white">Tools</font> | <a href="screen.php">Screen</a> | <a href="video.php">Video</a></div></div>
    <div class="header">#€xabyte</div></div>
    <div class="area_text"><div class="text">
    <form action="" method="POST">
    Inserisci il nome habbo<br>
    <input type="text" class="input_text" name="habbo"><br><br>
    <select name="hotel" class="input_select">
    <option value="it">Habbo.it</option>
    <option value="com">Habbo.com</option>
    <option value="es">Habbo.es</option>
    <option value="de">Habbo.de</option>
    <option value="nl">Habbo.nl</option>
    <option value="com.br">Habbo.com.br</option>
    <option value="dk">Habbo.dk</option>
    <option value="fi">Habbo.fi</option>
    <option value="fr">Habbo.fr</option>
    <option value="ie">Habbo.ie</option>
    <option value="no">Habbo.no</option>
    <option value="se">Habbo.se</option>
    </select>
    <input type="submit" class="input_submit" value="Invia"></form>
    <?
    $habbo
    = $_POST['habbo'];

    if (empty(
    $habbo)) {
    echo
    "<br><br>Campo vuoto o Home Nascosta.";
    } elseif (
    $hotel == "it") {
    $fp = fsockopen("www.habbo.it/home/{$habbo}", 80);
    $file = "http://www.habbo.it/home/{$habbo}";
    $sorgente_file_remoto = implode("", file($file));
    if(
    eregi("<div class=\"birthday date\">(.+)<div>", $sorgente_file_remoto, $titolo)) {
    echo
    "<br><br>La data di registrazione di <b>$habbo</b> è <b>$titolo[1]</b>";
    }} elseif (
    $hotel == "com") {
    $fp = fsockopen("www.habbo.com/home/{$habbo}", 80);
    $file = "http://www.habbo.com/home/{$habbo}";
    $sorgente_file_remoto = implode("", file($file));
    if(
    eregi("<div class=\"birthday date\">(.+)<div>", $sorgente_file_remoto, $titolo)) {
    echo
    "<br><br>La data di registrazione di <b>$habbo</b> è <b>$titolo[1]</b>";
    }} elseif (
    $hotel == "es") {
    $fp = fsockopen("www.habbo.es/home/{$habbo}", 80);
    $file = "http://www.habbo.es/home/{$habbo}";
    $sorgente_file_remoto = implode("", file($file));
    if(
    eregi("<div class=\"birthday date\">(.+)<div>", $sorgente_file_remoto, $titolo)) {
    echo
    "<br><br>La data di registrazione di <b>$habbo</b> è <b>$titolo[1]</b>";
    }} elseif (
    $hotel == "de") {
    $fp = fsockopen("www.habbo.de/home/{$habbo}", 80);
    $file = "http://www.habbo.de/home/{$habbo}";
    $sorgente_file_remoto = implode("", file($file));
    if(
    eregi("<div class=\"birthday date\">(.+)<div>", $sorgente_file_remoto, $titolo)) {
    echo
    "<br><br>La data di registrazione di <b>$habbo</b> è <b>$titolo[1]</b>";
    }} elseif (
    $hotel == "nl") {
    $fp = fsockopen("www.habbo.nl/home/{$habbo}", 80);
    $file = "http://www.habbo.nl/home/{$habbo}";
    $sorgente_file_remoto = implode("", file($file));
    if(
    eregi("<div class=\"birthday date\">(.+)<div>", $sorgente_file_remoto, $titolo)) {
    echo
    "<br><br>La data di registrazione di <b>$habbo</b> è <b>$titolo[1]</b>";
    }} elseif (
    $hotel == "com.br") {
    $fp = fsockopen("www.habbo.com.br/home/{$habbo}", 80);
    $file = "http://www.habbo.com.br/home/{$habbo}";
    $sorgente_file_remoto = implode("", file($file));
    if(
    eregi("<div class=\"birthday date\">(.+)<div>", $sorgente_file_remoto, $titolo)) {
    echo
    "<br><br>La data di registrazione di <b>$habbo</b> è <b>$titolo[1]</b>";
    }} elseif (
    $hotel == "dk") {
    $fp = fsockopen("www.habbo.dk/home/{$habbo}", 80);
    $file = "http://www.habbo.dk/home/{$habbo}";
    $sorgente_file_remoto = implode("", file($file));
    if(
    eregi("<div class=\"birthday date\">(.+)<div>", $sorgente_file_remoto, $titolo)) {
    echo
    "<br><br>La data di registrazione di <b>$habbo</b> è <b>$titolo[1]</b>";
    }} elseif (
    $hotel == "fi") {
    $fp = fsockopen("www.habbo.fi/home/{$habbo}", 80);
    $file = "http://www.habbo.fi/home/{$habbo}";
    $sorgente_file_remoto = implode("", file($file));
    if(
    eregi("<div class=\"birthday date\">(.+)<div>", $sorgente_file_remoto, $titolo)) {
    echo
    "<br><br>La data di registrazione di <b>$habbo</b> è <b>$titolo[1]</b>";
    }} elseif (
    $hotel == "fr") {
    $fp = fsockopen("www.habbo.fr/home/{$habbo}", 80);
    $file = "http://www.habbo.fr/home/{$habbo}";
    $sorgente_file_remoto = implode("", file($file));
    if(
    eregi("<div class=\"birthday date\">(.+)<div>", $sorgente_file_remoto, $titolo)) {
    echo
    "<br><br>La data di registrazione di <b>$habbo</b> è <b>$titolo[1]</b>";
    }} elseif (
    $hotel == "ie") {
    $fp = fsockopen("www.habbo.ie/home/{$habbo}", 80);
    $file = "http://www.habbo.ie/home/{$habbo}";
    $sorgente_file_remoto = implode("", file($file));
    if(
    eregi("<div class=\"birthday date\">(.+)<div>", $sorgente_file_remoto, $titolo)) {
    echo
    "<br><br>La data di registrazione di <b>$habbo</b> è <b>$titolo[1]</b>";
    }} elseif (
    $hotel == "no") {
    $fp = fsockopen("www.habbo.no/home/{$habbo}", 80);
    $file = "http://www.habbo.no/home/{$habbo}";
    $sorgente_file_remoto = implode("", file($file));
    if(
    eregi("<div class=\"birthday date\">(.+)<div>", $sorgente_file_remoto, $titolo)) {
    echo
    "<br><br>La data di registrazione di <b>$habbo</b> è <b>$titolo[1]</b>";
    }} elseif (
    $hotel == "se") {
    $fp = fsockopen("www.habbo.se/home/{$habbo}", 80);
    $file = "http://www.habbo.se/home/{$habbo}";
    $sorgente_file_remoto = implode("", file($file));
    if(
    eregi("<div class=\"birthday date\">(.+)<div>", $sorgente_file_remoto, $titolo)) {
    echo
    "<br><br>La data di registrazione di <b>$habbo</b> è <b>$titolo[1]</b>";
    }}
    ?>
    </div></div>
    <div class="area_text_footer"><div class="footer_cp"><div class="footer_copyr">Copyright <? echo(date("Y")); ?> &copy . All rights reserved. Skin made from <a href="http://habbo.it/home/armadillo" target="_blank">#exabyte</a>.</div></div></div>
    </body>
    </html>

  2. #2
    L'avatar di darkwolf
    darkwolf non è connesso Super Moderatore
    Data registrazione
    18-04-2007
    Residenza
    Reggiolo (RE)
    Messaggi
    6,552

    Predefinito

    Ma se $hotel contiene "it o com o quellocheé" non sarebbe più semplice un:
    Codice PHP:
    <?php
    $habbo
    = $_POST['habbo'];
    $hotel = $_POST['hotel'];

    if (!empty(
    $habbo) && !empty($hotel)) {

    $fp = fsockopen("www.habbo.{$hotel}/home/{$habbo}", 80);
    $file = "http://www.habbo.{$hotel}/home/{$habbo}";
    $sorgente_file_remoto = implode("", file($file));
    if(
    eregi("<div class=\"birthday date\">(.+)<div>", $sorgente_file_remoto, $titolo)) {
    echo
    "<br><br>La data di registrazione di <b>$habbo</b> è <b>$titolo[1]</b>";
    }
    else
    {
    echo
    "<br /><br />Utente non trovato :("; // Non è detto che trovi sempre il nick inserito
    }
    }
    else
    {
    echo
    "<br /><br />Campo vuoto o Home Nascosta.";
    }

    ?>
    No perché, ad essere sincero, non noto altre differenze
    Ultima modifica di darkwolf : 14-03-2011 alle ore 02.32.39 Motivo: Dimenticavo di definire $hotel +ritocchino!
    » Salvatore Noschese - L'AltroWeb | Seguimi su: facebook | twitter | Google+
    # Che aspetti? Unisciti alla community! Tanti nuovi gruppi ti aspettano


  3. #3
    Guest

    Predefinito

    ahah sì ci avevo pensato ma ero andato a mangiare e avevo scordato di farlo lol .. Però guarda tu stesso: http://exabyte.altervista.org/test.php

    Come vedi non funziona ugualmente..

    AAAH SAI DOVE STAVA L' ERRORE? AVEVO SCORDATO DI DICHIARARE LA VARIABILE $hotel, risolto grazie XD
    Ultima modifica di exabyte : 14-03-2011 alle ore 02.09.47

  4. #4
    L'avatar di darkwolf
    darkwolf non è connesso Super Moderatore
    Data registrazione
    18-04-2007
    Residenza
    Reggiolo (RE)
    Messaggi
    6,552

    Predefinito

    Vedi gli edit precedenti, non avevo ancora notato la tua replica.
    » Salvatore Noschese - L'AltroWeb | Seguimi su: facebook | twitter | Google+
    # Che aspetti? Unisciti alla community! Tanti nuovi gruppi ti aspettano


  5. #5
    L'avatar di andreafallico
    andreafallico non è connesso Super Moderatore
    Data registrazione
    02-06-2009
    Messaggi
    1,981

    Predefinito

    Perchè utilizzi fsockopen, file e implode, puoi utilizzare solo file_get_contents:
    Codice PHP:
    $sorgente_file_remoto = file_get_contents($file);
    inoltre la funzione eregi è deprecata.

Regole di scrittura

  • Non puoi creare nuove discussioni
  • Non puoi rispondere ai messaggi
  • Non puoi inserire allegati.
  • Non puoi modificare i tuoi messaggi
  •