[TYPO3-english] Frontend user login self registration depending on IP address

Sander van Gelderen mail at sandervangelderen.nl
Tue Oct 21 13:51:21 CEST 2008


Hi Callum,

It's an interesting requirement.
I think it's not too difficult to do:

1) Make the page that contains the self-register plugin hidden in menu

2) Use typoscript with the proper condition to create a link to that 
page, if the user is in the right ip range, he will be able to navigate 
to the register page

3) Typoscript has a condition "IP" you can use: 
http://typo3.org/documentation/document-library/references/doc_core_tsref/4.1.0/view/4/1/#id3959636

4) If the range is not contiguous, it may be hard to define with only 
'*' as wildcard, you can make your own condition then like this: 
http://typo3.org/documentation/document-library/references/doc_core_tsref/4.1.0/view/4/1/#id3973427

5) Your userFunc could use this code to find if someone is in a certain 
range:

===================== php begin ==============================
// Expects $base_ip and $ip to be in dotted format
function in_network( $base_ip, $bits, $ip) {
	$base_ip = ip2long( $base_ip );
	$test1 = $base_ip >> ( 32 - $bits );
	$ip = ip2long($ip);
	$test2 = $ip >> (32 - $bits );
	return $test1 == $test2;
}
===================== php end ==============================

HTH,

Sander


Callum MacEwan schreef:
> Hi All
> 
> My client wants his web site to let people from certain ip ranges to 
> self register and others to be added by an admin is there a plugin for 
> that?
> 
> Cheers
> 
> Callum
> 


More information about the TYPO3-english mailing list