##
##
## Mod title: Unique Registration hash
##
## Mod version: 1.0
## Works on PunBB: 1.2.15 (Should work on all versions)
## Release date:
## Author: Frank Smit (FSX) FSX.NR01@gmail.com, Special - http://www.animeresource.org/
##
## Description: This mod will make the registration url be unique with each visitor,
## robots always use a static url to acces the register page to start spamming
## this will prevent them even finding the page.
##
## Affects DB: No
##
## Affected files: register.php
## login.php
## include/functions.php
##
## DISCLAIMER: Please note that 'mods' are not officially supported by
## PunBB. Installation of this modification is done at your
## own risk. Backup your forum database and any and all
## applicable files before proceeding.
##
#
#---------[ 1. OPEN ]---------------------------------------------------
#
include/function.php
#
#---------[ 2. FIND LINE 259 ]---------------------------------------------------
#
else if ($cur_user['idle'] == '0')
$db->query('UPDATE '.$db->prefix.'online SET idle=1 WHERE user_id='.$cur_user['user_id']) or error('Unable to insert into online list', __FILE__, __LINE__, $db->error());
}
}
}
#
#---------[ 3. AFTER, ADD ]---------------------------------------------------
#
//
// Generate hash
//
function generate_hash() {
$rhash = md5($_SERVER['REMOTE_ADDR']);
return $rhash;
}
#
#---------[ 4. FIND LINE 292 ]---------------------------------------------------
#
$links[] = '<li id="navregister"><a href="register.php">'.$lang_common['Register'].'</a>';
#
#---------[ 5. REPLACE WITH ]---------------------------------------------------
#
$links[] = '<li id="navregister"><a href="register.php?h='.generate_hash().'">'.$lang_common['Register'].'</a>';
#
#---------[ 6. OPEN ]---------------------------------------------------
#
register.php
#
#---------[ 7. FIND LINE 262 ]---------------------------------------------------
#
require PUN_ROOT.'header.php';
#
#---------[ 8. AFTER, ADD ]---------------------------------------------------
#
if ($_GET['h'] == generate_hash()) {
#
#---------[ 9. FIND LINE 434 ]---------------------------------------------------
#
require PUN_ROOT.'footer.php';
#
#---------[ 10. BEFORE, ADD ]---------------------------------------------------
#
}
#
#---------[ 11. OPEN ]---------------------------------------------------
#
login.php
#
#---------[ 12. FIND LINE 215 ]---------------------------------------------------
#
<p><a href="register.php" tabindex="4"><?php echo $lang_login['Not registered'] ?></a>
#
#---------[ 13. REPLACE WITH ]---------------------------------------------------
#
<p><a href="register.php?h=<? echo generate_hash(); ?>" tabindex="4"><?php echo $lang_login['Not registered'] ?></a>
#
#---------[ 14. SAVE/UPLOAD ]---------------------------------------------------
#