diff options
author | Patrick Simianer <p@simianer.de> | 2015-03-31 13:13:11 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2015-03-31 13:13:11 +0200 |
commit | c2ce37c7c49bc17420a1bbe8a0ae50aa10e78207 (patch) | |
tree | b5328ca4d254c3db9219bbae0d76ef0dfcae2806 /server.php | |
parent | d7f4f02988ac1ae337bf834a950f430d91156f8e (diff) | |
parent | 0ecf3b6bb5ce167e3a0e22bdd00f37c196184a03 (diff) |
Merge remote-tracking branch 'origin/Sariyusha-patch-1'
Diffstat (limited to 'server.php')
-rw-r--r-- | server.php | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/server.php b/server.php new file mode 100644 index 0000000..0683f12 --- /dev/null +++ b/server.php @@ -0,0 +1,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); + +} + +?> |