Beginner Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOtherBeginner Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
  #1  
Old February 13th, 2002, 02:55 PM
homerdooh homerdooh is offline
php newbie
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2001
Posts: 512 homerdooh User rank is Corporal (100 - 500 Reputation Level)homerdooh User rank is Corporal (100 - 500 Reputation Level)homerdooh User rank is Corporal (100 - 500 Reputation Level)homerdooh User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 3 Days 5 h 15 m 59 sec
Reputation Power: 11
Special Characters

Hello,

This is a PHP question. I have a html page that people use to input their email addresses to a php page (then into a database).
To make sure i dont get any email address that are not valid or if someone types in some other characters by mistake my script will pick the faults.

For example, it will allow characters such as '-', '_', '@' but wont allow characters such as '?', '.' and '.'

Can anyone point me in the right direction please?

Thanks.
__________________
"They have the internet on computers now" - Homer

Reply With Quote
  #2  
Old February 13th, 2002, 03:27 PM
jonsagara's Avatar
jonsagara jonsagara is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Location: USA
Posts: 286 jonsagara User rank is Private First Class (20 - 50 Reputation Level)jonsagara User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 7 m 23 sec
Reputation Power: 7
Search these forums for an email validation script. This question is probably better asked in the PHP forum, too.
__________________
Jon Sagara

"Me fail English? That's unpossible!"

Reply With Quote
  #3  
Old February 13th, 2002, 04:35 PM
lux lux is offline
Senior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 42 lux User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
have a read through 'regular expressions' in the manual

Reply With Quote
  #4  
Old February 13th, 2002, 06:28 PM
homerdooh homerdooh is offline
php newbie
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2001
Posts: 512 homerdooh User rank is Corporal (100 - 500 Reputation Level)homerdooh User rank is Corporal (100 - 500 Reputation Level)homerdooh User rank is Corporal (100 - 500 Reputation Level)homerdooh User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 3 Days 5 h 15 m 59 sec
Reputation Power: 11
Thank Jon I've search for it in the forums, i didnt know what it was called.

As for putting it in the PHP forum, they would be all snooty at me for asking a simple question like that! They dont realise some of us are not as clever or well educated as they are!

And lux, is there a manual? where?

Thanks again.

Reply With Quote
  #5  
Old February 13th, 2002, 06:32 PM
lux lux is offline
Senior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 42 lux User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0

Reply With Quote
  #6  
