priyanka Posted October 24, 2013 Share Posted October 24, 2013 Hi, I am using following code in login form: <td><input type="hidden" name="txtURL" value="<?=$_GET['url']?>"><input name="submit" type="submit" value="Submit" class="button" /> <input id="reset" name="reset" type="reset" value="Reset" class="button" /></td> but a coding checker software says that it has security issues in <?=$_GET I have one more form for login check, there i wrote if(!isset($result['evoId'])){ header('Location: login.php?action=invalid'); Software gives error in "IF" and i used this in logi chk if($txtURL=='reverse'){ header('Location: ABC='); }else{ header('Location: index.php'); It gives error in "if($tx" please help and suggest Priyanka Quote Link to comment Share on other sites More sharing options...
Rifts Posted October 24, 2013 Share Posted October 24, 2013 You need to sanitize $_GET['url'] because it might contain malicious code. You could do something like this function clean_data($input) { $input = trim(htmlentities(strip_tags($input,","))); if (get_magic_quotes_gpc()) $input = stripslashes($input); $input = mysql_real_escape_string($input); return $input; } then you could do this <input type="hidden" name="txtURL" value="<?=clean_data($_GET['url'])?>"> Quote Link to comment Share on other sites More sharing options...
priyanka Posted October 24, 2013 Author Share Posted October 24, 2013 Hi Riftz, thanks for the reply. Is it possible for you to suggest some php programmer as I need to get fix some more and similar type of issues? Quote Link to comment Share on other sites More sharing options...
alpine Posted October 24, 2013 Share Posted October 24, 2013 (edited) I would recomend cleaning all data after the form is submitted, not before. if(isset($_POST['submit'])){ foreach($_POST as $k => $v){ ${$k} = some_safeclean_function($v); } // input name 'myinput' is now clean as $myinput along with all the other posted inputs } Edited October 24, 2013 by alpine Quote Link to comment 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.