DennisTT Wrote:Just logout of your forum, and click "Register" and then click "I agree". You can base your registration form with that HTML.
The following code does work for me. Can be used on any page outside myBB on your own sites. Note: I have tested it only twice, so don't know about longtime issues - haven't tested it with duplicate loginnames aso. Please change the paths and DB-Class to your own.
First, create Captcha-Image-Settings (note: function random_str() can also be included from mybb/in/functions.php)
function random_str($length="8")
{
$set = array("a","A","b","B","c","C","d","D","e","E","f","F","g","G","h","H","i","I","j","J","k","K","l","L","m","M","n","N","o","O","p","P","q","Q","r","R","s","S","t","T","u","U","v","V","w","W","x","X","y","Y","z","Z","1","2","3","4","5","6","7","8","9");
$str;
for($i = 1; $i <= $length; $i++)
{
$ch = rand(0, count($set)-1);
$str .= $set[$ch];
}
return $str;
}
$randomstr = random_str(5);
$imagehash = md5($randomstr);
$imagestring = $randomstr;
$db->query("insert into mybb_captcha values('$imagehash','$imagestring','".time()."')");
Then, add your form. These fields are required:
<form id="register" action="/forum/member.php" method="post">
<input type="text"" name="username" value="" />
<input type="password"" name="password" />
<input type="password"" name="password2" />
<input type="text"" name="email" value="" />
<input type="text"" name="email2" value="" />
<input type="hidden" name="referrername" value="" />
<img src="forum/captcha.php?action=regimage&imagehash=<?=$imagehash?>" />
<input type="text" name="imagestring" />
<input type="hidden" name="imagehash" value="<?=$imagehash?>" />
<input type="hidden" name="allownotices" value="yes" />
<input type="hidden" name="hideemail" value="" />
<input type="hidden" name="emailnotify" value="" />
<input type="hidden" name="receivepms" value="yes" />
<input type="hidden" name="pmpopup" value="yes" />
<input type="hidden" name="emailpmnotify" value="" />
<input type="hidden" name="invisible" value="" />
<input type="hidden" name="timezoneoffset" value="+1" />
<input type="hidden" name="enabledst" value="" />
<input type="hidden" name="language" value="" />
<input type="hidden" name="action" value="do_register" />
<input type="hidden" name="timezoneoffset" value="+1" />
<input type="hidden" name="timezoneoffset" value="+1" />
<input type="submit" value="submit" />
</form>
That's it. Finetuning needs to be done of course ;-)