[Code] Gästebuch

Dieses Thema im Forum "Webentwicklung" wurde erstellt von KillaKilja, 21. Januar 2009 .

Schlagworte:
Status des Themas:
Es sind keine weiteren Antworten möglich.
  1. 21. Januar 2009
    Gästebuch

    Hey,

    ich suche ein Script(Code) den ich in die Seite einbinden kann und ich dann ein Gästebuch erhalte,habe bis jetzt nur Gästebücher gefunden die extern verlaufen.

    Habt ihr da was für mich ?

    Kilja
     
  2. 21. Januar 2009
    AW: Gästebuch

    GigaWebHost: Domain, Webspace, Server, Hosting
     
  3. 21. Januar 2009
    AW: Gästebuch

    ist free ?
     
  4. 21. Januar 2009
    AW: Gästebuch

    Ja.
    Kannst dir aber auch locker selber schreiben wenn du php kannst.
    Aber man muss ja das Rad nicht neu erfinden ;-)
     
  5. 21. Januar 2009
    AW: Gästebuch

    sind aber fast alle Links down

    Noch ne andere Idee ?
     
  6. 21. Januar 2009
    AW: Gästebuch

    erster google hit:

    php-resource.de
     
  7. 21. Januar 2009
    AW: Gästebuch

    nichts gutes dabei

    Habe Google schon druchsucht....
     
  8. 21. Januar 2009
    AW: Gästebuch

    hatte das mal ne zeitlang: (funktionieren wirds nicht, da dort meine ajax js subs fehlen)

    PHP:
    <? php
      
    if ( $_POST [ "Textbox1" ] !=  "" ) {
        
    $post_name  $_POST [ 'Textbox1' ];
      }
      
      if (
    $_POST [ "Textbox2" ] !=  "" ) {
        
    $post_shout  $_POST [ 'Textbox2' ];
      }

      if (
    $_POST [ "Submit1" ] ==  "Post" ) {
        
    $action  "POST" ;
      } else if (
    $_POST [ "Submit1" ] ==  "Expand" ) {
        
    $action  "EXPAND" ;
      }

      if(
    $action  ==  "POST" ) {
        
    $post_name  trim ( $post_name );
        
    $post_name  killscript ( $post_name );
        
    $post_name  stripslashes ( $post_name );
        
    $post_name  str_replace ( "\n" " " $post_name );
        
    $post_name  str_replace ( "\r" " " $post_name );

        
    $post_shout  trim ( $post_shout );
        
    $post_shout  killscript ( $post_shout );
        
    $post_shout  stripslashes ( $post_shout );
        
    $post_shout  str_replace ( "\n" " " $post_shout );
        
    $post_shout  str_replace ( "\r" " " $post_shout );
      }
    ?>

    <?php
      
    function  namelength ( $name ) {
        if (
    strlen ( $name ) <  5 ) {
          echo (
    "<strong>Name is too short...</strong>\n
                 <br><br>"
    );
                 
          return 
    false ;
        } else if (
    strlen ( $name ) >  20 ) {
          echo (
    "<strong>Name is too long...</strong>\n
                 <br><br>"
    );
          
          return 
    false ;
        } else {
          return 
    true ;
        }
      }

      function 
    textlength ( $shout ) {
        if (
    strlen ( $shout ) <  10 ) {
          echo (
    "<strong>Text is too short...</strong>\n
                 <br><br>"
    );
          
          return 
    false ;
        } else if (
    strlen ( $shout ) >  500 ) {
          echo (
    "<strong>Text is too long...</strong>\n
                 <br><br>"
    );

          return 
    false ;
        } else {
          return 
    true ;
        }
      }

      function 
    badname ( $name ) {
        if(
    strtolower ( $name ) ==  strtolower ( "hwh" )) {
          echo (
    "<strong>Name invalid...</strong>\n
                 <br><br>"
    );

          return 
    false ;
        } else {
          return 
    true ;
        }
      }

      function 
    killhtml ( $shout ) {
        
    $shout  str_replace ( "<" , "&lt;" , $shout );
        
    $shout  str_replace ( ">" , "&gt;" , $shout );
        
        return 
    $shout ;
      }

      function 
    killscript ( $shout ) {
        
    $shout  str_replace ( "<script>" , " " , $shout );
        
    $shout  str_replace ( "</script>" , " " , $shout );
        
    $shout  str_replace ( "javascript://" , " " , $shout );
        
        return 
    $shout ;
      }

      function 
    shoutcode ( $shout ) {
        
    $list  file ( "lists/shoutcode.php" );

        foreach (
    $list  as  $value ) {
          list (
    $opencode , $openhtml , $closecode , $closehtml ) =  explode  ( "|^|" , $value );
          
          if (
    $closecode  ==  "" ) {
            
    $shout  str_replace  ( $opencode , $openhtml , $shout );
          }
                
          
    $opencount  substr_count ( strtolower ( $shout ), strtolower ( $opencode ));
          
    $closecount  substr_count ( strtolower ( $shout ), strtolower ( $closecode ));
            
          if (
    $opencount  ==  $closecount ) { 
            
    $shout  str_replace ( $opencode , $openhtml , $shout );
            
    $shout  str_replace ( $closecode , $closehtml , $shout );
          }
        }
        
        return 
    $shout ;
      }
    ?>

    <?php
      
    if ( $action  ==  "POST" ) {
        if (
    namelength ( $post_name )) { 
          if (
    textlength ( $post_shout )) {
            if (
    badname ( $post_name )) {
              if (
    $filepointer  fopen ( "shouts.php" "a+" )) {
                                 
    fwrite ( $filepointer , " $post_name |^| $post_shout |^| $_SERVER [ REMOTE_ADDR ] |^|\n" );
                                 
    fclose ( $filepointer );
              }
            }
          }
        }
      }
    ?>

    <div align="center">
    <input name="Textbox1" id="Textbox1" class="text" type="text" value="Name" style="width:600;"><br>
    <textarea name="Textbox2" id="Textbox2" class="text" rows="5" style="width:600;">Text</textarea><br>
    <input name="Submit1" class="button" type="button" value="Post" onClick="modulepostajax('/shoutbox/module.php','Textbox1='+escape(document.getElementById('Textbox1').value)+'&Textbox2='+escape(document.getElementById('Textbox2').value)+'&Submit1=Post');"/>
    <input class="button" type="button" value="Refresh" onClick="moduleajax('/shoutbox/module.php');">

    <?php
      
    if ( $action  ==  "EXPAND" ) {
        echo(
    "<input class=\"button\" type=\"button\" value=\"View Less\" onClick=\"moduleajax('/shoutbox/module.php');\">" );
      } else {
        echo(
    "<input name=\"Submit1\" class=\"button\" type=\"button\" value=\"View All\" onClick=\"modulepostajax('/shoutbox/module.php','Submit1=Expand');\"/>" );
      }
    ?>

    </div>
    <br><br>

    <?php
      
    if ( $action  ==  "EXPAND" ) {
        
    $shouts  array_reverse ( file ( "shouts.php" ));
      
        foreach (
    $shouts  as  $item ) {
          list (
    $poster , $message , $ip ) =  explode  ( "|^|" $item );
          
          
    $message  killhtml ( $message );
          
    $poster  killhtml ( $poster );    
          
    $thisshout  killscript ( "<span style=\"cursor:default; font-weight:bold;\"> $poster :</span><span style=\"cursor:default;\">  $message </span>" );
        
          echo (
    "<div style=\"font-size:12px; font-family:Courier New; background-color:#EEEEEE; border:1px solid #000000; padding-left:7px; padding-right:7px;\" onMouseOver=\"bgcolor1(this);\" onMouseOut=\"bgcolor2(this);\">\n
                 
    $thisshout \n
                 </div>\n
                 <br>\n"
    );
        }
      } else {
        
    $shouts  array_reverse ( file ( "shouts.php" ));
      
        foreach (
    $shouts  as  $item ) {
          if (
    $row_count  ==  10 ) {
            break 
    1 ;
          }
          
          list (
    $poster , $message , $ip ) =  explode  ( "|^|" $item );
          
          
    $message  killhtml ( $message );
          
    $poster  killhtml ( $poster );    
          
    $thisshout  killscript ( "<span style=\"cursor:default; font-weight:bold;\"> $poster :</span><span style=\"cursor:default;\">  $message </span>" );
        
          echo (
    "<div style=\"font-size:12px; font-family:Courier New; background-color:#EEEEEE; border:1px solid #000000; padding-left:7px; padding-right:7px;\" onMouseOver=\"bgcolor1(this);\" onMouseOut=\"bgcolor2(this);\">\n
                 
    $thisshout \n
                 </div>\n
                 <br>\n"
    );
          
          
    $row_count ++;
        }
      }
    ?>
    vorteil: kein sql
    nachteil: bei zu vielen entrys vergleichweise hoher serverload

    btw: falsche section
     
  9. 21. Januar 2009
    AW: Gästebuch

    Also den einfach einbinden und fertig ?
     
  10. 21. Januar 2009
    AW: Gästebuch

    also einfach editieren, einbinden und fertig
     
  11. 21. Januar 2009
    AW: Gästebuch

    Was Editieren ? Bin in Ajax noch ned so fit
     
  12. 22. Januar 2009
    AW: Gästebuch

    Das ganze Script ist aber echt unschön.

    Wieso nicht die vorhandenen Funktionen benutzen?
    Statt:
    PHP:
    if ( $_POST [ "Textbox1" ] !=  ""
    Einfach:
    PHP:
    if (!empty( $_POST [ "Textbox1" ] )) 

    Dann zu den ganzen kill Funktionen...Ich würd die ganzen Strings ja einfach mit htmlspecialchars
    "bearbeiten"


    Die Funktion badname ergibt gar keinen Sinn. Was ist schon hwh?


    Dann zu den If-abfragen am Ende.

    PHP:
    if ( $action  ==  "POST" ) {
        if (
    namelength ( $post_name )) {
          if (
    textlength ( $post_shout )) {
            if (
    badname ( $post_name )) {
              if (
    $filepointer  fopen ( "shouts.php" "a+" )) {

    Da keine Else abfragen drin sind, kann man das doch einfach zusammen fassen:
    PHP:
    if ( $action  ==  "POST"  &&  namelength ( $post_name ) &&   textlength ( $post_shout ) &&  badname ( $post_name ) &&  $filepointer  fopen ( "shouts.php" "a+" )) 


    Fazit: Ich würd mir das Script nicht auf mein Server tun.
     
  13. 22. Januar 2009
    AW: Gästebuch

    wenn ich mich recht entsinne ist das nen relikt aus php4-anfangs zeiten (demzufolge auch die commands) und nur weil die ifs ein wenig verschachtelt sind schadet das dem stack auch nicht (in diesem sinne hättest du die gleiche suboptimalität).

    badname sind (wie mans auch am namen erkennen sollte ...) unerlaubte namen. hwh wäre in diesem beispiel der admin. welcher admin will schon dass ein anderer user unter seinem namen postet ...
     
  14. 22. Januar 2009
    AW: Gästebuch

    Nein schaden tut das ganze nicht. Aber sauber ist der Code halt trotzdem nicht. Da gibt es bessere die auch kostenlos sind. Ich will dir dein Script auch nicht schlecht machen. Es ist einfach nur halt veraltet und überholungs bedürftigt.




    @Threadersteller:
    http://www.jtr.de/scripting/php/guestbook/
    Was ist damit?

    Code:
     
     * WWW-Gästebuch mit Mehrsprachunterstützung (Sprache über URL wählbar)
     * verschiedene Datenquellen wählbar (MySQL oder CSV - Text-Datei)
     * mehrere Gästebücher gleichzeitig verwaltbar
     * Image-CAPTCHA Schutz gegen SPAM
     * Optionaler SPAM-Schutz durch Formmailer
     * Genehmigungsmodus
     * Smileys
     * Filter gegen SPAM
     * ICQ Status
     * e-mail Benarichtigung mit Link zum Gästebuch
     * Automatische Anpassung auf Browsersprache
     * Berücksichtigung der Zeitzone
     * Verwaltungsprogramm mit Update-Info
    
    Das schaut ganz in Ordnung aus und Features hat es auch ne menge.
     
  15. 7. Juni 2010
    AW: Gästebuch

    ------------------------------------------------------------------------------------------------------------------------
    Ist zwar schon ziemlich lange nichts mehr los hier, aber warum einen neuen aufmachen wenns noch einen alten gibt

    also... ich bin gerade ne seite mit html am schreiben... hatte jetzt auch vor ein gästebuch einzufügen, brauche php , ist klar ?! darum hab ich eins von diesen free seiten ausm internet genommen , problem dabei: man kommt dann immer auf eine neue seite,wo dann da alles passiert (geschrieben wird und so) wenn ich das einbine.... ich hätte aber gerne das das auf der eigentlichen seite bleibt und da alles passiert hat da vielleicht jemand so ne seite oder sonst noch ne idee?!
     
  16. 7. Juni 2010
    AW: Gästebuch

    [g]PHP Gästebuch[/g]
     
  17. Video Script

    Videos zum Themenbereich

    * gefundene Videos auf YouTube, anhand der Überschrift.