Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's
Author Message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Mon Oct 06, 2003 6:29 am Reply with quote

In modules/Your_Account/index.php find this right near the top
Code:
 

function userCheck($username, $user_email) {
    global $stop, $user_prefix, $db;
and add these lines after the 'global' statement
Code:
if (ereg("@hotmail\.com",$user_email)) $stop = "<center>"."Hotmail addresses are not allowed"."</center><br>";    

elseif (ereg("@yahoo\.com",$user_email)) $stop = "<center>"."Yahoo addresses are not allowed"."</center><br>";
You could/should put the error message in the language file, but that's your call. You could combine that all into 1 statement, but this way you might want to have separate messages.
 
View user's profile Send private message
porcupinepc
Involved
Involved



Joined: Sep 20, 2003
Posts: 261
Location: Schumacher, Ontario CANADA

PostPosted: Mon Oct 06, 2003 7:19 am Reply with quote

so between the global and the $stop we insert the replacement code?

Thanks

Joe
 
View user's profile Send private message Send e-mail Visit poster's website ICQ Number
Raven







PostPosted: Mon Oct 06, 2003 7:23 am Reply with quote

No.
Raven wrote:
and add these lines after the 'global' statement
means after the entire statement, i.e. after the ; as in global $stop, $user_prefix, $db;
 
porcupinepc







PostPosted: Mon Oct 06, 2003 7:24 am Reply with quote

Ok. Thanks

Joe
 
Muffin
Client



Joined: Apr 10, 2004
Posts: 649
Location: UK

PostPosted: Mon Aug 09, 2004 5:16 am Reply with quote

Would this affect anyone who has previously registered with either a Hotmail or Yahoo email address Raven? Like stopping them accessing the site?

_________________
Classic Mini rules the bends & bends the rules!
[img] 
View user's profile Send private message
Raven







PostPosted: Mon Aug 09, 2004 7:05 am Reply with quote

I don't believe so. If I remember right that function is only called when a new account is created.
 
Muffin







PostPosted: Mon Aug 09, 2004 9:48 am Reply with quote

oh thanks Raven, I'll have a go at this one then (dont cringe this one might work for me lol )
 
SmackDaddy
Involved
Involved



Joined: Jun 02, 2004
Posts: 268
Location: Englewood, OH

PostPosted: Thu Aug 26, 2004 12:30 am Reply with quote

I guess the assumption is that anyone online has an ISP of some sort unless they use a public place to access the internet (like school, or the public library, etc.....)

Would we be able to expand the statement "are not allowed" to also include a statement giving a reason as to WHY we don't want Yahoo, GMail, or Hotmail email addresses used to register at our sites? That could be helpful in explaining the reason instead of just saying "are not allowed." Or is there a max length we have to consider?

_________________
Smack out...
[ Only registered users can see links on this board! Get registered or login! ]

Image 
View user's profile Send private message Send e-mail Visit poster's website
64bitguy
The Mouse Is Extension Of Arm



Joined: Mar 06, 2004
Posts: 1164

PostPosted: Thu Aug 26, 2004 2:17 am Reply with quote

I've actually expanded on this a tad by including some of the major abuser addresses that have come to my attention.

Mine looks like this:
Code:
function userCheck($username, $user_email) {

    global $stop, $user_prefix, $db;
    if (ereg("@hotmail\.com",$user_email)) $stop = "<center>"._ERRORNOHOTMAIL."</center>";   
    elseif (ereg("@yahoo\.com",$user_email)) $stop = "<center>"._ERRORNOYAHOO."</center>";
    elseif (ereg("@gmail\.com",$user_email)) $stop = "<center>"._ERRORNOFREEMAIL."</center>";
    elseif (ereg("@fastmail\.fm",$user_email)) $stop = "<center>"._ERRORNOFREEMAIL."</center>";
    elseif (ereg("@freemail\.org.mk",$user_email)) $stop = "<center>"._ERRORNOFREEMAIL."</center>";
    if ((!$user_email) || ($user_email=="") || (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,6}$",$user_email))) $stop = "<center>"._ERRORINVEMAIL."</center><br>";
    if (strrpos($user_email,' ') > 0) $stop = "<center>"._ERROREMAILSPACES."</center>";
    if ((!$username) || ($username=="") || (ereg("[^a-zA-Z0-9_-]",$username))) $stop = "<center>"._ERRORINVNICK."</center><br>";
    if (strlen($username) > 25) $stop = "<center>"._NICK2LONG."</center>";
    if (eregi("^((root)|(adm)|(linux)|(webmaster)|(admin)|(god)|(administrator)|(administrador)|(nobody)|(anonymous)|(anonimo)|(anĂ³nimo)|(operator))$",$username)) $stop = "<center>"._NAMERESERVED."</center>";
    if (strrpos($username,' ') > 0) $stop = "<center>"._NICKNOSPACES."</center>";


In my language file, I have this:
Code:
define("_ERRORINVEMAIL","ERROR: Invalid Email Address");

define("_ERRORNOYAHOO","ERROR: Yahoo Email Addresses Are Not Allowed! - You may only register using a Valid ISP provided Email Address!");
define("_ERRORNOHOTMAIL","ERROR: Hotmail Email Addresses Are Not Allowed! - You may only register using a Valid ISP provided Email Address!");
define("_ERRORNOFREEMAIL","ERROR: Non-ISP Hosted Email Addresses Are Not Allowed! - You may only register using a Valid ISP provided Email Address!");

_________________
Steph Benoit
100% Section 508 and W3C HTML5 and CSS Compliant (Truly) Code, because I love compliance. 
View user's profile Send private message
kguske
Site Admin



Joined: Jun 04, 2004
Posts: 6432

PostPosted: Thu Aug 26, 2004 7:43 am Reply with quote

I posted this on another site, but would rather repost it here than link there..

Here's a solution that let's you use the phpBB forum banlist table to prevent registration via the phpNuke Your_Account module!

The code is actually in the /includes/functions_validate.php file in a function called validate_email, but because it uses some stuff in the Forums module and the goal here is to use the ban list / banlist to prevent registration using phpNuke registration (i.e. the Your_Account module), it was easier to duplicate the code than make it fully modular (I wanted to implement this FAST). Here's how:

In your /modules/Your_Account/index.php, insert the following near the top, just before:

Code:
function userCheck($username, $user_email) {


Insert:
Code:
function validate_email($email)

{
    global $user_prefix, $db, $lang;
   if ($email != '')
   {
      if (preg_match('/^[a-z0-9\.\-_\+]+@[a-z0-9\-_]+\.([a-z0-9\-_]+\.)*?[a-z]+$/is', $email))
      {
         $sql = "SELECT ban_email
            FROM ".$user_prefix."_bbbanlist";
         if ($result = $db->sql_query($sql))
         {
            if ($row = $db->sql_fetchrow($result))
            {
               do
               {
                  $match_email = str_replace('*', '.*?', $row['ban_email']);
                  if (preg_match('/^' . $match_email . '$/is', $email))
                  {
                     $db->sql_freeresult($result);
                     return array('error' => true, 'error_msg' => $lang['Email_banned']);
                  }
               }
               while($row = $db->sql_fetchrow($result));
            }
         }
         $db->sql_freeresult($result);
         return array('error' => false, 'error_msg' => '');
      }
   }
   return array('error' => true, 'error_msg' => $lang['Email_invalid']);
}


Next, in function userCheck (also in /modules/Your_Account/index.php), just after:
Code:
    if (strrpos($user_email,' ') > 0) $stop = "<center>"._ERROREMAILSPACES."</center>";


Insert:
Code:
    $result = validate_email($user_email);

   if ( $result['error'] ) $stop = "<center>"._ERROREMAILBANNED."</center><br>";



Finally, in the /modules/Your_Account/language/language-English.php (or appropriate), just after:
Code:
define("_ERRORINVEMAIL","ERROR: Invalid Email");


Insert:
Code:
define("_ERROREMAILBANNED","ERROR: Banned Email Address");

You can make the error message say whatever you like, of course.
 
View user's profile Send private message
Raven







PostPosted: Thu Aug 26, 2004 9:13 am Reply with quote

This is really good stuff! Thanks for sharing this. Discussion item --> [ Only registered users can see links on this board! Get registered or login! ]
 
jonmcc33
Hangin' Around



Joined: May 17, 2004
Posts: 40
Location: Dayton, OH

PostPosted: Sat Jan 29, 2005 11:39 pm Reply with quote

Raven, at that thread the guy mentioned having hundreds of free e0mail service domains and wanting to make money off of it. There are actually thousands and they can be found in a lot of places on Google.

I've added Netscape, Mail.com, and eXcite to my list. Is there any quicker way of doing this?
 
View user's profile Send private message Visit poster's website AIM Address ICQ Number
64bitguy







PostPosted: Sun Jan 30, 2005 1:02 am Reply with quote

Yeah, the guy (I guess that would be me) has a list of 1231 banned domains, and yes, I had to type them all in by hand.... lol

Hence the reason why I'm selling the list (well, giving it away to subscribers that is). One quick import sure beats the heck out of looking them all up and typing them all in by hand.

Smile
 
jonmcc33







PostPosted: Sun Jan 30, 2005 1:47 am Reply with quote

Hmmm, how much does that cost?

I have a list of 30,000 total domains if you want it.
 
64bitguy







PostPosted: Sun Jan 30, 2005 1:57 am Reply with quote

I don't think I'd trust a list with 30,000 domains on it. That sounds like someone's blacklist, whereas mine is simply freemail providers. I'd also be concerned about performance impacts from having to check a table with 30,000 entries in it, but that's just me.
 
jonmcc33







PostPosted: Sun Jan 30, 2005 11:38 am Reply with quote

That list includes free e-mail from other countries. I've taken a look a few random and they are free e-mail.

I took a look at your site. It costs $20 at minimum to subscribe. Why do you charge a government employee $120?
 
64bitguy







PostPosted: Sun Jan 30, 2005 12:05 pm Reply with quote

Quote:
That list includes free e-mail from other countries. I've taken a look a few random and they are free e-mail.


Ah, a Blacklist. My list also includes free email from other countries. In fact most of it is providers from other countries, but 30,000? Have fun checking them all.

As for my site, I maintain special sites, sections and content for Government Users and Government Contractors. It's only $50.00 for a Government employee to join and have access to that content. It's $120.00 for their branch to register first (which would be the first employee of that Branch of Government). The reason for that is each Branch gets dedicated forums, links, downloads, sub-domain controls and target content for their branch while still having cross-Government and Contractor support tools (which is what the $50.00 is for).

Hope that answers you questions.
 
jonmcc33







PostPosted: Sun Jan 30, 2005 2:41 pm Reply with quote

Ah, thanks.
 
Mesum
Useless



Joined: Aug 23, 2002
Posts: 213
Location: Chicago

PostPosted: Sun Mar 06, 2005 2:28 am Reply with quote

Hello guys. Do you think there is a way to block ALL extentions but let .edu e-mail addresses to register?

_________________
Only FREE Dating Site for Desis 
View user's profile Send private message Visit poster's website
Mesum







PostPosted: Sun Mar 06, 2005 2:44 am Reply with quote

Nevermind, found a way around to it and it's called CNB YA Very Happy
 
Serafim
Worker
Worker



Joined: Mar 25, 2006
Posts: 109
Location: Delaware Usa

PostPosted: Wed Mar 29, 2006 6:44 pm Reply with quote

How would I use this to exclude gmail accounts..

_________________
Image 
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
kguske







PostPosted: Mon May 29, 2006 7:58 am Reply with quote

That depends on which approach you take, Serafim. If you use the approach I suggested, you can simply add *@gmail.com to your ban list in the forums administration.
 
kguske







PostPosted: Mon May 29, 2006 8:03 am Reply with quote

Also, CNB-YA provides the ability to block domains from registering.
 
Serafim







PostPosted: Mon May 29, 2006 8:39 am Reply with quote

Im using approve membership so maybe i should check over at thier site..
 
manunkind
Client



Joined: Apr 26, 2004
Posts: 368
Location: Albuquerque, NM

PostPosted: Mon May 29, 2006 6:29 pm Reply with quote

Stupid question but why would somebody actually want to do this? We have thread after thread on ways to increase traffic to our sites, and then we do one thing like this that blocks 20% of the world. Smile
 
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©