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 Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted January 12, 2009 Share Posted January 12, 2009 substr(); Quote Link to comment 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 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.