Zum Inhalt springen

Frage66

Mitglieder
  • Gesamte Inhalte

    6
  • Benutzer seit

  • Letzter Besuch

Beiträge von Frage66

  1. Hallo,

    ich möchte die folgende Abfrage in einem neuen Fenster öffnen (So ähnich wie ein pop-up-fenster). Kann hier jemand weiterhelfen?

    <?

    error_reporting (0);

    ?>

    <html>

    <body>

    <form>

    Search <input type=text value="<?=$_GET['q']?>" name=q>

    <input type=submit>

    </form>

    <hr>

    <?

    if (strlen ($_GET['q']) > 0)

    {

    $url = "http://google.com/complete/search?output=toolbar&q=" . urlencode($_GET['q']);

    $handle = fopen($url, "rb");

    $contents = stream_get_contents($handle);

    fclose($handle);

    $xml = new SimpleXMLElement($contents);

    foreach ($xml->CompleteSuggestion as $entry)

    {

    echo "<a href='?q=" . urlencode($entry->suggestion['data']) . "'>" . $entry->suggestion['data'] . "</a><br>";

    }

    }

    ?>

    <a href="javascript:history.back()">Zurück</a>

    </body>

    </html>

  2. Hallo,

    ich habe ein script welches "Vertipper" (Beispiel: Lufthanas statt Lufthansa) generiert. Ich würde es gerne haben, das dass Script erst auf Anforderung startet. Hier ignoriert das Script aber die Abfrage über das Formular und gibt automatisch das Ergebnisse aus. Kann jemand weiterhelfen?

    <?php

    error_reporting (0);

    ?>

    <html>

    <body>

    <form>

    Search <input type=text value="<?=$_GET['titel']?>" name=q>

    <input type=submit>

    </form>

    <hr>

    <?

    //vertipper

    if (strlen ($_GET['titel']) > 0)

    {

    function vertipper($wort) {

    $len = strlen($wort);

    $liste = array();

    // 1. Weggelassene oder doppelte Buchstaben

    for ($i = 0; $i < $len; ++$i) {

    $liste[] = substr($wort, 0, $i) .

    substr($wort, $i+1);

    $liste[] = substr($wort, 0, $i+1) .

    substr($wort, $i);

    }

    // 2. Buchstabendreher

    for ($i = 0; $i < $len-1; ++$i) {

    $liste[] = substr($wort, 0, $i) .

    $wort{$i+1} . $wort{$i} .

    substr($wort, $i+2);

    }

    // 3. Auf der Tastatur nahe liegende Buchstaben

    $tastaturzeilen = array(

    '1234567890ß',

    'qwertzuiopü',

    'asdfghjklöä',

    'yxcvbnm',

    );

    for ($i = 0; $i < $len; ++$i) {

    $buchst = $wort{$i};

    $daneben = array();

    foreach ($tastaturzeilen as $zeile) {

    if (($pos = strpos($zeile, $buchst)) !== false) {

    if ($pos-1 >= 0) {

    $daneben[] = $zeile{$pos-1};

    }

    if ($pos+1 < strlen($zeile)) {

    $daneben[] = $zeile{$pos+1};

    }

    }

    }

    foreach ($daneben as $ersatz) {

    $vertipper = $wort;

    $vertipper{$i} = $ersatz;

    $liste[] = $vertipper;

    }

    }

    return array_values(array_unique($liste));

    }

    print_r(vertipper($_GET['titel']));

    }

    ?>

    </body>

    </html>

Fachinformatiker.de, 2024 by SE Internet Services

fidelogo_small.png

Schicke uns eine Nachricht!

Fachinformatiker.de ist die größte IT-Community
rund um Ausbildung, Job, Weiterbildung für IT-Fachkräfte.

Fachinformatiker.de App

Download on the App Store
Get it on Google Play

Kontakt

Hier werben?
Oder sende eine E-Mail an

Social media u. feeds

Jobboard für Fachinformatiker und IT-Fachkräfte

×
×
  • Neu erstellen...