here is my code: (i have like 6txt files, but i only want to have 1 and record all of the numbers in one txt file) anyone please help me!, thanks
<?php
///////////////////////////////////////////////////////////////////////////////////
$file1 ="http://www.yoursite.com/yourfile1.zip"; //set these to the URLs of the files to be downloaded.
$file2 ="http://www.yoursite.com/yourfile2.zip";
$file3 ="http://www.yoursite.com/yourfile3.zip";
$file4 ="http://www.yoursite.com/yourfile4.zip";
$file5 ="http://www.yoursite.com/yourfile5.zip";
$file6 ="http://www.yoursite.com/yourfile6.zip";
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
$include = "file.txt";
if ($x == 1) {
$filename = "file1.txt";
$fp = fopen( $filename, "r+" ) or die ("no file opening is occuring"); //$fp is short for file pointer
flock($fp,1); //allows file reading but prevents writing
$counter = fgets( $fp, 6 ); //sets variable counter to where filepointer is
$counter++; // increments counter by 1
rewind($fp); // re-sets file pointer to start of file.
fputs( $fp, $counter); //writes the value of the counter to where filepointer is.
flock($fp,3); //releases file
global $file1, $include;
$include = "file1.txt";
print "<p align='center'><a href='$file1'>click to download</a></p>";
} else if ($x == 2){
$filename = "file2.txt";
$fp = fopen( $filename, "r+" ) or die ("no file opening is occuring"); //$fp is short for file pointer
flock($fp,1); //allows file reading but prevents writing
$counter = fgets( $fp, 6 ); //sets variable counter to where filepointer is
$counter++; // increments counter by 1
rewind($fp); // re-sets file pointer to start of file.
fputs( $fp, $counter); //writes the value of the counter to where filepointer is.
flock($fp,3); //releases file
global $file2, $include;
$include = "file2.txt";
print "<p align='center'><a href='$file2'>click to download</a></p>";
} else if ($x == 3) {
$filename = "file3.txt";
$fp = fopen( $filename, "r+" ) or die ("no file opening is occuring"); //$fp is short for file pointer
flock($fp,1); //allows file reading but prevents writing
$counter = fgets( $fp, 6 ); //sets variable counter to where filepointer is
$counter++; // increments counter by 1
rewind($fp); // re-sets file pointer to start of file.
fputs( $fp, $counter); //writes the value of the counter to where filepointer is.
flock($fp,3); //releases file
global $file3, $include;
$include = "file3.txt";
print "<p align='center'><a href='$file3'>click to download</a></p>";
} else if ($x == 4) {
$filename = "file4.txt";
$fp = fopen( $filename, "r+" ) or die ("no file opening is occuring"); //$fp is short for file pointer
flock($fp,1); //allows file reading but prevents writing
$counter = fgets( $fp, 6 ); //sets variable counter to where filepointer is
$counter++; // increments counter by 1
rewind($fp); // re-sets file pointer to start of file.
fputs( $fp, $counter); //writes the value of the counter to where filepointer is.
flock($fp,3); //releases file
global $file4, $include;
$include = "file4.txt";
print "<p align='center'><a href='$file4'>click to download</a></p>";
} else if ($x == 5) {
$filename = "file5.txt";
$fp = fopen( $filename, "r+" ) or die ("no file opening is occuring"); //$fp is short for file pointer
flock($fp,1); //allows file reading but prevents writing
$counter = fgets( $fp, 6 ); //sets variable counter to where filepointer is
$counter++; // increments counter by 1
rewind($fp); // re-sets file pointer to start of file.
fputs( $fp, $counter); //writes the value of the counter to where filepointer is.
flock($fp,3); //releases file
global $file5, $include;
$include = "file5.txt";
print "<p align='center'><a href='$file5'>click to download</a></p>";
}else {
$filename = "file6.txt";
$fp = fopen( $filename, "r+" ) or die ("no file opening is occuring"); //$fp is short for file pointer
flock($fp,1); //allows file reading but prevents writing
$counter = fgets( $fp, 6 ); //sets variable counter to where filepointer is
$counter++; // increments counter by 1
rewind($fp); // re-sets file pointer to start of file.
fputs( $fp, $counter); //writes the value of the counter to where filepointer is.
flock($fp,3); //releases file
global $file6, $include;
$include = "file6.txt";
print "<p align='center'><a href='$file6'>click to download</a><br><i>right click this link and select save as</i></p>";
}
?>
<meta http-equiv="Content-Language" content="en-gb">
<body link="#000080" vlink="#000080" alink="#000080">
<p align="center"><font size="1" face="Arial">Hits:
<?php global $include;
include($include);
?>
</font>