Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 How to allow only certain domain in email address?
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

zbenggg
Junior Member

Israel
227 Posts

Posted - 22 November 2002 :  06:05:36  Show Profile
I am using Snitz on the internet and would like to ONLY allow people who use one of our company domain names in their email address to register. All other email addresses should result in an error message.

Please...


I love Israel

Edited by - zbenggg on 22 November 2002 06:17:38

HuwR
Forum Admin

United Kingdom
20579 Posts

Posted - 22 November 2002 :  06:58:40  Show Profile  Visit HuwR's Homepage
take a look in inc_func_common.asp, and look for this function


function EmailField(fTestString) 
	TheAt = Instr(2, fTestString, "@")
	if TheAt = 0 then 
		EmailField = 0
	else
		TheDot = Instr(cLng(TheAt) + 2, fTestString, ".")
		if TheDot = 0 then
			EmailField = 0
		else
			if cLng(TheDot) + 1 > Len(fTestString) then
				EmailField = 0
			else
				EmailField = -1
			end if
		end if
	end if
end function 


Now, change this line

TheAt = Instr(2, fTestString, "@") to

TheAt = Instr(2, fTestString, "@YOURDOMAIN")

that will invalidate the email address if it is not from YOURDOMAIN
Go to Top of Page

zbenggg
Junior Member

Israel
227 Posts

Posted - 22 November 2002 :  08:15:30  Show Profile
Bad
here the file:
http://www.hunggarkungfu.com/dcforum/User_files/3dde2d8b708c18e2.zip
Please will repair me

I love Israel
Go to Top of Page

DoraMoon
Average Member

Taiwan
661 Posts

Posted - 22 November 2002 :  08:40:54  Show Profile
i think function EmailField() exist in inc_func_member.asp this file.
just as HuwR's suggestion, please try it again....
Go to Top of Page

zbenggg
Junior Member

Israel
227 Posts

Posted - 22 November 2002 :  09:00:56  Show Profile
Thank you very much,
And if I have 3 E-mail ?
It's possible to determine above one ?

I love Israel
Go to Top of Page

DoraMoon
Average Member

Taiwan
661 Posts

Posted - 22 November 2002 :  09:14:43  Show Profile
maybe try this...

TheAt = Instr(2, fTestString, "@YOURDOMAIN1") + Instr(2, fTestString, "@YOURDOMAIN2") + Instr(2, fTestString, "@YOURDOMAIN3")

not sure it'll work... but if your 3 domain are totally different...
i think it should be ok... had better test it before apply on your forum.
Go to Top of Page

zbenggg
Junior Member

Israel
227 Posts

Posted - 22 November 2002 :  09:23:53  Show Profile
Thank you very much !

I love Israel
Go to Top of Page

flux
Starting Member

46 Posts

Posted - 27 November 2002 :  00:31:37  Show Profile
what if i wanted to restrict an email domain?

------------
take my name out of admin PLEEEEZE!
Go to Top of Page

DoraMoon
Average Member

Taiwan
661 Posts

Posted - 29 November 2002 :  13:11:54  Show Profile
maybe try this....
function EmailField(fTestString) 
	TheAt = Instr(2, fTestString, "@")
	if TheAt = 0 then 
		EmailField = 0
	elseif Instr(2, fTestString, "@NoThisDomain") then
		EmailField = 0
	else
		TheDot = Instr(cLng(TheAt) + 2, fTestString, ".")
		:
		:
		:
end function


but this modified code only change the EmailField check function, you may also need some change to the Error Message in register.asp page to fit your custom modification.

Edited by - DoraMoon on 29 November 2002 13:13:27
Go to Top of Page

aviv
Junior Member

474 Posts

Posted - 05 December 2002 :  04:08:45  Show Profile  Visit aviv's Homepage
what is the file i need to edit in Snitz. ver 3.3?
Go to Top of Page

kcm
Starting Member

Canada
16 Posts

Posted - 05 December 2002 :  14:44:54  Show Profile
I have made a modification to the Registration form to prevent the use of various
email accounts, like AOL, HOTMAIL, YAHOO, etc...

If you are interested in this, please follow these steps:
(All cHANGES are in RED and Unchanged is normal black.)

1) Open \forum\Register.asp and find the following line(s):
Around line 279:

If strAutoLogon <> 1 then
if Request.Form("Email") = "" then
Err_Msg = Err_Msg & "<li>You Must give an e-mail address</li>"
end if

if Request.Form("Email") <> Request.Form("Email3") then
Err_Msg = Err_Msg & "<li>Your E-mail Addresses didn't match.</li>"
end if