Old February 14th, 2002, 08:32 AM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,834 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 23 h 30 m 30 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
Here is a link that covers a regexp about email validation.
http://forums.devshed.com/showthrea...highlight=email
Also, I would not disallow the period. One of my addresses have a period in them.
A lot of company email addresses are firstname.lastname@company.com
You would exclude people like this if you blocked this character.
[quote] As for putting it in the PHP forum, they would be all snooty at me for asking a simple question like that! They dont realise some of us are not as clever or well educated as they are! [/quote[
I wouldn't call it being snooty for asking a simple question. What gets a harsh response from most people on this forum is the person showing a lack of preperation or willingness to try and answer his/her own question. In a case like this, simply searching the forum for email, email validation or email update would have returned the appropriate threads for you to search.
It would be highly recommended also that you download and read the php manual from www.php.net. That is one of the best manuals that I have seen written and it is fairly informative about the language.

Reply With Quote
  #7  
Old February 14th, 2002, 09:10 AM
homerdooh homerdooh is offline
php newbie
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2001
Posts: 512 homerdooh User rank is Corporal (100 - 500 Reputation Level)homerdooh User rank is Corporal (100 - 500 Reputation Level)homerdooh User rank is Corporal (100 - 500 Reputation Level)homerdooh User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 3 Days 5 h 15 m 59 sec
Reputation Power: 11
Thanks onslaught! I usually search the threads before i post things, i just didnt know this was called email validation. I was searching for special characters instead

You see i have no language experience whatsoever, no C, java or anything. So for me its like starting from scratch. And i have to say this forum has helped me out alot, i'm not knocking it. Its just that sometimes people expect you to know it all.

Reply With Quote
  #8  
Old February 14th, 2002, 11:47 AM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,834 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 23 h 30 m 30 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
I really don't think that the people here expect you to know it all (if you did, you would ask questions ), but I do believe that most of the people here don't want to spoon feed someone. That has a tendancy of wearing on a persons patience just a little.
I will agree that sometimes, the people here don't have the best bed-side manner (me included). But on most forums here has a sticky thread posted at the top of each one giving some idea of the general guidelines of the forum. This helps in two ways, 1) it gives you a general set of boundaries to try to stay within to get help from someone and 2) it can help you help yourself solve many problems on your own. Everyone was new to programming at one time or another, and usually patience will be given to those who are new as long as they show some attempt to solve the problem they are having. The two sticky threads at the top of the php forum really states this better than I can, or you can check out the link in my signature (how to ask) which is pretty informative.
For the most part, it all boils down to we all have to start somewhere, we gain knowledge through experience, we gain experience through doing. If we do it all for someone, what have they learned?

Reply With Quote
  #9  
Old February 18th, 2002, 06:46 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> As for putting it in the PHP forum, they would be all snooty at me for asking a simple question like that!

There is no such thing as simple question in Devshed forums. You will never get flamed for asking simple questions (if you search first). But you will definitely get flamed by me if you post message to the wrong forum.

This Beginners forum imples to beginner questions only - Where to start and somewhat a catch-all forum.
Your topic is clearly a PHP question. With database and special chars involved, that's clearly not a beginner question. Likewise, PHP forum is not a catch-all forum so don't post non-PHP related questions there.
Next time you post a question, first start here -> http://forums.devshed.com/showthrea...24097&forumid=5

Reply With Quote
  #10  
Old February 19th, 2002, 01:12 AM
Datamike's Avatar
Datamike Datamike is offline
Web Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Oct 2001
Location: Finland
Posts: 719 Datamike User rank is Corporal (100 - 500 Reputation Level)Datamike User rank is Corporal (100 - 500 Reputation Level)Datamike User rank is Corporal (100 - 500 Reputation Level)Datamike User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 11 h 27 m 33 sec
Reputation Power: 9
A good place to start is to either buy a good book or to grab some free tutorials which the web is full of. I personally find it easier to start a new language with books, and my first PHP book was PHP Fast & Easy Web Development, by Julie Meloni. It's a good book to start with. For tutorials, you can start from PHPbuilder and Zend. The best source of information, yet, is the official PHP manual (like stated before).
__________________
-- Tomi Kaistila
-- Developer's Journal

The more you learn, the more you know.
The more you know, the more you forget.
The more you forget, the less you know.

Reply With Quote
  #11  
Old March 5th, 2002, 05:57 PM
christo's Avatar
christo christo is offline
Introspective
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Nov 2001
Location: London, UK
Posts: 3,296 christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 3 Days 1 h 5 m 42 sec
Reputation Power: 101
Send a message via ICQ to christo Send a message via Yahoo to christo
some snippets

Here are some snippets to get you started: It's dead basic, but a starting point. You could also write some client-side validation in javascript. (js uses PERL regular expressions, so it would be pretty much the same)..

this test will check that the email field on your form is set. If it isn't, you can add code to tell the user to enter one

if((!isset ($email))||$email==""){
echo "<b>too bad - no email</b>";

and then this test will look for some something that looks like an email address - id, something followed by an @ followed by something followed by a dot, followed by something

}elseif(!ereg("^.+@.+\..+$", $email)){
echo "<b>try that again!<b>";

and this test will check for illegal characters... ][<>,;:\/"

}elseif(ereg("[][(),;:\"\/]", $email)){
echo "<b>invalid chars in address<b>";
}else{
//get on with the email bit
}

hope that's a start for you,
Christo

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherBeginner Programming > Special Characters


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |