Hallo!
Rechen-Grafik erscheint bei mir nicht.
Hier mal mein Gästebuchcode. Arbeite mit PHP und SQL.
<?php
include("php/global.inc.php5");
include("php/database.inc.php5");
include("php/system.inc.php5");
include("php/session.inc.php5");
include("php/benutzer.inc.php5");
//Variablen müssen vorher belegt werden
///////////////////////////////////////////////////////////////////////////////////////////////////////
$g_sessionid=session_check($_GET[g_url_var_urlsession]);
system_database_pageview_set(g_field_VIEWCOUNT_home);
$g_pagename=g_field_VIEWCOUNT_home;
$g_head="Herzlich Willkommen";
$g_vid="home01";
$g_title="The Original Lüdenscheid's Borussen";
$seite=$_GET[g_url_var_fnc_seite];
//Seiteninhalt
///////////////////////////////////////////////////////////////////////////////////////////////////////
//Kurzbeschreibung
$g_mainkopf=<<<SEITENINHALT
<p align="center">
<img border="0" valign=middle" src="dokumente/grafiken/allgemein/gaestebuchbannerklein.jpg"></p>
</p>
SEITENINHALT;
//////////////////GÄSTEBUCH ID AUSLESEN/////////////////////////////////
$conn3;$sql3;$result3;
$conn3=database_open();
$sql3="Select * FROM " . g_field_GAESTEBUCH . " ORDER BY ID DESC LIMIT 1";
$result3=database_execute($conn3,$sql3);
if ($result3)
{
$id=mysql_result($result3,$row,g_field_GAESTEBUCH_id);
$gbid=$id+1;
}
database_close($conn3);
////////////////////////////////////////////////////////////////////////
if ($seite==1)
{
$seitevon=$gbid;
$seitebis=($seitevon-9);
}
else
{
$seite1von=$gbid;
$seitevoncalc=(($seite*10)-10);
$seitevon=$gbid-$seitevoncalc;
$seitebis=($seitevon-9);
}
//Langbeschreibung
$g_mainhaupt=<<<SEITENINHALT
<p align="center" valign="top">
<table cellspacing= cellpadding=0 valign="top">
<tr>
<td width="450 px" height="20px" bgcolor="#FDD600"><span class='ss_text02'><b>Verewigen Sie sich in unserem Gästebuch</b></span></td>
</tr>
</table>
<table width="450 px" height="150 px" border=1 bgcolor=#000000 bordercolor=#FDD600 valign="top">
<form name="gaestebuch" method="post" action="php/actionphp.inc.php5?urlsession=$g_sessionid&fnc=gaestebuch_snd&fnc_gbid=$gbid">
<tr>
<td valign="top">
<table cellspacing= cellpadding=0 valign="top">
<tr>
<td width="15px"></td>
<td width="110px" valign="top">
<span class="ss_text01">Name: </span>
</td>
<td width="1px"></td>
<td width="110px" valign="top">
<input type="text" name="txtgbname" visible="false" class="ss_formular01" size="25">
</td>
<td width="15px"></td>
<td width="110px" valign="top">
<span class="ss_text01">Wohnort: </span>
</td>
<td width="1px"></td>
<td width="110px" valign="top">
<input type="text" name="txtgbwohnort" class="ss_formular01" size="25">
</td>
</tr>
<tr>
<td width="15px"></td>
<td width="110px" valign="top">
<span class="ss_text01">Email: </span>
</td>
<td width="1px"></td>
<td width="110px" valign="top">
<input type="text" name="txtgbemail" class="ss_formular01" size="25">
</td>
<td width="15px"></td>
<td width="110px" valign="top">
<span class="ss_text01">Homepage: </span>
</td>
<td width="1px"></td>
<td width="110px" valign="top">
<input type="text" name="txtgbhomepage" class="ss_formular01" size="25">
</td>
</tr>
</table>
<span class="ss_text01">Bitte lesen Sie unsere </span> <a href='gbregeln01.php?urlsession=$g_sessionid' class='ss_linkeffect03'><span class='ss_text02'>Gästebuchregeln</small></span></a><br>
<table cellspacing= cellpadding=0 valign="top">
<tr>
<td width="2px"></td>
<td width="110px" valign="top">
<span class="ss_text01">Nachricht: </span>
</td>
<td width="5px"></td>
<td width="110px" valign="top">
<textarea name="txtgbeintrag" rows=10 cols=70 class="ss_formular01"></textarea>
</td>
</tr>
</table>
<table cellspacing= cellpadding=0 valign="top">
<tr>
<td width="2px"></td>
<td width="110px" valign="top">
<td><img src="rechen-captcha.php"></td>
<td><input type="text" name="sicherheitscode" size="5"></td>
</td>
<td width="5px"></td>
<td width="310px" valign="top">
<span class="ss_text01">Bitte Code eingeben:</span><input type="text" name="txtgbwohnort" class="ss_formular01" size="25">
</td>
</tr>
</table>
<table cellspacing= cellpadding=0 valign="top" width="440px" height="1px">
<tr>
<td align="right">
<p align="right"><input type="submit" value="Verewigen" onClick="return check_gaestebuch_snd('gaestebuch')"></p>
</td>
</tr>
</table>
</td>
</tr>
</form>
</table>
</p>
SEITENINHALT;
$conn2;$sql2;$result2;
$conn2=database_open();
$sql2="Select * FROM " . g_field_GAESTEBUCH;
$result2=database_execute($conn2,$sql2);
$g_mainhaupt.="<span class='ss_text01'><center>";
if ($result2)
{
$g_anzahl=ceil(mysql_num_rows($result2)/10);
$g_mainhaupt.="Seite ";
for($g_seite=1;$g_seite<=$g_anzahl;++$g_seite)
{
if ($g_seite<>$g_anzahl)
{
$g_mainhaupt.="<a href='guestbook01.php?urlsession=$g_sessionid&fnc_seite=" . $g_seite . "' class='ss_linkeffect04'><span class='ss_text07'>" . $g_seite . "</a> | </small></span>";
}
else
{
$g_mainhaupt.="<a href='guestbook01.php?urlsession=$g_sessionid&fnc_seite=" . $g_seite . "' class='ss_linkeffect04'><span class='ss_text07'>" . $g_seite . "</small></span></a>";
}
}
$g_mainhaupt.="<br>";
$g_mainhaupt.=mysql_num_rows($result2) . " Gästebucheinträge";
$g_mainhaupt.="</span>";
//$g_mainhaupt.="<table bgcolor='#FDD600' border=1 bordercolor='#000000' width='600px'>";
//$g_mainhaupt.="<tr><td>";
}
database_close($conn2);
$conn;$sql;$result;
$conn=database_open();
$sql="Select * FROM " . g_field_GAESTEBUCH . " WHERE " . g_field_GAESTEBUCH_id . " <= " . $seitevon . " AND " . g_field_GAESTEBUCH_id . " >= " . $seitebis . " GROUP BY ID DESC";
$result=database_execute($conn,$sql);
$g_mainhaupt.="<span class='ss_text01'><center>";
if ($result)
{
$g_mainhaupt.="<br>";
$g_mainhaupt.="</span>";
//$g_mainhaupt.="<table bgcolor='#FDD600' border=1 bordercolor='#000000' width='600px'>";
//$g_mainhaupt.="<tr><td>";
for($row=0;$row<=mysql_num_rows($result) - 1;++$row)
{
$g_email=mysql_result($result,$row,g_field_GAESTEBUCH_email);
$g_homepage=mysql_result($result,$row,g_field_GAESTEBUCH_homepage);
if ($g_homepage!='')
{
$g_mainhaupt.="<table bgcolor='#FDD600' width='600px'>";
$g_mainhaupt.="<tr>";
$g_mainhaupt.="<td width='5px'></td>";
$g_mainhaupt.="<td><span class='ss_text02'><b>";
$g_mainhaupt.="Am ";
$g_mainhaupt.=mysql_result($result,$row,g_field_GAESTEBUCH_datum);
$g_mainhaupt.=" um ";
$g_mainhaupt.=mysql_result($result,$row,g_field_GAESTEBUCH_zeit);
$g_mainhaupt.=" schrieb ";
$g_mainhaupt.=mysql_result($result,$row,g_field_GAESTEBUCH_name);
$g_mainhaupt.=" aus ";
$g_mainhaupt.=mysql_result($result,$row,g_field_GAESTEBUCH_wohnort);
$g_mainhaupt.="</b></span>";
$g_mainhaupt.="</td>";
$g_mainhaupt.="<td><span class='ss_linkeffect01'><b>";
$g_mainhaupt.="<p align='right'>";
$g_mainhaupt.="<a href='mailto:$g_email'><img border='0' src='dokumente/grafiken/allgemein/email.jpg'></a>";
$g_mainhaupt.=" ";
$g_mainhaupt.="<a span class='ss_linkeffect01' target='_blank' href='http://$g_homepage'>www</a>";
$g_mainhaupt.="</p>";
$g_mainhaupt.="</b></span></td>";
$g_mainhaupt.="</tr>";
$g_mainhaupt.="</table>";
}
if ($g_homepage=='')
{
$g_mainhaupt.="<table bgcolor='#FDD600' width='600px'>";
$g_mainhaupt.="<tr>";
$g_mainhaupt.="<td width='5px'></td>";
$g_mainhaupt.="<td><span class='ss_text02'><b>";
$g_mainhaupt.="Am ";
$g_mainhaupt.=mysql_result($result,$row,g_field_GAESTEBUCH_datum);
$g_mainhaupt.=" um ";
$g_mainhaupt.=mysql_result($result,$row,g_field_GAESTEBUCH_zeit);
$g_mainhaupt.=" schrieb ";
$g_mainhaupt.=mysql_result($result,$row,g_field_GAESTEBUCH_name);
$g_mainhaupt.=" aus ";
$g_mainhaupt.=mysql_result($result,$row,g_field_GAESTEBUCH_wohnort);
$g_mainhaupt.="</b></span>";
$g_mainhaupt.="</td>";
$g_mainhaupt.="<td><span class='ss_linkeffect01'><b>";
$g_mainhaupt.="<p align='right'>";
$g_mainhaupt.="<a href='mailto:$g_email'><img border='0' src='dokumente/grafiken/allgemein/email.jpg'></a>";
$g_mainhaupt.="</p>";
$g_mainhaupt.="</b></span></td>";
$g_mainhaupt.="</tr>";
$g_mainhaupt.="</table>";
}
$g_mainhaupt.="<table bgcolor='#000000' border=1 bordercolor='#FDD600' width='600px'>";
$g_mainhaupt.="<tr><td>";
$g_mainhaupt.="<span class='ss_text01'>";
$g_mainhaupt.=mysql_result($result,$row,g_field_GAESTEBUCH_eintrag);
$g_mainhaupt.="</span>";
$g_mainhaupt.="</td></tr>";
$g_mainhaupt.="</table>";
$g_mainhaupt.="<table bgcolor='#000000' border=1 bordercolor='#000000' width='600px'>";
$g_mainhaupt.="<tr>";
$g_mainhaupt.="<td> </td><center>";
$g_mainhaupt.="</tr>";
$g_mainhaupt.="</table>";
}
}
database_close($conn);
///////////////////////////////////////////////////////////////////////////////////////////////////////
include("php/layout_header.inc.php5");
?>
Die rechen-captcha.php liegt im gleichen Verzeichnis.
Und was ist eigentlich hier mit gemeint?
Einbau ins Script
<?php
session_start();
function encrypt($string, $key) {
$result = '';
for($i=0; $i<strlen($string); $i++) {
$char = substr($string, $i, 1);
$keychar = substr($key, ($i % strlen($key))-1, 1);
$char = chr(ord($char)+ord($keychar));
$result.=$char;
}
return base64_encode($result);
}
$sicherheits_eingabe = encrypt($_POST["sicherheitscode"], "29jfkd921");
$sicherheits_eingabe = str_replace("=", "", $sicherheits_eingabe);
if(isset($_SESSION['rechen_captcha_spam']) AND $sicherheits_eingabe == $_SESSION['rechen_captcha_spam']){
unset($_SESSION['rechen_captcha_spam']);
//
//
//Hier kommt das ursprüngliche Script hin.
//
//
}
?>
Der Key 29jfkd921 muss der Gleiche sein wie bei der rechen-captcha.php. Der Einbau ins bestehende Script ist sehr einfach, es braucht nur eine if-Schleife um das bisherige Script, welche überprüft ob das Ergebnis das eingegeben wurde, der generierten Captcha Rechnung entspricht. Optional kann auch noch ein else Teil angefügt werden, welche den Fehler ausgibt, dass das Ergebnis falsch war.
Wo soll ich das denn einbauen??
<b> Habe mir die Fehler.php erstellt. Nur wo soll ich die verweisen? Soll ich die anstatt der rechen-captcha.php verweisen?</b>