if EmailField(Request.Form("Email")) = 0 then
Err_Msg = Err_Msg & "<li>You Must enter a valid e-mail address</li>"
end if
[/CODE]

2) Replace with the following lines:


dim intNOTVALID, strBADDOMAIN
intNOTVALID = EmailField(Request.Form("Email"))

If strAutoLogon <> 1 then
'### if Request.Form("Email") = "" then
'### Err_Msg = Err_Msg & "<li>You must provide a valid e-mail address.</li>"
'### end if

if Request.Form("Email") <> Request.Form("Email3") then
Err_Msg = Err_Msg & "<li>Your E-mail Addresses didn't match.</li>"
end if

if EmailField(Request.Form("Email")) = 0 then
Err_Msg = Err_Msg & "<li>You Must enter a valid e-mail address.</li>"
end if

'###### TECHSTUD MOD - DENY Various e-mail Domains #########################
if EmailField(Request.Form("Email")) >= 3 AND EmailField(Request.Form("Email")) <= 10 then
select case intNOTVALID
case 3
strBADDOMAIN = "AOL"
case 4
strBADDOMAIN = "HOTMAIL"
case 5
strBADDOMAIN = "YAHOO"
case 6
strBADDOMAIN = "BIGFOOT"
case 7
strBADDOMAIN = "MSN"
case 8
strBADDOMAIN = "SAMPLE-DOMAIN" 'You can change this to whatever
case 9
strBADDOMAIN = "MICROSOFT" 'You can change this to whatever
case 10
strBADDOMAIN = "NotThisDomain" 'You can change this to whatever
case else
strBADDOMAIN = "INVALID" 'DO NOT CHANGE THIS!
end select
Err_Msg = Err_Msg & "<li><B>" & strBADDOMAIN & "</B> e-mail addresses are not allowed here. <br>      Please enter a different e-mail address.</li>"
end if
'###### TECHSTUD MOD - DENY Various e-mail Domains #########################

end if
[/CODE]

3) Open \forum\Inc_Func_Member.asp and find the following lines:
Around Line 41

function EmailField(fTestString)
TheAt = Instr(2, fTestString, "@")
if TheAt = 0 then
EmailField = 0
else
TheDot = Instr(cLng(TheAt) + 2, fTestString, ".")
if TheDot = 0 then
EmailField = 0
else
if cLng(TheDot) + 1 > Len(fTestString) then
EmailField = 0
else
EmailField = -1
end if
end if
end if
end function
[/CODE]

4) Insert the following lines.


function EmailField(fTestString)
TheAt = Instr(2, fTestString, "@")
if TheAt = 0 then
EmailField = 0
'###### TECHSTUD MOD - DENY Various e-mail Domains #########################
elseif Instr(2, fTestString, "@aol") then
EmailField = 3
' ### The following lines are DISABLED. In order to enable the Domains you want
' ### to BLOCK users from using, just UNCOMMENT them.
' elseif Instr(2, fTestString, "@hotmail") then
' EmailField = 4
' elseif Instr(2, fTestString, "@yahoo") then
' EmailField = 5
' elseif Instr(2, fTestString, "@bigfoot") then
' EmailField = 6
' elseif Instr(2, fTestString, "@msn") then
' EmailField = 7
' ### If you wish to include more, please put them in after this line, and
' ### continue numbering them... Remember to make the same type of entries
' ### in the "REGISTER.ASP" file located in the root forum directory.
' elseif Instr(2, fTestString, "@Sample-Domain") then 'You can change this to whatever
' EmailField = 8
' elseif Instr(2, fTestString, "@Microsoft") then 'You can change this to whatever
' EmailField = 9
' elseif Instr(2, fTestString, "@NoThisDomain") then 'You can change this to whatever
' EmailField = 10
'###### TECHSTUD MOD - DENY Various e-mail Domains #########################

else
TheDot = Instr(cLng(TheAt) + 2, fTestString, ".")
if TheDot = 0 then
EmailField = 0
else
if cLng(TheDot) + 1 > Len(fTestString) then
EmailField = 0
else
EmailField = -1
end if
end if
end if
end function
[/CODE]

Go to Top of Page

aviv
Junior Member

474 Posts

Posted - 26 December 2002 :  17:43:53  Show Profile  Visit aviv's Homepage
Can some one tell me how do i do it on my Snitz 3.3.03?
Go to Top of Page

DoraMoon
Average Member

Taiwan
661 Posts

Posted - 27 December 2002 :  07:36:08  Show Profile
on v3.3.03, the function EmailField is in inc_functions.asp file.
and the others..... you can try kcm's mod code. i think it's almost the same between 3.4 and 3.3
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.32 seconds. Powered By: Snitz Forums 2000 Version 3.4.07