views:

138

answers:

3

Hi I have a web form that sends a string to one php file which redirects them to a corresponding URL. I've searched about web form hacking and I've only received information about PHP and SQL... my site only uses a single PHP file, very basic etc. Would it be open to any exploits? I'm obviously not going to post the URL, but here is some code I was working on for the php file: http://stackoverflow.com/questions/2888077/newbie-php-coding-problem-header-function-maybe-i-need-someone-to-check-my-cod

Thanks

+1  A: 

Uh, it really depends. If you are inserting data into a MySQL DB without sanitizing, the answer is a huge yes. This is something you need to decide for yourself if you aren't going to show code.

chris12892
The code is pretty much all above. The only code on the .html file is the <form> blah blah and method=post etc, I didn't think it would be necessary to show this.
Haskella
+1  A: 

The solution you've got in the linked question is pretty safe.
Every possible action is hardcoded in your script.

Nothing to worry about.

Though asking for the "web form like this" you'd better to provide a web form. Not the link to the question that contains a code that can be presumed as this form's handler.

Col. Shrapnel
Well, that's a relief thanks. Better safe than sorry :D
Haskella
+2  A: 

From that little snippet, I don't see anything dangerous. "Hackers" can enter pretty much anything they want into $_REQUEST['sport'] and thereby $searchsport, but the only place you use it is to access your array. If it's not found in your array.... nothing much will happen. I think you're safe in this limited scenario ;) Just be careful not to use $searchsport for...... just about anything else. Echoing it, or inserting it into a DB is dangerous.

Mark
Thanks for the advice, appreciate it
Haskella
you're welcome :)
Mark