I have a php code that will create a txt file, the problem I'm having is adding is the content of the txt file.
I want to include it from an external file.
This is the code i have used so far:
<?php
$data = $_POST;
$time = time();
$filename_prefix = 'file/evidence_file';
$filename_extn = 'txt';
$filename = $filename_prefix.'-'.$time.'-'.uniqid().'.'.$filename_extn;
if( file_exists( $filename ) ){
# EXTREMELY UNLIKELY, unless two forms with the same content and at the same time are submitted
$filename = $filename_prefix.'-'.$time.'-'.uniqid().'-'.uniqid().'.'.$filename_extn;
# IMPROBABLE that this will clash now...
}
if( file_exists( $filename ) ){
# Handle the Error Condition
}else{
file_put_contents( $filename , '<?php include("text.php"); ?>' );
}
?>
The problem is using the php include within the current code! All that it prints in the txt file is:
<?php include("text.php"); ?>
How can I get it to display the content of text.php?
Also the text.php file contains php code.