raine Posted August 11, 2006 Share Posted August 11, 2006 I just started learning about regular expresions and was testing what I wrote to see if it was checking my parameters properly and ran into this problem. When I enter <script> as the parameter to pass, the server sends me a 406, saying that the data is not acceptible. I was wondering if this is by design, or if there is a fix for it.Thanks Quote Link to comment https://forums.phpfreaks.com/topic/17217-parameter/ Share on other sites More sharing options...
corbin Posted August 11, 2006 Share Posted August 11, 2006 Wait... youre using a script tag for php?just use<?phpphp code here?> Quote Link to comment https://forums.phpfreaks.com/topic/17217-parameter/#findComment-72927 Share on other sites More sharing options...
raine Posted August 11, 2006 Author Share Posted August 11, 2006 Oh, no no. My code is all in the <? php ?> tag.What I meant was I was basically tampering with my own parameters in the URL.For example, I typed http://<hostname>/page.php?param=<script> and the server gave me a 406. Actually, the string '<script' is already enough to cause the 406. I can't see how my code is giving me a 406 so I thought it might be the server's problem. Just wanted to see what others think and to see if there is a solution. Quote Link to comment https://forums.phpfreaks.com/topic/17217-parameter/#findComment-73194 Share on other sites More sharing options...
wildteen88 Posted August 11, 2006 Share Posted August 11, 2006 Are you put html/javascript in the url? Why are you tryiung to put html/javascript in the url! Quote Link to comment https://forums.phpfreaks.com/topic/17217-parameter/#findComment-73209 Share on other sites More sharing options...
corbin Posted August 11, 2006 Share Posted August 11, 2006 Yeah, that uhhh makes no sense... Quote Link to comment https://forums.phpfreaks.com/topic/17217-parameter/#findComment-73211 Share on other sites More sharing options...
raine Posted August 11, 2006 Author Share Posted August 11, 2006 <script> tags and other URL encoded variants of it are often injected into URL POST/GET parameters to perform XSS attacks on a website.So I'm trying to come up with some counter measures. Quote Link to comment https://forums.phpfreaks.com/topic/17217-parameter/#findComment-73394 Share on other sites More sharing options...
Chevy Posted August 11, 2006 Share Posted August 11, 2006 You could use regex and strip_tags in your varibles of $_GET if they enter it in the URL[code]$varible = strip_tags($_GET['url']);if (!preg_match('/^\w+$/', $varible)) {echo "Only user letters, numbers and underscores!"; //Thats for what it says haha}[/code]Unless I read your last post wrong and this means nothing to you lol Quote Link to comment https://forums.phpfreaks.com/topic/17217-parameter/#findComment-73405 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.