Probleme mit Captcha Script

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

  • #16
    Hallo Leute also ich brauch nicht mehr das ganze Script eingebaut,
    die Hälfte hab ich schon alleine hinbekommen,
    jetzt brauch ich nur noch Hilfe bei folgendem
    und zwar möchte ich diesen Codehier :

    Code:
    <?
    	// Alle Fehler und Notices anzeigen
    	error_reporting(E_ALL);
    	session_start();
    
    	// Bei Ausgabe des eingegebenen Codes müssen html tags entfernt werden!
    	$CAPTCHA_RandomText = "";
    	if (isset($_POST['txtCode'])){
    	$CAPTCHA_EnteredText = str_replace
    ("<","",str_replace(">","",str_replace("'","",str_replace("[","",str_replace
    ("]","",$_POST['txtCode'])))));
    	}
    	if (isset($_SESSION['CAPTCHA_RndText'])) {
    	$CAPTCHA_RandomText = $_SESSION['CAPTCHA_RndText'];
    	}
    
    	if ($CAPTCHA_EnteredText == $CAPTCHA_RandomText and isset
    ($_POST['txtCode']) == true and isset($_SESSION['CAPTCHA_RndText'])){
    		// Hier Code, wenn Übereinstimmung
    		echo "<h3>Gratulation!</h3>";
    		echo "Right Code!";
    		echo "Your Code: $CAPTCHA_EnteredText, Random Code: $CAPTCHA_RandomText";
    	} else {
    		// Hier Code wenn keine Übereinstimmung
    		echo "<h3>Nope!</h3>";
    		echo "Wrong Code!";
    		echo "Your Code: $CAPTCHA_EnteredText, Random Code: $CAPTCHA_RandomText";
    	}	
    		echo "<br />";
    		echo "<a href=\"captcha.php\">do it again!</a>";
    
    	// Session unset
    	unset($_SESSION['CAPTCHA_RndText']);
    	
    ?>
    In den Folgenden mit eingebaut haben,
    leider kann ich das nicht alleien weill ich noch nicht so gut PHP kann,
    wäre super wenn mir dabei jemand Helfen könnte...

    Code:
    <?php
      require("functions/config.php");
      require("functions/functions.php");
      require("functions/visitor.php");
    
      switch($_REQUEST['service'])
      {
        case "entry":
          $_REQUEST['name'] = strip_tags($_REQUEST['name']);
          $_REQUEST['name'] = trim($_REQUEST['name']);
          if(!$html) $_REQUEST['text'] = htmlspecialchars($_REQUEST['body']);
          $_REQUEST['body'] = trim($_REQUEST['body']);
          if(!empty($_REQUEST['name']) && !empty($_REQUEST['body']))
          {
            $out = "";
            $_REQUEST['email'] = strip_tags(trim($_REQUEST['email']));
            if(strlen($_REQUEST['body']) > $maxlength && $maxlength > 0)
     $out .= "<li>"._tolong."</li>";
            if(empty($_REQUEST['email']) && $angemail) $out .= "<li>"._nomail."</li>";
            if(!checkmail($_REQUEST['email']) && !empty($_REQUEST['email']))
     $out .= "<li>"._wrongmail."</li>";
            $_REQUEST['icq'] = strip_tags(trim($_REQUEST['icq']));
            if(preg_match("/\D/", $_REQUEST['icq']) && !empty($_REQUEST['icq']))
     $out .= "<li>"._wrongicq."</li>";
            $_REQUEST['homepage'] = strip_tags(trim($_REQUEST['homepage']));
    
            if(!checkhp($_REQUEST['homepage']) && !empty($_REQUEST['homepage'])) 
    $out .= "<li>"._wronghp."</li>";
            if(antispam($antispam)) $out = "<li>"._spam."</li>";
    
            $_REQUEST['body'] = stripslashes($_REQUEST['body']);
    
            if(empty($out))
            {
    
              if($enablemail) @mail($mail,"GB-Eintrag / GB-Entry",
              "<html><body><b>".date("d.m.Y - H:i", time())."</b><br><br>
              <b>Name: </b>".$_REQUEST['name']."<br>
              <b>Email: </b>".$_REQUEST['email']."<br>
              <b>ICQ: </b>".$_REQUEST['icq']."<br>
              <b>Homepage: </b>".$_REQUEST['homepage']."<br>
              <b>Text: </b>".$_REQUEST['body']."</body></html>",
              "From: \"AN-Guestbook\" <$mail>\nX-Mailer: PHP/" . phpversion
    ()."\nMime-Version: 1.0\nContent-Type: text/html; charset=\"ISO-8859-1
    \"");
              if($bbcode) $_REQUEST['body'] = bbcode($_REQUEST['body']);
              else $_REQUEST['text'] = nl2br($_REQUEST['body']);
              if($enreplace) $_REQUEST['body'] = replacement($_REQUEST
    ['body'], $badwords);
              if($ensmilies) $_REQUEST['body'] = smilies($_REQUEST['body'],
     $smilies);
              $_REQUEST['body'] = ($chars>0) ? split_text($_REQUEST['body'],
     $chars) : $_REQUEST['body'];
              $show = ($admincheck) ? 0 : 1;
              writedata($show, array(time(), $getip, stripslashes
    ($_REQUEST['name']), $_REQUEST['email'], $_REQUEST['icq'], $_REQUEST
    ['homepage'], $_REQUEST['body']));
    
              if($thanks)
              {
                $out .= "<center>"._thankyou."</center><br>";
              }
              if($admincheck)
              {
                $out .= "<center>"._check."</center><br>";
              }
              if(!empty($out))
              {
    
                $out .= "<br><center><a href=\"gb.php\">"._back."</a></center>";
                echo tplprint("tpl/saved.tpl", array("MESSAGE" => $out));
              }
              else
              {
    
                header("Location: gb.php");
                exit;
              }
            }
            else
            {
              $tout = "<b>"._wrong."</b><br>\n<ul>";
              $tout .= $out;
              $tout .= "</ul>";
              $tout .= "<br><center>
    <a href=\"javascript:history.back(1)\">"._back."</a></center>";
              echo tplprint("tpl/saved.tpl", array("MESSAGE" => $tout));
    
            }
    
          }
          else
          {
    
            $out = "<b>"._missing."</b><br>";
            $out .= "<ul>\n";
            if(empty($_REQUEST['name'])) $out .= "<li>"._mname."</li><br>";
            if(empty($_REQUEST['body'])) $out .= "<li>"._mcontent."</li><br>";
            $out .= "</ul>";
            $out .= "<br><center><a href=\"javascript:history.back(1)
    \">"._back."</a></center>";
            echo tplprint("tpl/saved.tpl", array("MESSAGE" => $out));
          }
          break;
        case "uin":
          if($_REQUEST['uin'])
          {
            addicq($_REQUEST['uin']);
            break;                   // Falls keine UIN übermittelt, normal GB laden
          }
        default:
          $data = array_reverse(loaddata());
          $table = "";
          $i=0;
          $entrynum = count($data);
          foreach($data as $erg)
          {
    
            if($i >= $_REQUEST['cc'])
            {
              $erg = explode("::", $erg);
    
              $tth = 0;
              foreach($erg as $tempd)
              {
                $ergtemp[$tth] = (($tth == 4) && ($encodemails)) ? $tempd : 
    base64_decode($tempd);
                $tth++;
              }
              $erg = $ergtemp;
              unset($ergtemp);
    
              $erg[4] = trim($erg[4]);
              if(!empty($erg[4]))
              {
                $erg[4] = ($encodemails) ? "<script language=\"JavaScript\">
    writemail(\"".$erg[4]."\")</script>
    " : "<a href=\"mailto:".$erg[4]."\"><img src=\"img/mail.gif\" alt=\"Email\"
     border=0></a>";
              }
              $erg[5] = trim($erg[5]);
              if(!empty($erg[5])) $erg[5] = "<a href=\"gb.php?
    service=uin&uin=".$erg[5]."\"><img src=\"img/icq.gif\" alt=\"ICQ\" 
    border=0></a>";
              $erg[6] = trim($erg[6]);
              if(!empty($erg[6])) $erg[6] = "<a href=\"".$erg[6]."\"
     target=\"_blank\"><img src=\"img/hp.gif\" alt=\"Homepage\"
     border=0></a>";
              if(empty($erg[4]) && empty($erg[5]) 
    && empty($erg[6])) $erg[5] = _nodata;
              if(!empty($erg[8])) $erg[8] = _comment.$erg[8];
    
              $table .= tplprint("tpl/table.tpl", array(
                "NAME" =>  $erg[3],
                "EMAIL" => $erg[4],
                "ICQ" => $erg[5],
                "HP" => $erg[6],
                "CONTENT" => $erg[7],
                "COMMENT" => $erg[8],
                "DATE" => date("d.m.Y", $erg[1]),
                "TIME" => date("H:i", $erg[1]),
                "NUMBER" => ($entrynum-$i)));
              if($i == $entries+$_REQUEST['cc']-1) break;
              unset($erg);
            }
            $i++;
          }
    
          $mnum = $entrynum;
    
          $sites = "";
          $i=-$entries;
          $ic = 1;
          while($mnum>0)
          {
            $mnum = $mnum - $entries;
            $i = $i + $entries;
            if($_REQUEST['cc'] == $i) $sites .= "<b>$ic</b> ";
            else $sites .= "<a href=\"gb.php?cc=$i\">$ic</a> ";
            $ic++;
          }
    
          $menu = tplprint("tpl/menu.tpl", array(
            "ENTRYNUM" => $entrynum,
            "SITES" => $sites));
          echo tplprint("tpl/index.tpl", array(
            "ENTRIES" => $table,
            "MENU" => $menu,
            "SUBMIT" => tplprint("tpl/submit.tpl", array())));
      }
    
    ?>
    Zuletzt geändert von DiamondDog; 11.02.2007, 11:28.

    Kommentar

    Lädt...
    X