Jump to content

Recommended Posts

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.