Florian Liebscher: FAQ Anbetung

Beitrag lesen

Haaaaaaallo!!!

Ach ja wo wir gerade bei den faq beachtungen sind...

<?php

// Show Entryform
function show_entry_form($file_index){

echo "<form action=".$file_index."&cmd=add method=post>\n";
  echo "<table>\n";
  echo "<tr><td>".translate("Name").":</td><td><input type=text name=name size=40></td></tr>\n";
  echo "<tr><td>".translate("Email").":</td><td><input type=text name=email size=40></td></tr>\n";
  echo "<tr><td>".translate("Web").":</td><td><input type=text name=web size=40></td></tr>\n";
  echo "<tr><td colspan=2>".translate("Write a new entry").":<p><textarea cols=40 rows=7 name=text></textarea></td></tr>\n";
  echo "<tr><td></td><td><input type=submit value=".translate("Save")."><input type=reset value=".translate("Delete")."></td></tr>\n";
  echo "</table>\n";
  echo "</form>\n";
  echo "<hr>\n";
  //  read entries
  read_data();
  }

// save ebtry
function add_entry($data_file, $name, $email, $web, $text, $file_index){

// global $file_index, $data_file, $name, $email, $web, $text;

if ( $name and $text ) {
  // check inputs
     if ((strlen($web)>0) and (!(eregi("^http://",$web)))) {
  $p_web = "http://$web";  }
     $p_text = ereg_replace("\n","<br>",$text);
     $date = date("d.m.Y-G:i");
     $data = "$date|$name|$email|$p_web|$p_text\n";
  // save inputs to file
  $o_data_file=fopen($data_file, "a");
  fputs($o_data_file, $data);
  fclose($o_data_file);
  // update guestbook
  show_the_entry($file_index, $name, $email, $text, $date, "show");
     }
  else
  {
  echo "<h2>".translate("Please check you inputs.")."</h2>";
  }
  return false;
  }

// show the made entry
function show_the_entry($file_index, $name, $email, $text, $date){
  echo "<table border=1>\n";
  echo "<tr bgcolor=red><td>".translate("Entry")." ".translate("by")."<a href=mailto:$email> $name</a> , $date</td></tr>\n";
  echo "<tr><td>$text</td></tr>\n";
  echo "</table>\n";
  echo "<a href=$file_index>".translate("Back")."</a>\n";
}

//show entries
function read_data(){

global $file_index, $data_file, $name, $email, $web, $text;

$r_data_file=fopen($data_file, "r");
  echo "<table><table>";
  while (!feof($r_data_file)){
        $string=chop(fgets($r_data_file, 1000));
        if ( $string == "" ) {
           continue;
           }
           else
           {
     $entry=split("|", $string);
        echo "<tr><td><table width=500 border=1><tr><td bgcolor=red>".translate("Entry")." ".translate("by")."<a href=mailto:".$entry[2]."> ".$entry[1]."</a> ; <a href=".$entry[3].">".$entry[3]."</a>; ".$entry[0]."</td></tr><tr><td>".$entry[4]."</td></tr></table></td></tr>\n";
           }
           }
  fclose($r_data_file);
  echo "</table>\n";
}

/* loading language file */
function get_translations($lang) {

$lngfile="lang/".$lang.".txt";

if (file_exists($lngfile)) {
    $lines = file($lngfile);
    while (list(,$line) = each($lines)) {
      list($key,$val)= explode("=",$line);
   $phrases[$key] = $val;
    }
    return $phrases;
  } else {
    return false;
  }
}

/* translate a string */
function translate($str,$vals="") {

global $phrases;

if ($phrases) {
    $p_str = $phrases[$str];
 if ($p_str == "") {
   $p_str = $str;
 }
  } else {
    $p_str = $str;
  }

if (gettype($vals)=="array") {
    $p_str = sprintf($p_str,$vals[0],$vals[1],$vals[2],$vals[3],$vals[4],$vals[5],$vals[6]);
  }

return (trim($p_str));
}

