Flux CP > block [email protected] From the register on the site

Sidra Harris

New member
Messages
20
Points
0
Age
27
Location
United Arab Emirates
Github
DianaHarris2
Emulator
Flux CP > how to block " [email protected] - [email protected] " From the register on the site " if he tryed to add this E-mail the Fluxcp not accept it ?

any one can help me ? 

thanks 
default_wub.png
 
default_wub.png


 
after a little research i found a way to do this (this is not the best way to do it but it works)

first open ../lib/Flux/LoginServer.php

search for 

elseif (!preg_match('/^(.+?)@(.+?)$/', $email)) {
throw new Flux_RegisterError('Invalid e-mail address', Flux_RegisterError::INVALID_EMAIL_ADDRESS);
}

add this after it 

elseif (eregi('^[a-zA-Z0-9._-]+@[mailionator]+\.[a-zA-Z.]{2,5}$', $email)) {
throw new Flux_RegisterError('Invalid e-mail address', Flux_RegisterError::INVALID_EMAIL_ADDRESS);
}

then open the files:

../modules/account/changemail.php

../modules/account/resend.php

../modules/account/resetpass.php

search for

elseif (!preg_match('/^(.+?)@(.+?)$/', $email)) {
$errorMessage = Flux::message('EmailInvalid');
}

add after it 

elseif (eregi('^[a-zA-Z0-9._-]+@[mailionator]+\.[a-zA-Z.]{2,5}$', $email)) {
$errorMessage = Flux::message('InvalidEmailAddress');
}

this will block registration/email changing/resetting password/resending verification email to all email with domain *@mailionator.* you can add hotmail too by ading it to the elseif.

 
Last edited by a moderator:
just add more like this 

Code:
elseif (eregi('^[a-zA-Z0-9._-]+@[mailionator]+\.[a-zA-Z.]{2,5}$', $email)
		 || eregi('^[a-zA-Z0-9._-]+@[gmail]+\.[a-zA-Z.]{2,5}$', $email)
		 || eregi('^[a-zA-Z0-9._-]+@[hotmail]+\.[a-zA-Z.]{2,5}$', $email)) {
 
You really shouldn't use eregi, the ereg-extension has already been thrown out of PHP by default and it contains many problems, including security-related ones.
 
 
Stick to preg and use proper PHP validation, go for something like
 

if (!filter_var($email, FILTER_VALIDATE_EMAIL) || preg_match('/@(mailinator|hotmail|trashmail)\..+$/i', $email))
throw new Flux_RegisterError('Invalid e-mail address', Flux_RegisterError::INVALID_EMAIL_ADDRESS);

For more information visit the PHP documentation on ereg and on filter_var. Keep your servers safe, folks.

 
as i told you it's not the best way
default_biggrin.png
(background in php 0) just thought if i start it may some one come and give a better solution ^^

 
Back
Top