cheesycarrion Posted March 29, 2007 Share Posted March 29, 2007 Essentially what I want to do is remove every dot and slash ("." and "/") from a get variable. For example, if you go to page.php?id=../index.php set a variable (how about $newId) to "indexphp". another example: page.php?id=index.php set $newId to "indexphp" again. Link to comment https://forums.phpfreaks.com/topic/44849-solved-removing-characters-from-a-variable/ Share on other sites More sharing options...
trq Posted March 29, 2007 Share Posted March 29, 2007 <?php if (isset($_GET['id'])) { $newid = str_replace(array('.','/'),'',$_GET['id']); } ?> Link to comment https://forums.phpfreaks.com/topic/44849-solved-removing-characters-from-a-variable/#findComment-217788 Share on other sites More sharing options...
cheesycarrion Posted March 29, 2007 Author Share Posted March 29, 2007 thanks thorpe. Link to comment https://forums.phpfreaks.com/topic/44849-solved-removing-characters-from-a-variable/#findComment-217791 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.