Clean Path by Regular Expressions : Directory : File Directory PHP Source Code


PHP Source Code » File Directory » Directory »

 

Clean Path by Regular Expressions



<html>
<body>
<?php
if (isset($_POST['posted'])) {
   $path = $_POST['path'];
   $outpath = ereg_replace(".[.]+""", $path);
   $outpath = ereg_replace("^[/]+""", $outpath);
   $outpath = ereg_replace("^[A-Za-z][:|][/]?""", $outpath);
   echo "The old path is " . $path . " and the new path is " . $outpath;
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input type="hidden" name="posted" value="true">
Enter your file path for cleaning:
<input type="text" name="path" size="30">
<input type="submit" value="Clean">
</form>
</body>
</html>


           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo File Directory
» Directory