PHP Web Host - Quality Web Hosting For All PHP Applications Sign up for PayPal and start accepting credit card payments instantly
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 15037
Location: Kansas

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

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 Visit poster's website AIM Address Yahoo Messenger
porcupinepc
Involved
Involved


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

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

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
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 15037
Location: Kansas

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

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;
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
porcupinepc
Involved
Involved


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

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

Ok. Thanks

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


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

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

Would this affect anyone who has previously registered with either a Hotmail or Yahoo email address Raven? Like stopping them accessing the site?
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 15037
Location: Kansas

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

I don't believe so. If I remember right that function is only called when a new account is created.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Muffin
Client


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

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

oh thanks Raven, I'll have a go at this one then (dont cringe this one might work for me lol )
View user's profile Send private message
SmackDaddy
Involved
Involved


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

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

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?
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: 1140
Location: Manchester, NH USA

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

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!");
View user's profile Send private message Visit poster's website
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 4678

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

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
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 15037
Location: Kansas

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

This is really good stuff! Thanks for sharing this. Discussion item -->
Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
jonmcc33
Hangin' Around


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

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

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
The Mouse Is Extension Of Arm


Joined: Mar 06, 2004
Posts: 1140
Location: Manchester, NH USA

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

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
View user's profile Send private message Visit poster's website
jonmcc33
Hangin' Around


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

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

Hmmm, how much does that cost?

I have a list of 30,000 total domains if you want it.
View user's profile Send private message Visit poster's website AIM Address ICQ Number
64bitguy
The Mouse Is Extension Of Arm


Joined: Mar 06, 2004
Posts: 1140
Location: Manchester, NH USA

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

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.
View user's profile Send private message Visit poster's website
jonmcc33
Hangin' Around


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

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

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?
View user's profile Send private message Visit poster's website AIM Address ICQ Number
64bitguy
The Mouse Is Extension Of Arm


Joined: Mar 06, 2004
Posts: 1140
Location: Manchester, NH USA

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

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.
View user's profile Send private message Visit poster's website
jonmcc33
Hangin' Around


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

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

Ah, thanks.
View user's profile Send private message Visit poster's website AIM Address ICQ Number
Mesum
Useless


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

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

Hello guys. Do you think there is a way to block ALL extentions but let .edu e-mail addresses to register?
View user's profile Send private message Visit poster's website
Mesum
Useless


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

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

Nevermind, found a way around to it and it's called CNB YA Very Happy
View user's profile Send private message Visit poster's website
Serafim
Worker
Worker


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

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

How would I use this to exclude gmail accounts..
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 4678

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

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.
View user's profile Send private message
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 4678

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

Also, CNB-YA provides the ability to block domains from registering.
View user's profile Send private message
Serafim
Worker
Worker


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

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

Im using approve membership so maybe i should check over at thier site..
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
manunkind
Client


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

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

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