// include the guestbook
function include_ckgb(){

global $file_index, $name, $email, $web, $text, $date, $cmd, $data_file, $file_path;

if ( $cmd == "add" ){
  add_entry($data_file, $name, $email, $web, $text, $file_index);
  } else if  ( $cmd == "show" ){
  show_the_entry($file_index);
  }
  else
  {
  show_entry_form($file_index);
  }
}

// Start Guestbook  //
// ---------------  //

// if $lang not set, than that the language file
$defaultlng = "de";
// check if set $lang
if ( $lang ){
   $phrases = get_translations($lang);
   }
   else
   {
   $phrases = get_translations($defaultlng);
   }
// name of the guestbookfile
$file_index="index.php3?lang=".$lang;
// path and name of the data file
$data_file="data/ckgb.txt";
// include the guestbook in the index file
include_ckgb();

?>

warum geht der auch net??

http://www.hosting.metroprime.de/getthefloh/index.php3

Gruss

Flo

Grüß Goth,

ein schöneres Beispiel hätte jetzt gar nicht kommen können.
Also ganz freundlich: lies bitte </faq/#Q-09a>, danke.

jaja, is ja schon gut ... *grinsel*

Gruß

Stefan D.

0 65

FAQ Anbetung

Axel Napolitano
  • meinung
  1. 0
    Stefan D.
    1. 0
      Orlando
      1. 0
        Stefan D.
        1. 0
          Florian Liebscher
  2. 0
    David
  3. 0
    Florian Liebscher
    1. 0
      Orlando
  4. 0
    Kai Lahmann
    1. 0
      Thomas J.S.
      1. 0
        Michael Schröpl
        1. 0
          Thomas J.S.
          1. 0
            Michael Schröpl
            1. 0
              Swen Wacker
    2. 0
      Wilhelm
      1. 0
        Swen Wacker
        1. 0

          Zack! ;o)

          Margarete Palffy
          1. 0
            Wilhelm
            1. 0

              Moin Wilhelm! ;o)

              Margarete Palffy
              • menschelei
          2. 0
            Swen Wacker
            1. 0
              Stonie
            2. 0
              Margarete Palffy
  5. 0
    Bio
    1. 0
      Michael N.
  6. 0
    Schuer
    1. 0
      Bio
      1. 0
        Schuer
  7. 0
    Orlando
    1. 0
      Wilhelm
  8. 0
    Der Dicki
  9. 0
    Stonie
    1. 0
      Grummelchen
      1. 0

        Anmerkungen zum Thema "Kommunikation"

        Stonie
        1. 0
          Axel Napolitano
          1. 0
            Michael Schröpl
          2. 0
            Margarete Palffy
  10. 0
    Mathias Bigge
  11. 0

    Schlusswort zu diesem Thread

    Axel Napolitano
    1. 0
      Grummelchen
    2. 0
      Sven Rautenberg
    3. 0
      Kati
      1. 0

        FAQ-Verstoss! ;o)

        Stonie
        • menschelei
        1. 0
          Margarete Palffy
        2. 0

          Urteil im Namen des Forums!

          Bio
          1. 0

            Tätliche Reue

            Stonie
            1. 0
              Michael Schröpl
              1. 0
                Stonie
        3. 0

          Danke für die lieben Willkommensgrüße :o) *strahl*

          Kati
          1. 0
            Michael Schröpl
    4. 0
      Michael Schröpl
    5. 0

      Schlusswort zum Schlusswort zum ...

      Bio
      1. 0
        Axel Napolitano
        1. 0
          Bio
        2. 0
          Orlando
          1. 0
            Fabian Transchel
            1. 0
              Orlando
              1. 0
                Fabian Transchel
                1. 0
                  Fabian Transchel
                2. 0
                  Axel Napolitano
                  1. 0
                    Fabian Transchel
  12. 0
    Tom2
    1. 0
      Michael N.
      1. 0
        Tom2
        1. 0
          Stonie
  13. 0
    Thomas J.S.