| Vorheriges Thema anzeigen :: Nächstes Thema anzeigen |
| Autor |
Nachricht |
Kajen_Jeyam Gast
|
Wie macht man ein captcha um datein runter zu laden? |
|
|
Hallo!
Ich würde gerne wissen, wie man Captcha benutzen kann um eine Datei zu downloaden. Also man muss das richtige Captcha eingeben, damit man die Datei downloaden kann. Es soll genauso funktionieren, wie auf der Megaupload Seite.
Hier ein Beispiel:
http://www.megaupload.com/?d=TZN3KGZI
Erst wenn man den Code richtig eingibt, kann man die Datei Downloaden. Gibt man den falschen code ein, ladet es ein neuen captcha. Wie funktioniert das? Und kann man das vlt auch nachbauen? Wäre dankbar für jede Hilfe danke! |
|
|
|
| 02 Jun 2010 15:29 |
|
  |
Gast
|
Re: Wie macht man ein captcha um datein runter zu laden? |
|
|
Ich habe da auch etwas probiert, aber hat irgendwie nicht geklappt:
Das hier habe ich als spam.html gespeichert:
[HTML]<!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=utf-8" />
<title>Unbenanntes Dokument</title>
</head>
<body>
<div>
<?php
@session_start(); // start session if not started yet
if ($_SESSION['AntiSpamImage'] != $_REQUEST['anti_spam_code']) {
// set antispam string to something random, in order to avoid reusing it once again
$_SESSION['AntiSpamImage'] = rand(1,9999999);
// here you add code to let user know incorrect code entered
echo "Wrong Code! Try Again";
}
else {
// set antispam string to something random, in order to avoid reusing it once again
$_SESSION['AntiSpamImage'] = rand(1,9999999);
// everything is fine, proceed with processing feedback/comment/etc.
}
?>
<img src="antispam.php">
<input name="anti_spam_code">
<a href="get.php">Downloaden Sie hier! </a></div>
</body>
</html>[/HTML]
Dann habe ich das hier antispam.php gespeichert:
| PHP-Code: | 1 2 3 4
| <?php
$url = jesmedia.comoj.com/download?f=Footer_1.png';
?> |
und im antispam habe ich das gespeicheert:
| PHP-Code: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
| <?php
###############################################################
# Anti-spam Image Generator (CAPTCHA) 1.0
###############################################################
# For updates visit http://www.zubrag.com/scripts/
###############################################################
// Font name to use. Make sure it is available on the server.
// You could upload it to the same folder with script if it cannot find font.
// By default it uses arial.ttf font.
$font = 'arial';
// list possible characters to include on the CAPTCHA
$charset = '0123456789';
// how many characters include in the CAPTCHA
$code_length = 6;
// antispam image height
$height = 20;
// antispam image width
$width = 80;
############################################################
# END OF SETTINGS
############################################################
// this will start session if not started yet
@session_start();
$code = '';
for($i=0; $i < $code_length; $i++) {
$code = $code . substr($charset, mt_rand(0, strlen($charset) - 1), 1);
}
$font_size = $height * 0.7;
$image = @imagecreate($width, $height);
$background_color = @imagecolorallocate($image, 255, 20, 100);
$noise_color = @imagecolorallocate($image, 90, 50, 100);
/* add image noise */
for($i=0; $i < ($width * $height) / 4; $i++) {
@imageellipse($image, mt_rand(0,$width), mt_rand(0,$height), 1, 1, $noise_color);
}
/* render text */
$text_color = @imagecolorallocate($image, 0, 0, 0);
@imagettftext($image, $font_size, 0, 7,17,
$text_color, $font , $code)
or die('Cannot render TTF text.');
/* output image to the browser */
header('Content-Type: image/png');
@imagepng($image) or die('imagepng error!');
@imagedestroy($image);
$_SESSION['AntiSpamImage'] = $code;
exit();
?> |
Funkt aber nicht :S | PHP-Code: | 1
| </span><table width="90%" cellspacing="1" cellpadding="3" border="0" align="center" style="table-layout: fixed;"><tr> <td><span class="genmed"><b>Code:</b></span></td> </tr> <tr> <td class="code"><div style="overflow: auto; width: 100%;"> </div></td> </tr></table><span class="postbody"> |
|
|
|
|
| 02 Jun 2010 15:51 |
|
 |
Werner Homepage-Total.de Moderator

|
 |
|
|
Ich habe das Script nicht getestet, aber:
gehört an den Seitenanfang (ohne das vorher etwas an den Browser gesendet wurde (auch kein Leerzeichen!))
| Code: |
<?php @session_start(); ?>
<!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=utf-8" />
<title>Unbenanntes Dokument</title>
</head>
<body>
<div> |
|
_________________ Bei Fragen oder Fehlermeldungen - Bitte ausführlichen Code posten!
Wie man Fragen richtig stellt |
|
|
| 02 Jun 2010 20:51 |
|
 |
|