Log in

View Full Version : Make Sense Out of Data from Form



btelecky
09-15-2007, 03:43 AM
Yes, I created this form, and I would like to know if it is possible to organize the data that is sent after clicking "submit."

I would like to eliminate the "ASCII" format letters out of the data that is returned...is that possible?? Or maybe it's not "ASCII" letters but it's a bunch of junk characters.... %&+ and some capital letters and numbers thrown in there too...

djr33
09-15-2007, 02:32 PM
Well, your question is a bit vague.

"ASCII" format characters... that's all of 'em. My guess would be that you are referring to extended character sets, like é, ™, ¿, etc. But then you mention capital letters and numbers. Do you want only lowercase letters, then?

You posted this in the HTML forum, but HTML isn't interpreting anything. That would be with PHP or another serverside language.

Using PHP, you can do this without too much trouble.

Check each character using a regular expression, like:
$string = ereg_replace('[!#$%&\'()*+,-./ :;?@\`{|}~^"]','',$string);

That will take out all of the characters listed. You could also do the opposite.

The terms white list and black list apply-- white the only allowed characters, and black being disallowed while all others are.

I'm not really sure why you are wanting to do this, and there could be a different type of solution in limiting spam in the first place (if this is spam), or limiting in the first place what can be submitted, with clearer directions, or something.

Can you post a link to your page and give some more info?

Twey
09-15-2007, 06:04 PM
"ASCII" format characters... that's all of 'em.No -- Unicode contains many, many more characters than ASCII.
$string = ereg_replace('[!#$%&\'()*+,-./ :;?@\`{|}~^"]','',$string);This is very slow and quite incomprehensive. Instead, split the string and use array_filter(). ctype_alnum() would be preferable, but it doesn't always exist so we may have to create it:


if(!function_exists('ctype_alnum')) {
$alphabet = array_map('chr', array_merge(range(0x61, 0x7a), range(0x41, 0x5a));
function ctype_alnum($tr) {
return is_numeric($tr) || in_array($tr, $alphabet);
}
}

function only_alphanumeric($tr) {
return implode('', array_filter(str_split($tr), 'ctype_alnum'))
}

$string = only_alphanumeric($tr);

btelecky
09-16-2007, 09:09 PM
Here is the link to the form:

http://www.bluriradio.com/send/

Also, I am aware that by submitting form data through HTML, it sends the POSTDATA file (.ptt). The client I am doing this page for cannot view this file, is there another file that I can to the email address? Would that be through some sever-side technology? ASP, or PHP?

btelecky
09-17-2007, 12:20 AM
Another issue that has come up is; that when clicking the "submit" button, IE returns a security error. I don't get these using Firefox, but not everybody is that smart... The error reads:

This form is being submitted using e-mail.
Submitting this form will reveal your email address to the recipient, and will send the form data without encrypting it for privacy

You may continue or cancel this submission

I understand that this problem may not be avoidable, but I thought I'd just see if anybody had a way to fix or get around this problem.

Twey
09-17-2007, 06:45 AM
Also, I am aware that by submitting form data through HTML, it sends the POSTDATA file (.ptt).This depends on the browser and email client.
The client I am doing this page for cannot view this fileIt's plain text, yes s/he can. However, mailto: forms are ugly and quite unreliable -- you'd be much better off with a proper server-side email script.
is there another file that I can to the email address? Would that be through some sever-side technology? ASP, or PHP?Why a file? Why not just send a normal email?
I understand that this problem may not be avoidable, but I thought I'd just see if anybody had a way to fix or get around this problem.It's a security feature. It shouldn't be avoidable.

btelecky
09-19-2007, 12:39 AM
However, mailto: forms are ugly and quite unreliable -- you'd be much better off with a proper server-side email script.

Do you have an example of an "server-side email script"?

thanks,
>b

Twey
09-19-2007, 12:57 AM
In which language(s)?