blob: 0683f12d62b9cd3fd99c66a7bc1c361a1b27c8a1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
<?php
if($_POST['number'])
{
$varNumber = $_POST['number'];
$mySourceFile = fopen("source.txt", "r") or die("Unable to open file!");
for ($i = 1; $i <= $varNumber; $i++) {
fgets($mySourceFile);
}
if (!feof($mySourceFile))
{
echo fgets($mySourceFile);
}
else
{
echo "The end of the input file.";
}
fclose($mySourceFile);
}
if($_POST['number_trgt'])
{
$varNumber = $_POST['number_trgt'];
$myTargetFile = fopen("target.txt", "r") or die("Unable to open file!");
for ($i = 1; $i <= $varNumber; $i++) {
fgets($myTargetFile);
}
if (!feof($myTargetFile))
{
echo fgets($myTargetFile);
}
else
{
echo "The end of the input file.";
}
fclose($myTargetFile);
}
if($_POST['postedit'])
{
$varData = $_POST['postedit'];
echo $varData;
$myFile = "testFile.txt";
file_put_contents($myFile, $varData, FILE_APPEND);
file_put_contents($myFile, PHP_EOL, FILE_APPEND);
}
?>
|