Author |
Topic  |
leatherlips
Senior Member
   
USA
1838 Posts |
|
phy1729
Average Member
  
USA
589 Posts |
|
AnonJr
Moderator
    
United States
5768 Posts |
Posted - 31 July 2008 : 23:54:33
|
I seem to remember there was a ChkEMail function (or something similar) in inc_func_common.asp. It would be a good place to start...< |
 |
|
Andy Humm
Average Member
  
United Kingdom
908 Posts |
Posted - 26 August 2008 : 10:41:23
|
AnonJr: I have had a look through inc_func_common and can not see an email validity check routine. Like you say, I am sure there is a routine, somewhere within the forum, to meet leatherlips requirement. Any further ideas please..< |
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
Posted - 26 August 2008 : 10:56:02
|
Posted sometime ago as a security fix replacement for an existing function in inc_func_member.asp:
function EmailField(fTestString)
set regEx = New RegExp
regEx.Global = true
regEx.IgnoreCase = true
regEx.Pattern = "^[A-Z0-9._%-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}$"
retVal = regEx.Test(fTestString)
set regEx = nothing
if Not retVal Then
EmailField = 0
Else
EmailField = 1
end if
end function
< |
Snitz 3.4 Readme | Like the support? Support Snitz too |
 |
|
Andy Humm
Average Member
  
United Kingdom
908 Posts |
Posted - 26 August 2008 : 12:09:17
|
thank u ruirib< |
 |
|
Andy Humm
Average Member
  
United Kingdom
908 Posts |
Posted - 26 August 2008 : 12:55:49
|
Is there an easy way to link this function Emailfield to my input field:
response.write " <input type=""text"" style=""background-color:#F5FBF1"" name=""frommail"" size=""50"">" & vbNewLine
I have added the function to my inc_func_common and can not see how to tie the functionality together with appropriate error message to be displayed - if a user inputs a wrong email string format
The code I have on the form preview is: frommail = trim(chkString(request.form("frommail"),"SQLString")) if frommail ="" then strError = strError & "Please enter your email address!<br>" 'checking for blank email field if (InStr(Request("tomail"), "@") = 0 or InStr(Request("frommail"), "@") = 0) then strError = strError & "Enter an e-mail address in the form username@domain.co.uk<br></font>"
But is a user puts an email in this format humbug@xmas the routine passes, (that is the code I have) Thank you andy
< |
 |
|
HuwR
Forum Admin
    
United Kingdom
20593 Posts |
Posted - 26 August 2008 : 13:39:11
|
The function should replace the existing EmailField function in inc_func_member.asp so you will also need to include inc_func_member.asp
you would then use it like so
if EmailField(frommail) = 1 then 'we passed so do stuff :) else 'we failed so error end if< |
 |
|
Andy Humm
Average Member
  
United Kingdom
908 Posts |
Posted - 26 August 2008 : 18:28:21
|
Thank u HuwR< |
 |
|
Andy Humm
Average Member
  
United Kingdom
908 Posts |
Posted - 26 August 2008 : 19:24:22
|
I currently do not have access to my forum files, but following Huwrs input, would this work:
if EmailField(frommail) = 0 then strError = strError & "Enter an e-mail address in the form username@domain.co.uk<br></font>" ... .. end if (later)
I have gone for the =0 as all the other error messages have a link underneath to return to input form.< |
 |
|
HuwR
Forum Admin
    
United Kingdom
20593 Posts |
Posted - 27 August 2008 : 01:50:10
|
yes, that should be fine.< |
 |
|
Andy Humm
Average Member
  
United Kingdom
908 Posts |
Posted - 27 August 2008 : 03:58:40
|
Huwr: Thank you, all works fine now.. next!< |
 |
|
Shaggy
Support Moderator
    
Ireland
6780 Posts |
Posted - 29 August 2008 : 06:43:57
|
Thanks, Rui; was looking for a RegEx address validator 
< |
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
Posted - 29 August 2008 : 06:56:16
|
quote: Originally posted by Shaggy
Thanks, Rui; was looking for a RegEx address validator 
No problem . This is not a complete solution, even if it should be fine for "normal" use.< |
Snitz 3.4 Readme | Like the support? Support Snitz too |
 |
|
Shaggy
Support Moderator
    
Ireland
6780 Posts |
Posted - 29 August 2008 : 06:59:16
|
Seems to be doing the trick for me so far What problems have you encountered with it?
< |
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
 |
|
HuwR
Forum Admin
    
United Kingdom
20593 Posts |
Posted - 29 August 2008 : 07:04:13
|
quote: Originally posted by Shaggy
Thanks, Rui; was looking for a RegEx address validator 
here is better one , the one posted above does not accept all the valid characters for an email address, the one below should.
\w+([!#$%*/?|^{}`~&'+-=_]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*< |
 |
|
Topic  |
|