IF/Else in HTML PArt

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • Decoder
    antwortet
    danke funktioniert!!!

    FRUDE

    Einen Kommentar schreiben:


  • RobertTheHero
    antwortet
    PHP-Code:
    ....

                        <
    p align=right><a href=\"http://wwp.icq.com/scripts/search.dll?to=$icq\">".
    (
    $icq?"<img src=\"http://web.icq.com/whitepages/online?icq=$icq&img=5\" BORDER=0></a>":"(leer)")."
     <a href=\"http://80.237.202.14/locations/1/index.php?section=profile&id=
    $fsl\"><img src=\"imagesfsl.gif\" BORDER=0></a></td>
                    </tr>
    ... 
    oder wie Abraxax vorschlägt

    PHP-Code:
    ....

                        <
    p align=right><a href=\"http://wwp.icq.com/scripts/search.dll?to=$icq\">".
    (
    preg_match('/[0-9]{1,}/'$icq)?"<img src=\"http://web.icq.com/whitepages/online?icq=$icq&img=5\" BORDER=0></a>":"(leer)")."
     <a href=\"http://80.237.202.14/locations/1/index.php?section=profile&id=
    $fsl\"><img src=\"imagesfsl.gif\" BORDER=0></a></td>
                    </tr>
    ... 
    das preg_match checkt, ob es sich um eine zahl handelt.
    und die Schreibweise mit dem Fragezeichen und dem Doppelpunkte ist eine verkürtzte if abfrage.

    gruss

    rth

    Einen Kommentar schreiben:


  • Abraxax
    antwortet
    ungetestet.

    PHP-Code:
    // alt
    if ($icq) {

    // neu
    if (preg_match('/[0-9]{1,}/'$icq) { 

    Einen Kommentar schreiben:


  • Decoder
    hat ein Thema erstellt IF/Else in HTML PArt.

    IF/Else in HTML PArt

    Also hab da ein kleines Gästebuch....
    nun will ich, dass das ICQ Icon nur dann angezeigt wird wenn der User auch wirklich eine ICQ Nummer angegeben hat.

    Ich weiss jetzt aber nicht wie ich dieses IF Abfrage in dne HTML Part bringen soll.

    PHP-Code:
    if ($icq) {

    echo 
    "<a href=\"http://wwp.icq.com/scripts/search.dll?to=$icq\"><img src=\"http://web.icq.com/whitepages/online?icq=$icq&img=5\" BORDER=0></a>";

    }

    else

    {

    echo 
    "(leer)";





    PHP-Code:
    <html>
    <head>
    <title>Gästebuch</title>
    <meta name="robots" content="noindex, nofollow">
    </head>
    <body scroll="auto">
    <div align="center">
    <a href="eintrag.php" target="_self">
    <p><font face="Arial" size="2" color="#000000">Neuer Eintrag</font></a></p>



    <?php


    $name 
    $HTTP_POST_VARS['name'];
    $email $HTTP_POST_VARS['email'];
    $text $HTTP_POST_VARS['text'];
    $icq $HTTP_POST_VARS['icq'];
    $fsl $HTTP_POST_VARS['fsl'];


    if(
    $submit)

    {

    if((
    $email == "") || ($name == "") || ($text == ""))
    echo 
    "<b>Fehlgeschlagen! Bitte alle Felder ausfüllen!</b>";


    else
    {


    $x 0;

    $dateiname "gbook.txt";


    $datei fopen($dateiname"r");


    while (!
    feof($datei)) {
    $x++;
    $saved[$x] = fgets($datei1024);

    }

    $datum date("d.m.Y");
    $zeit date("H:i");


    $datei=fopen("gbook.txt""w");


    $text=strip_tags($text);


    $text str_replace(":)","<img src='images/smile.gif'>",$text);
    $text str_replace(";)","<img src='images/wink.gif'>",$text);
    $text str_replace(":D","<img src='images/biggrin.gif'>",$text);
    $text str_replace(":(","<img src='images/sad.gif'>",$text);
    $text str_replace(":p","<img src='images/grin.gif'>",$text);
    $text str_replace(":rolleyes:","<img src='images/rolleyes.gif'>",$text);
    $text str_replace(":mad:","<img src='images/angry.gif'>",$text);
    $text str_replace(":confused:","<img src='images/confused.gif'>",$text);
    $text str_replace(":eek:","<img src='images/eek.gif'>",$text);
    $text str_replace(":cool:","<img src='images/cool.gif'>",$text);
    $text str_replace(":o","<img src='images/redface.gif'>",$text);
    $text str_replace(":lol:","<img src='images/lol.gif'>",$text);
    $text str_replace(":ugly:","<img src='images/ugly.gif'>",$text);


    fwrite($datei,"<p>&nbsp;</p><table width=365 border=0 cellspacing=0 cellpadding=1 bgcolor=#000000 height=1>
            <tr>
              <td height=1 width=423>
                <div align=right>
                  <table border=0 width=100%>
                    <tr>
                      <td width=87%><b><a href=\"mailto:
    $email\"><font face=\"Arial\" color=\"#FFFFFF\" size=\"2\">$name</font></a></b><font face=\"Arial\" color=\"#FFFFFF\" size=\"2\"></font><font face=\"Arial\" color=\"#FFFFFF\" size=\"1\">
    schrieb am 
    $datum um $zeit Uhr</font></td>
                      <td width=13%>
                        <p align=right><a href=\"http://wwp.icq.com/scripts/search.dll?to=
    $icq\"><img src=\"http://web.icq.com/whitepages/online?icq=$icq&img=5\" BORDER=0></a>
     <a href=\"http://80.237.202.14/locations/1/index.php?section=profile&id=
    $fsl\"><img src=\"images\fsl.gif\" BORDER=0></a></td>
                    </tr>
                  </table>
                </div>
                <table width=423 border=0 cellspacing=0 cellpadding=0 bgcolor=#f1f1f1>
                  <tr>
                    <td width=254 valign=top align=center>
                      <table width=415 border=0 cellspacing=0 cellpadding=0>
                        <tr>
                          <td align=center height=6 width=413><img src=http://mitglied.lycos.de/camerloher2002/grafik/trans.gif width=5 height=6></td>
                        </tr>
                        <td align=left width=413>
                            <div align=center>
                              <center>
                              <table border=0 width=99%>
                                <tr>
                                  <td width=100%><font face=\"Arial\" size=\"2\">
    $text</font></td>
                                </tr>
                              </table>
                              </center>
                            </div>
                          </td>
                        </tr>
                        <tr>
                          <td align=center height=6 width=413><img src=http://mitglied.lycos.de/camerloher2002/grafik/trans.gif width=5 height=6></td>
                        </tr>
                      </table>
                    </td>
                  </tr>
                </table>
              </td>
            </tr>
          </table>
          \n"
    );


    for (
    $i=1;$i <= $x$i++) {
    fwrite($datei"$saved[$i]");
    }
    // Datei schliessen
    fclose($datei);
    }
    }


    // die Einträge auslesen & anzeigen

    $dateiname "gbook.txt";
    $datei fopen($dateiname"r");
    fpassthru($datei);
    ?>
    </div>
    </body>
    </html>
Lädt...
X