1
hallo,
ich würde gerne der registration meiner site ein captcha zufügen. hab auch ein entsprechendes script gefunden. das bild wird erstellt und das entsprechende eingabefeld habe ich auch eingefügt.
mir ist jetzt nicht klar wie ich den ausführenden teil in mein script einfügen muss. meine versuche sind bisher gescheitert. der ausführende code schaut so aus:
mein script sieht so aus:
ich würde gerne der registration meiner site ein captcha zufügen. hab auch ein entsprechendes script gefunden. das bild wird erstellt und das entsprechende eingabefeld habe ich auch eingefügt.
<tr>
<td align="right"> </td>
<td height="33" align="right"> </td>
<td> </td>
<td height="24" colspan="2" align="left" valign="middle"><img src="captcha/captcha.php" border="0" title="Sicherheitscode"></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td align="right"> </td>
<td height="33" align="right"> </td>
<td> </td>
<td height="24" colspan="2" align="left" valign="middle"><input type="text" name="sicherheitscode" size="19"></td>
<td> </td>
<td> </td>
</tr>
mir ist jetzt nicht klar wie ich den ausführenden teil in mein script einfügen muss. meine versuche sind bisher gescheitert. der ausführende code schaut so aus:
<?php
session_start();
if(isset($_SESSION['captcha_spam']) AND $_POST["sicherheitscode"] == $_SESSION['captcha_spam']){
unset($_SESSION['captcha_spam']);
}else{
die ("Der Sicherheitscode ist falsch!");
}
?>
mein script sieht so aus:
<?php require_once('Connections/Registrierung.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "einfache registrierung")) {
$error = '';
mysql_select_db($database_Registrierung, $Registrierung);
$result = mysql_query("SELECT nutzername FROM login WHERE nutzername = '" . mysql_real_escape_string($_POST['nutzername']) . "'");
if (mysql_num_rows($result) > 0) {
$error = 'Dieser Nutzername ist bereits vergeben. Bitte versuchen Sie es mit einem anderen Namen.';
} else {
$result = mysql_query("SELECT mail FROM login WHERE mail = '" . mysql_real_escape_string($_POST['mail']) . "'");
if (mysql_num_rows($result) > 0) {
$error = 'Diese Emailadresse ist bereits vergeben. Bitte versuchen Sie es mit einer anderen E-Mail.';
}
echo mysql_error();
}
echo mysql_error();
if ($error == "") {
$insertSQL = sprintf("INSERT INTO login (vornachname, nutzername, passwort, mail, handy) VALUES (%s, %s, %s, %s, %s)",
GetSQLValueString($_POST['vornachname'], "text"),
GetSQLValueString($_POST['nutzername'], "text"),
GetSQLValueString($_POST['passwort'], "text"),
GetSQLValueString($_POST['mail'], "text"),
GetSQLValueString($_POST['handy'], "text"));
$Result1 = mysql_query($insertSQL, $Registrierung) or die(mysql_error());
$insertGoTo = "8cSieSindEingeloggt.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
}
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if (isset($_POST['nutzername']) && empty($error)) {
$loginUsername=$_POST['nutzername'];
$password=$_POST['passwort'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "8cSieSindEingeloggt.php";
$MM_redirectLoginFailed = "8bMeinkontologinfehlgeschlagen.php";
$MM_redirecttoReferrer = true;
mysql_select_db($database_Registrierung, $Registrierung);
$LoginRS__query=sprintf("SELECT nutzername, passwort FROM login WHERE nutzername=%s AND passwort=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $Registrierung) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && true) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>mit-umzug-gelegenheit.de</title>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationConfirm.js" type="text/javascript"></script>
<script type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_nbGroup(event, grpName) { //v6.0
var i,img,nbArr,args=MM_nbGroup.arguments;
if (event == "init" && args.length > 2) {
if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
nbArr[nbArr.length] = img;
for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = args[i+1];
nbArr[nbArr.length] = img;
} }
} else if (event == "over") {
document.MM_nbOver = nbArr = new Array();
for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
nbArr[nbArr.length] = img;
}
} else if (event == "out" ) {
for (i=0; i < document.MM_nbOver.length; i++) {
img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
} else if (event == "down") {
nbArr = document[grpName];
if (nbArr)
for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
document[grpName] = nbArr = new Array();
for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
nbArr[nbArr.length] = img;
} }
}
//-->
</script>
<style type="text/css">
<!--
@import url("schriftangaben1111111111.css");
body {
margin-top: 50px;
}
.Stil20 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; font-weight: bold; }
.Schriftangaben {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: bold;
background-position: right center;
}
.Stil22 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; background-position: right center; }
.Schriftstil { font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: bold;
}
#Layer1 {
position:absolute;
left:2px;
top:1px;
width:100%;
height:100%;
z-index:1;
visibility: hidden;
}
-->
</style>
<script type="text/javascript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<link href="Seiten/Seiten/Stylesheet Formular.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.Stil23 {color: #FFFFFF}
.Stil24 {color: #000000}
.Stil28 {font-size: 14px;
color: #000000;
}
-->
</style>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationConfirm.css" rel="stylesheet" type="text/css" />
</head>
<body onload="MM_preloadImages('Bilder/Home 3.png','Bilder/Home 2.png','Bilder/Home 4.png','Bilder/Mit-Umzug-Angebote 3.png','Bilder/Mit-Umzug-Angebote 4.png','Bilder/Eingabe 3.png','Bilder/Eingabe 2.png','Bilder/Eingabe 4.png','Bilder/MeinKonto 3.png','Bilder/MeinKonto 4.png','Bilder/Hilfe 3.png','Bilder/Hilfe 2.png','Bilder/Hilfe 4.png','Bilder/Mit-Umzug-Angebote 2.png')" tracingsrc="1home.php" tracingopacity="100" tracingx="0" tracingy="3458793">
<div id="Layer1"></div>
<table width="859" border="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="131"> </td>
<td width="131"> </td>
<td width="131"> </td>
<td width="337" align="right" valign="bottom" class="Schriftangaben"><a href="9Impressum.php" class="schriftangaben11111111111">impressum</a></td>
<td width="79" align="right" valign="bottom" class="Schriftangaben"><a href="99aRegistrierungEinfach.php" class="schriftangaben11111111111">registrierung</a></td>
<td width="38" align="right" valign="bottom" class="Schriftangaben"><a href="8aMeinkontologin.php" class="schriftangaben11111111111">login</a></td>
</tr>
</table>
<table width="1200" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="54" height="160" valign="top"><!--DWLayoutEmptyCell--> </td>
<td colspan="2" valign="top"><img src="Bilder/Mit-Umzug-Gelegenheit Hauptbild.png" alt="mit-umzug-gelegenheit.de" width="805" height="160" vspace="5" border="0" usemap="#Map" /></td>
<td width="89" valign="bottom"> </td>
<td width="252"></td>
</tr>
<tr>
<td height="2"></td>
<td width="524"></td>
<td width="281"></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="106"></td>
<td colspan="3" valign="top"><table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><a href="1home.php" target="_top" onclick="MM_nbGroup('down','group1','Home1','Bilder/Home 3.png',1)" onmouseover="MM_nbGroup('over','Home1','Bilder/Home 2.png','Bilder/Home 4.png',1)" onmouseout="MM_nbGroup('out')"><img src="Bilder/Home 1.png" alt="home" name="Home1" border="0" id="Home1" onload="" /></a></td>
<td><a href="AngeboteoderGesucheSuchen.php" target="_top" onclick="MM_nbGroup('down','group1','MitUmzugAngebote1','Bilder/Mit-Umzug-Angebote 3.png',1)" onmouseover="MM_nbGroup('over','MitUmzugAngebote1','Bilder/Mit-Umzug-Angebote 2.png','Bilder/Mit-Umzug-Angebote 4.png',1)" onmouseout="MM_nbGroup('out')"><img src="Bilder/Mit-Umzug-Angebote 1.png" alt="suche" name="MitUmzugAngebote1" hspace="5" border="0" id="MitUmzugAngebote1" onload="" /></a></td>
<td><a href="8aMeinkontologin.php" target="_top" onclick="MM_nbGroup('down','group1','Eingabe1','Bilder/Eingabe 3.png',1)" onmouseover="MM_nbGroup('over','Eingabe1','Bilder/Eingabe 2.png','Bilder/Eingabe 4.png',1)" onmouseout="MM_nbGroup('out')"><img src="Bilder/Eingabe 1.png" alt="eingabe" name="Eingabe1" hspace="5" border="0" id="Eingabe1" onload="" /></a></td>
<td><a href="8aMeinkontologin.php" target="_top" onclick="MM_nbGroup('down','group1','MeinKonto1','Bilder/MeinKonto 3.png',1)" onmouseover="MM_nbGroup('over','MeinKonto1','Bilder/MeinKonto 4.png','Bilder/MeinKonto 4.png',1)" onmouseout="MM_nbGroup('out')"><img src="Bilder/MeinKonto 3.png" alt="mein konto" name="MeinKonto1" hspace="5" border="0" id="MeinKonto1" onload="" /></a></td>
<td><a href="7hilfe.php" target="_top" onclick="MM_nbGroup('down','group1','Hilfe1','Bilder/Hilfe 3.png',1)" onmouseover="MM_nbGroup('over','Hilfe1','Bilder/Hilfe 2.png','Bilder/Hilfe 4.png',1)" onmouseout="MM_nbGroup('out')"><img src="Bilder/Hilfe 1.png" alt="hilfe" name="Hilfe1" border="0" id="Hilfe1" onload="" /></a></td>
</tr>
</table></td>
<td></td>
</tr>
<tr>
<td height="19"></td>
<td height="13" align="right" valign="middle" class="schriftangaben11111111111"><a href="99bRegistrierungErweitert.php" class="schriftangaben11111111111">erweiterte registrierung</a></td>
<td> </td>
<td> </td>
<td></td>
</tr>
<tr>
<td height="103"></td>
<td valign="top"><img src="Bilder/Registrieren Kopf.png" alt="registrieren" width="524" height="96" /></td>
<td> </td>
<td> </td>
<td></td>
</tr>
<tr>
<td height="416"></td>
<td align="left" valign="top"><form id="einfache registrierung" name="einfache registrierung" method="POST" action="<?php echo $editFormAction; ?><?php echo $loginFormAction; ?>">
<table width="524" height="574" border="0" cellspacing="0" bgcolor="#E1E2BC">
<tr class="registri">
<td height="25" align="right"> </td>
<td height="25" colspan="5" align="left" valign="middle"><?php
if ($error != '') {
echo '<p>' . $error . '</p>';
}
?></td>
<td width="24"> </td>
</tr>
<tr>
<td width="47" align="right" valign="middle"> </td>
<td width="131" height="68" align="right" valign="middle"><span class="Stil20">nutzername</span></td>
<td width="6"> </td>
<td height="68" colspan="2" align="left" valign="middle"><span id="sprytextfield1">
<label>
<input name="nutzername" type="text" id="nutzername" maxlength="20" />
<span class="Stil24">*</span></label>
</span></td>
<td width="5"> </td>
<td> </td>
</tr>
<tr>
<td align="right" valign="middle" bgcolor="#F0EEDB"> </td>
<td height="67" colspan="5" align="center" valign="middle" bgcolor="#F0EEDB" class="ergebnisschrift">Bitte verwenden Sie für Ihr passwort 8 bis 15 Zeichen. Die Zeichen sollten möglichst aus Groß- und Kleinbuchstaben sowie Zahlen bestehen</td>
<td bgcolor="#F0EEDB"> </td>
</tr>
<tr>
<td align="right" valign="middle"> </td>
<td height="21" align="right" valign="middle"> </td>
<td> </td>
<td height="21" align="left" valign="middle"> </td>
<td height="21" align="left" valign="middle"> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td align="right" valign="middle"> </td>
<td height="33" align="right" valign="middle"><span class="Stil20">passwort</span></td>
<td> </td>
<td width="295" height="24" align="left" valign="middle"><label></label>
<span id="sprytextfield2">
<label>
<input name="passwort" type="password" id="passwort" maxlength="15" />
<span class="Stil24">*</span><span class="textfieldMinCharsMsg"><br />
Bitte 8-15 Zeichen verwenden.</span></label>
</span></td>
<td width="2" height="24" align="left" valign="middle"> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td align="right"> </td>
<td height="33" align="right"><span class="Stil20">passwort wdh</span></td>
<td> </td>
<td height="24" colspan="2" align="left" valign="middle"><span id="spryconfirm1">
<input name="passwort2" type="password" id="passwort2" maxlength="15" />
</span><span class="Stil24">*</span></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td align="right"> </td>
<td height="33" align="right"> </td>
<td> </td>
<td height="24" colspan="2" align="left" valign="middle"> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td align="right"> </td>
<td height="33" align="right"><span class="Schriftangaben">tel/handy</span></td>
<td> </td>
<td height="24" colspan="2" align="left" valign="middle"><span id="sprytextfield4">
<input name="handy" type="text" id="handy" maxlength="50" />
</span><span class="Stil24">*</span></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td align="right"> </td>
<td height="33" align="right"><span class="Schriftangaben">mail</span></td>
<td> </td>
<td height="24" colspan="2" align="left" valign="middle"><span id="sprytextfield5">
<label>
<input name="mail" type="text" id="mail" maxlength="50" />
<span class="Stil24">*</span></label>
</span></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td align="right"> </td>
<td height="33" align="right"> </td>
<td> </td>
<td height="24" colspan="2" align="left" valign="middle"> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td align="right"> </td>
<td height="33" align="right"> </td>
<td> </td>
<td height="24" colspan="2" align="left" valign="middle"><img src="captcha/captcha.php" border="0" title="Sicherheitscode"></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td align="right"> </td>
<td height="33" align="right"> </td>
<td> </td>
<td height="24" colspan="2" align="left" valign="middle"><input type="text" name="sicherheitscode" size="19"></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td align="right"> </td>
<td height="33" align="right"> </td>
<td> </td>
<td height="24" colspan="2" align="left" valign="middle"> </td>
<td> </td>
<td> </td>
</tr>
<tr class="registri">
<td height="28" align="left"> </td>
<td height="28" colspan="5" align="left"> </td>
<td> </td>
</tr>
<tr>
<td align="right"> </td>
<td height="26" align="right"> </td>
<td> </td>
<td colspan="2" align="right" valign="middle"><label>
<input type="reset" name="Submit" value="Zurücksetzen" />
</label>
<input name="abschicken" type="submit" id="abschicken" value="Senden" /></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td align="right"> </td>
<td height="21" align="right"> </td>
<td> </td>
<td colspan="2" align="right" valign="top"> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td height="21" colspan="2" align="left" valign="top" bgcolor="#FFFFFF"><span class="Stil24">*</span> <span class="Stil28">pflichtfelder </span></td>
<td bgcolor="#FFFFFF"> </td>
<td colspan="2" align="left" valign="middle" bgcolor="#FFFFFF"> </td>
<td bgcolor="#FFFFFF"> </td>
<td bgcolor="#FFFFFF"> </td>
</tr>
</table>
<p> </p>
<input type="hidden" name="MM_insert" value="einfache registrierung" />
</form> </td>
<td> </td>
<td> </td>
<td></td>
</tr>
<tr>
<td height="19"></td>
<td> </td>
<td> </td>
<td> </td>
<td></td>
</tr>
</table>
<map name="Map" id="Map"><area shape="rect" coords="15,16,359,79" href="1home.php" />
</map>
<script type="text/javascript">
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "none", {minChars:8});
var spryconfirm1 = new Spry.Widget.ValidationConfirm("spryconfirm1", "passwort");
var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "integer");
var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5", "email");
//-->
</script>
</body>
</html>