Jump to content

[SOLVED] how would one ulink a file once visited?


Recommended Posts

guys i got a script that would store info in a txt file with numbers e.g 33004488.txt and the link gets sent to a person in an email so that he/she can view the content. so what i want to do is once the person visits the content the 33004488.txt files gets deleted from the folder.

here is the part

 

<?php } else if ( (!isset($_POST['submit'])) && (isset($_GET['displayinfo'])) ) { 
$file = isset($_GET['displayinfo']) ?  $_GET['displayinfo'] : ''          ;
$content = file('messages/'.$file.".txt");
$pic   = $content['0'];
unset ($content['0']);
unset ($content['1']);
$main = "";
foreach ($content as $value) {
      $main .= $value;
}
?>           
   <center>Here Is Your E-Card!<br/><br/>
   <img src='thumbs/<?php echo $pic; ?>' alt="E-Card" />
   <br/><br/><br/>
   <?php echo nl2br(htmlspecialchars($main)); ?>
   </center>            
       
<?php } ?>        

Well, this should help you

 

http://ryanfait.com/resources/protect-flash-files-from-download/

 

Basically the concept is to load the file in a PHP script, so they don't see the file itself, but a mirror copy of the file. Use that, but after first run, delete the orriginal file

..first off,sorry if this isn't what you are looking for I just woke up and am still in between worlds lol... but here is something that I think you are talking about...however it is very insecure, but still it should work if you filter it out, and it's only txt files you are showing...

 

<?php
$id=$_GET['id']; //This would be the name of the originall file

include("/home/public_html/uploaded/".$id);  //Use include to show the file

unlink("/home/public_html/uploaded/".$id); //Use unlink to delete the file
?>

Here is one that is a little better:

<?php
$id=$_GET['id']; //This would be the name of the originall file

$page = file_get_contents('http://www.yoursite.com/pages/'.$id);
echo $page;

unlink("/home/public_html/pages/".$id);
?>

this is what i tried

 

<?php } else if ( (!isset($_POST['submit'])) && (isset($_GET['displayinfo'])) ) { 
$file = isset($_GET['displayinfo']) ?  $_GET['displayinfo'] : ''          ;
$content = file('messages/'.$file.".txt");
$pic   = $content['0'];
unset ($content['0']);
unset ($content['1']);
$main = "";
foreach ($content as $value) {
      $main .= $value;
}
?>

delete should be done somewhere here
           
<center>Here Is Your E-Card!<br/><br/>
<img src='thumbs/<?php echo $pic; ?>' alt="E-Card" />
<br/><br/><br/>

<?php 
echo nl2br(htmlspecialchars($main));
$main = file('messages/'.$file.".txt");
unlink($main);
?>

 

and i get this error

 

Warning: unlink() expects parameter 1 to be string, array given in /home2/public_html/card.php on line 142

 

 

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.