turn off registration from any other sites
Started on the old forum in October 2009 · view the original in the archive · old links redirect here
TL;DR · summary of 38 replies
- subzero suggested using a time limit for registration, with a message indicating the user needs to wait 30 seconds after registering.
- coder4u proposed adding captcha functionality in the registration process.
- GiLL provided a suggestion to use an IP ban file (ipban.php) and include it in the registration script.
- CreativityKills pointed out vulnerabilities in session handling that could be exploited by bots, such as not destroying the session after validation.
Written automatically from the replies by a language model on our own server. It can be wrong; the posts below are the source.
coder4u wrote: gill shut up go to hell dont mezz with me mad
keep your fights in inbox.
she is beautifull than php.and i love her more than php.
coder4u wrote: gill shut up go to hell dont mezz with me mad
do what ever u can do ok ? blody i know very well u dont crack me up
left wap stuff
hey gril bro thanks but can you give me a cobination code like it will delect the browser or like it will detect both like if brower=="soft" AND ip=="ipadd" like this because they are single ip used by 100 of chatter so if i block 1 ip then the user will face problem so either i need the browser detection or ip and browser both i have tried to put the browser problem but it wont work for me
juz wait 4 2 days i ill share wht u need ....dammm busy sorry
- Saini : Devloping The web...😳:(😠
This is your basic CAPTCHA that you can find on many web sites to HELP stop robots.
image.php
<?php
// Font directory + font name
$font = 'fonts/Disney.ttf';
// Total number of lines
$lineCount = 40;
// Size of the font
$fontSize = 40;
// Height of the image
$height = 50;
// Width of the image
$width = 150;
$img_handle = imagecreate ($width, $height) or die ("Cannot Create image");
// Set the Background Color RGB
$backColor = imagecolorallocate($img_handle, 255, 255, 255);
// Set the Line Color RGB
$lineColor = imagecolorallocate($img_handle, 175, 238, 238);
// Set the Text Color RGB
$txtColor = imagecolorallocate($img_handle, 135, 206, 235);
// Do not edit below this point
$string = "abcdefghijklmnopqrstuvwxyz0123456789";
for($i=0;$i<6;$i++){
$pos = rand(0,36);
$str .= $string{$pos};
}
$textbox = imagettfbbox($fontSize, 0, $font, $str) or die('Error in imagettfbbox function');
$x = ($width - $textbox[4])/2;
$y = ($height - $textbox[5])/2;
imagettftext($img_handle, $fontSize, 0, $x, $y, $txtColor, $font , $str) or die('Error in imagettftext function');
for($i=0;$i<$lineCount;$i++){
$x1 = rand(0,$width);$x2 = rand(0,$width);
$y1 = rand(0,$width);$y2 = rand(0,$width);
imageline($img_handle,$x1,$y1,$x2,$y2,$lineColor);
}
header('Content-Type: image/jpeg');
imagejpeg($img_handle,NULL,100);
imagedestroy($img_handle);
session_start();
$_SESSION['img_number'] = $str;
?>
form.php
<form action="result.php" method="post">
<img alt="Random Number" src="image.php">
<input type="text" name="num"><br>
<input type="submit" name="submit" value="Check">
</form>
result.php
<?php
session_start();
if($_SESSION['img_number'] != $_POST['num']){
echo'The number you entered doesn\'t match the image.<br>
<a href="form.php">Try Again</a><br>';
}else{
echo'The numbers Match!<br>
<a href="form.php">Try Again</a><br>';
}
?>
Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!
SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…
okey work done now user will not able to register with same browser + if the user is from pc will not able to register from same ip i guess it gonna work but if anyone able to give me like 30 seconds wait before registration that will be so greatful me and thanks subzeero bro gill bro and all for helping me
Durin one of my auditing lessons, i deciphered frm the biggest to the smallest hacking trick in PHP apps, they all boil down to one single ****: input validation. The code subzero gave is only useful when defending noobs, cuz i'll break no sweat getn past that. How? Take a luk at his validation, it says if( session stored != posted num ) deny. What if both parts were empty? Like i didnt visit d page and i sent a post request? It'll pass that cuz session_stored=null and posted_num=null which validates as equals cuz null=null. Another hole lingers and im sure majority ov u stil got that, reasn why my bot thrives. U forget to destroy the session. Which means i can use a session a million times. Visiting ur reg page wud give me a session whuz value is gracefully visible in captcha, copy that value, go to my external request sender or external form that posts to ur reg page wit d same text inputs and passing that first session = a millie a millie a millie 🙂
So that said i'll give u an example of a proper validation.
$captchaSession=$_SESSION['img_num']; //session set by ur captcha.php
$captchaMatch=$_POST['num'];
if(empty($captchaSession)||empty($captchaMatch)||$captchaSession!=$captchaMatch){
unset($_SESSION['img_num']);
die('Your verification number didnt match.');
}else{
unset($_SESSION['img_num']);
//CONTINUE
}
you can change the die() to sumtin user friendly. And u may use session_destroy() or session_unset() in place of unset(). The importance of removin or reseting d session cannot be overemphasized as if its nt, u myt as well nt use a captcha.
WANT A SECURITY AUDIT ON YA SCRIPT? PM ME. I DONT COST MUCH 😉
gill thief
gill wrote: do what ever u can do ok ? blody i know very well u dont crack me up
i knw u r thief u slteal ppl script n hack sites ok if u not do any good work so why u do hack mad n u knw m ur boss😍
kazzin wrote: u can use antiflood system in register.php by taking code from in creating new topics i try but i get error eror so i try again if i success il definately share here :D
its a auto bot lol😍
Hello guys , m sharing my antiflood system i used at chatmasti hopefully it myt b help full to u ol...
STEP 1.
- Create a file named captcha_image.php (you can use any file name) with following code
<?
// *** CAPTCHA image generation ***
// *** http://chatmasti.mobi ***
session_start();
// *** Tell the browser what kind of file is come'n at 'em! ***
header("Content-Type: image/jpeg");
// *** Send a generated image to the browser ***
die(create_image());
// *** Function List ***
function create_image()
{
// *** Generate a passcode using md5
// (it will be all lowercase hex letters and numbers ***
$md5 = md5(rand(0,9999));
$passy = substr($md5, 10, 5);
// *** Set the session cookie so we know what the passcode is ***
$_SESSION["passy"] = $passy;
// *** Create the image resource ***
$image = imagecreatetruecolor(100, 20);
// *** We are making two colors, white and black ***
$clr_white = ImageColorAllocate($image, 255, 255, 255);
$clr_black = ImageColorAllocate($image, 0, 136, 204);
// *** Make the background black ***
imagefill($image, 0, 0, $clr_black);
// *** Set the image height and width ***
imagefontheight(15);
imagefontwidth(15);
// *** Add the passcode in white to the image ***
imagestring($image, 5, 30, 3, $passy, $clr_white);
// *** Throw in some lines to trick those cheeky bots! ***
imageline($image, 5, 1, 50, 20, $clr_white);
imageline($image, 60, 1, 96, 20, $clr_white);
// *** Return the newly created image in jpeg format ***
return imagejpeg($image);
// *** Just in case... ***
imagedestroy($image);
}
?>
***STEP 2. ***
- Add This code in Your Registration form.
echo "<img src=\"./captcha_image.php\" alt=\"ENABLE IMAGES\"/>
<br/><strong>Enter Code shown In Image:*</strong><br/>
<input type=\"text\" name=\"captcha_input\" maxlength=\"10\"/><br/>";
STEP 3. 1.Now in Register.php or whatever file you use to insert values in database add this
<?php
////////////////////////////////////////////////Check For captha Code/////////////////
session_start();
$code = $_GET['captcha_input'];
// *** The text input will come in through the variable $_POST["captcha_input"],
// while the correct answer is stored in the cookie $_COOKIE["pass"] ***
if ($code == $_SESSION["passy"])
///////////////////////////////////////////////Continue If captha Result true//////////////////
{
// HERE You can place rest of your file fuctions
//Dnt forget to add following code before closing if block
$md5 = md5(rand(0,9999));
$pass = substr($md5, 10, 5);
// *** Set the session cookie so we know what the passcode is ***
$_SESSION["passy"] = $passy;
}
else
{
//////////////////////////////////////////////Error message For Invalid Captha/////////////////////////
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
echo '<html xmlns="http://www.w3.org/1999/xhtml">';
include "./config.php";
echo "<head>";
echo "<title>Invalid Entry</title>\n";
echo "<style type = \"text/css\">\n";
echo $default;
echo "</style></head>\n";
echo "<body>\n";
echo "<div>Invalid Entry</div>";
echo "<img src=\"image/not.gif\" alt=\"x\"/><br/>";
echo "Either you are a <strong>BOT</strong> or you Entered <strong>Invalid Image Text</strong>.<br/>";
echo "<strong>You Entered:</strong> $code<br/>";
echo "<strong>Correct Answer:</strong> " . $_SESSION["passy"];
echo "<hr/><a href=\"./regform.php\">Try Again</a><br/>";
$md5 = md5(rand(0,9999));
$passy = substr($md5, 10, 5);
// *** Set the session cookie so we know what the passcode is ***
$_SESSION["passy"] = $passy;
}
@mysql_close();
?>
Note if you get any error installing captcha leave me a pm hav fun n say gud bye to autobotz ....thanx*
- Saini : Devloping The web...😳:(😠
lol
Navjot_Saini wrote: Hello guys , m sharing my antiflood system i used at chatmasti hopefully it myt b help full to u ol...
STEP 1.
- Create a file named captcha_image.php (you can use any file name) with following code
<? // *** CAPTCHA image generation *** // *** http://chatmasti.mobi *** session_start(); // *** Tell the browser what kind of file is come'n at 'em! *** header("Content-Type: image/jpeg"); // *** Send a generated image to the browser *** die(create_image()); // *** Function List *** function create_image() { // *** Generate a passcode using md5 // (it will be all lowercase hex letters and numbers *** $md5 = md5(rand(0,9999)); $passy = substr($md5, 10, 5); // *** Set the session cookie so we know what the passcode is *** $_SESSION["passy"] = $passy; // *** Create the image resource *** $image = imagecreatetruecolor(100, 20); // *** We are making two colors, white and black *** $clr_white = ImageColorAllocate($image, 255, 255, 255); $clr_black = ImageColorAllocate($image, 0, 136, 204); // *** Make the background black *** imagefill($image, 0, 0, $clr_black); // *** Set the image height and width *** imagefontheight(15); imagefontwidth(15); // *** Add the passcode in white to the image *** imagestring($image, 5, 30, 3, $passy, $clr_white); // *** Throw in some lines to trick those cheeky bots! *** imageline($image, 5, 1, 50, 20, $clr_white); imageline($image, 60, 1, 96, 20, $clr_white); // *** Return the newly created image in jpeg format *** return imagejpeg($image); // *** Just in case... *** imagedestroy($image); } ?>***STEP 2. ***
- Add This code in Your Registration form.
echo "<img src=\"./captcha_image.php\" alt=\"ENABLE IMAGES\"/> <br/><strong>Enter Code shown In Image:*</strong><br/> <input type=\"text\" name=\"captcha_input\" maxlength=\"10\"/><br/>";STEP 3. 1.Now in Register.php or whatever file you use to insert values in database add this
<?php ////////////////////////////////////////////////Check For captha Code///////////////// session_start(); $code = $_GET['captcha_input']; // *** The text input will come in through the variable $_POST["captcha_input"], // while the correct answer is stored in the cookie $_COOKIE["pass"] *** if ($code == $_SESSION["passy"]) ///////////////////////////////////////////////Continue If captha Result true////////////////// { // HERE You can place rest of your file fuctions //Dnt forget to add following code before closing if block $md5 = md5(rand(0,9999)); $pass = substr($md5, 10, 5); // *** Set the session cookie so we know what the passcode is *** $_SESSION["passy"] = $passy; } else { //////////////////////////////////////////////Error message For Invalid Captha///////////////////////// echo '<?xml version="1.0" encoding="UTF-8"?>'; echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"; echo '<html xmlns="http://www.w3.org/1999/xhtml">'; include "./config.php"; echo "<head>"; echo "<title>Invalid Entry</title>\n"; echo "<style type = \"text/css\">\n"; echo $default; echo "</style></head>\n"; echo "<body>\n"; echo "<div>Invalid Entry</div>"; echo "<img src=\"image/not.gif\" alt=\"x\"/><br/>"; echo "Either you are a <strong>BOT</strong> or you Entered <strong>Invalid Image Text</strong>.<br/>"; echo "<strong>You Entered:</strong> $code<br/>"; echo "<strong>Correct Answer:</strong> " . $_SESSION["passy"]; echo "<hr/><a href=\"./regform.php\">Try Again</a><br/>"; $md5 = md5(rand(0,9999)); $passy = substr($md5, 10, 5); // *** Set the session cookie so we know what the passcode is *** $_SESSION["passy"] = $passy; } @mysql_close(); ?>Note if you get any error installing captcha leave me a pm hav fun n say gud bye to autobotz ....thanx*
thanks u :(🙁
bijaybd wrote: is there any code to stop auto bot registration like someone is using my registration page from other site coded . like he is just typing the id in his page and its auto registering ids like 1 2 3 4 5 autometically so is there any code or .httacccess to stop this and the registration will only allowed from my site registration page ???
CAPTCHA is one way of doing it but I use the following method.
$browser = $_SERVER['HTTP_USER_AGENT']; $ip = $_SERVER['REMOTE_ADDR']; $now = time(NULL);
$browser = strtolower($browser); $invalid = array("the browsers that you do not want to be able to register");
$array_size = count($invalid); $browser_valid = "no";
for ($i = 0; $i <= $array_size - 1; $i++) { $mystring = $browser; $findme = $invalid[$i]; $pos = strpos($mystring, $findme);
if ($pos === false) { $browser_valid = "yes";} else $browser_valid = "no"; } if ($browser_valid == "no") header("location:invalid_browser.php");
having a great problem again i set up no registeration with same browser even separeted for ip and browser but they have changed both of them for example browser shows like brower1 in 2nd registration time browser2 browser3 i have capcha but still its not working and they are registratering more then 100 ids with in a second by some application or some system i guess so any one could help ???