![]() |
do you find this secure ?
PHP Code:
|
What does all those x20, x5c and all that in the expression means?
|
You're doing too much. I think we've discussed this many times before. Just you wait until Salathe gets here! Hehe.
|
First, there's really no sense in writing elaborate regular expressions when no-one can read them, they'll be a nightmare to modify and there's not even a comment to suggest what it's meant to be doing.
Would you consider it 'insecure' if we could spam youremail@gmail.com with thousands of messages per second, with any content that we like? I only ask because there's nothing stopping repeated processing of the form with an address like no-reply@localhost. There's worse to come, see below. Also, the emails which can be 'valid' might not be actual, usable email addresses. For example, the no-reply@localhost above or even !@^ will get through that silly regex. Specifying an 'invalid' (ie, an address which has no user at the other end) address isn't too big a deal unless you want to send a message to no-body later on. Of course, then it might be a big deal to get 99% of your emails bounced back at you. Finally, and the biggie, it's very possible to misuse the posted code to send out spam messages with whatever content the abuser wants to as many addresses as they want: not just to your own address, but to anyone. So, is your script secure. In a word, no. Could it be made secure? Sure! Indeed the huge gaping chasm of a security hole can be closed very simply, you've just got to see it first. Can you see it? |
Hello thanks for the input, @wildhoney: to much ??..
and @Salathe: as always great teacher :) ps on the point of the regex i am still learning regex i got it from a friend when i made my register, so i use it in anything else as i think it works great and then the insecure parts, all i can see yeah the spam part can be fixed with a session id or a capatcha maybe, and then on the part of spamming others that i can not see, and maybe PHP Code:
<input type='text' name='leave_blank' id='leave_blank'> </div> that might not be secure that is the all i see, if you see anymore would be greatly appreciated :) and thank you for making me a better coder :) PS: also filter $_POST[] so we don't get any XSS attacks |
function is_valid_email($email)
{ $expr = '\w[\w+-]*(?:\.[\w+-]+)*@[a-z0-9-]+(?:\.[a-z0-9-])*\.[a-z]{2,4}'; return (preg_match('/^' . $expr . '$/i', $email)); } if(is_valid_email($email)) { better ? |
:::UPDATE:::
PHP Code:
still need to block out massive mail spam to me :P but i am still thinking on how to fix that would it be like this ? session id to the person by a ip ? like if for say person x has ip 123.123.12.4 do a session id for that or so ? solutions to this would be greatly appreciated ;) PS: at least now no one can do like this for example Quote:
|
omg lol guess what google is a great tool XD! hihi
i learned so much to day! PS: i am really waiting like a kid on Christmas day :P on what you have to say next Salathe :D Thank you in advance!! HUM: now when i press submit i get a blank page :S |
Quote:
The code could do with a tidy up (indenting!) and sometimes you're doing nearly the same thing but in different ways with different functions. P.S. What's going on with the is_valid_email function; the regular expression ends with …$i$/ when called in preg_match. I don't think that's what you wanted. |
fixed those, could you share what """That "big security flaw""""
is, as i have fixed those i did see :) Thank you for your help sir. -Codefreek |
i have put the functions in it's own file so it looks more clean..
PHP Code:
|
Could use some help :)
|
lol i did forget one thing about forums they have a search spot ;)
and now i know maybe why i am not getting allot of response for this as people have asked allot of questions when it comes to mail :) sorry! |
::update::2
PHP Code:
thoughts ? |
| All times are GMT. The time now is 10:06 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0