M.O.S. Studios Posted January 12, 2009 Share Posted January 12, 2009 hey guys, is there a funtion that can crop off all characters after the first 6 letters here is the code im using <?php // setting Directory $directory = "upload"; if($_POST['directory'] && $_POST['directory']!="upload") { $directory = $_POST['lower']."/".$_POST['directory']; } if($_POST['change']) { $directory = $_POST['change']; } //Opening the directory; $dir = opendir($directory); ?> <form method="POST" action="index.php"> <?php echo "<i>PATH:</i> <input type='text' size='100%' name='change' value='".$directory."'><input type='submit' value='Change dir'><br>"; ?> <a href='index.php'><i>root</i></a> <br><br> </form> <form method="POST" action="index.php"> <?php //displaying contents while($file = readdir($dir)) { if($file!="." && $file != "..") { if(!stristr($file, ".")) { $dirs .="<input type='submit' name='directory' value='".$file."'>"."<br>"."\n"; } else { $files .=$file."<br>"."\n"; } } } echo $dirs; echo $files; ?> <input type="hidden" value="<?php echo $directory; ?>" name="lower"> </form> basicly i want to make the code check to varify that the dir stays within the upload directory thanks in advance Link to comment https://forums.phpfreaks.com/topic/140547-cropping-a-value/ Share on other sites More sharing options...
DeanWhitehouse Posted January 12, 2009 Share Posted January 12, 2009 substr(); Link to comment https://forums.phpfreaks.com/topic/140547-cropping-a-value/#findComment-735478 Share on other sites More sharing options...
M.O.S. Studios Posted January 12, 2009 Author Share Posted January 12, 2009 AWESOME, works like a charm Link to comment https://forums.phpfreaks.com/topic/140547-cropping-a-value/#findComment-735487 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.