Rechencaptcha in JAvascript?

Hier werden Probleme rund um das Rechen Captcha behandelt

Moderator: frameguard

Rechencaptcha in JAvascript?

Beitragvon 0grish » 06.02.2010, 14:06

Hallo ich habe eine frage,
ich möchte den rechencaptcha in meine Registration einfügen,
jedoch dort wo die angaben überprüft werden, ist es in einem javascript drin.

Hier registration.html
-----------------------------------------------------------------------------
<?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"], "n91n9x4nz84n901x4n9zn89m00y7m0ym0m1");
$sicherheits_eingabe = str_replace("=", "", $sicherheits_eingabe);
$sicherheitscode_korrekt = false;
if(isset($_SESSION['rechen_captcha_spam']) AND $sicherheits_eingabe == $_SESSION['rechen_captcha_spam']){
$sicherheitscode_korrekt = true;
unset($_SESSION['rechen_captcha_spam']);
}
?>

<HTML>
<HEAD>
<TITLE>Registration</TITLE>

<script Language="JavaScript">
<!--
function Form1_Validator(theForm)
{
if (theForm.firstname.value == "")
{
alert("Please enter a value for the \"firstname\" field.");
theForm.firstname.focus();
return (false);
}
if (theForm.lastname.value == "")
{
alert("Please enter a value for the \"lastname\" field.");
theForm.firstname.focus();
return (false);
}
if (theForm.username.value == "")
{
alert("Please enter a value for the \"username\" field.");
theForm.firstname.focus();
return (false);
}
if (theForm.email.value == "")
{
alert("Please enter a value for the \"email\" field.");
theForm.email.focus();
return (false);
}
if (theForm.password.value == "")
{
alert("Please enter a value for the \"password\" field.");
theForm.email.focus();
return (false);
}
if (theForm.password.value != theForm.confirm.value)
{
alert("The two passwords are not the same.");
theForm.confirm.focus();
return (false);
}
}
<?php
if ($sicherheitscode=="") { $error .=" Spamschutz";}
if ($sicherheitscode_korrekt==false) { $error .=" Spamschutz";}
?>


//--></script>
</head>

<BODY>
<H1 style="margin-top: 0; margin-bottom: 0"><font face="Tahoma" size="4">
Register</font></H1>
<FORM METHOD="POST" ACTION="register.php" onsubmit="return Form1_Validator(this)" language="JavaScript" name="Form1">
<P style="margin-top: 0; margin-bottom: 0"><font face="Tahoma">
<strong style="font-weight: 400"><font size="2">First Name:</font></strong><font size="2"><BR>
</font><font face="Tahoma" size="1">
<INPUT NAME="firstname" SIZE=25 MAXLENGTH=50></font></font></p>
<P style="margin-top: 0; margin-bottom: 0"><font face="Tahoma">
<strong style="font-weight: 400"><font size="2">Last Name:</font></strong><font size="2"><BR>
</font><font face="Tahoma" size="1">
<INPUT NAME="lastname" SIZE=25 MAXLENGTH=50><br>
</font><font face="Tahoma" size="2">
Username:</font><font face="Tahoma" size="1"><br>
<INPUT NAME="username" SIZE=25 MAXLENGTH=50></font></font></p>
<P style="margin-top: 0; margin-bottom: 0"><font face="Tahoma">
<strong style="font-weight: 400"><font size="2">Password:</font></strong><font size="2"><BR>
</font><font face="Tahoma" size="1">
<INPUT TYPE="password" NAME="password" SIZE=25 MAXLENGTH=25><br>
</font><font size="2"><strong style="font-weight: 400">Confirm Password:</strong></font><font face="Tahoma" size="1"><br>
<INPUT TYPE="password" NAME="confirm" SIZE=25 MAXLENGTH=25></font></font></p>
<P style="margin-top: 0; margin-bottom: 0"><strong style="font-weight: 400">
<font face="Tahoma" size="2">E-Mail Address</font></strong><font face="Tahoma"><strong style="font-weight: 400"><font size="2">:</font></strong><font size="2"><BR>
</font><font face="Tahoma" size="1">
<INPUT TYPE="text" NAME="email" SIZE=25 MAXLENGTH=100></font></font></p>
<P style="margin-top: 0; margin-bottom: 0">
<tr>
<td>
<b>Spamschutz:</b><font color="Red"><b>*</b></font></td>
<td>
<img src="rechen-captcha.php">
<input type="text" name="sicherheitscode" size="5" maxlength="10" value="" ></td>
</tr>

<INPUT TYPE="submit" NAME="submit" VALUE="Submit" style="font-family: Tahoma"></p>
</FORM>
</BODY>
</HTML>
-----------------------------------------------------------------------------

könnt ihr mir helfen?

hatte auch sowas eingebaut:

Code: Alles auswählen
if (theForm.sicherheitscode.value == "")
  {
    alert("Bitte gib das richtige Ergebniss ein im \"sicherheits\" Feld.");
    theForm.sicherheitscode.focus();
    return (false);
  }
0grish
 
Beiträge: 1
Registriert: 06.02.2010, 14:01

Re: Rechencaptcha in JAvascript?

Beitragvon Rob [Admin] » 11.02.2010, 23:02

Aus Sicherheitsgründen ist der Weg über JavaScript nicht zu empfehlen, denn der Hacker/das Tool können den Quelltext auslesen/analysieren, dann nützt das Captcha nichts mehr, wenn die Lösung im Quellcode steht
Rob [Admin]
Site Admin
 
Beiträge: 143
Registriert: 23.12.2006, 12:27


Zurück zu Rechen Captcha

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 0 Gäste

cron