-
Notifications
You must be signed in to change notification settings - Fork 0
/
get.php
93 lines (93 loc) · 2.3 KB
/
get.php
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
class filedo{
public function getline($name, $lid){
$file = fopen($name, "r") or die("Error.");
for( $i = 0; $i < $lid; $i ++){
$val = fgets($file);
}
return trim($val);
}
public function changeline($name,$cnum,$word){
$num=0;
$filename = fopen($name, "r") or die("Unable to open TIME!");
$filename1 = fopen("temp.list", "w") or die("Unable to open TIME!");
while(!feof($filename)) {
$k=trim(fgets($filename))."\n";
$num++;
if($num==$cnum){
$k=$word."\n";
}
fwrite($filename1,$k);
}
fclose($filename);
fclose($filename1);
$num=0;
$filename = fopen($name, "w") or die("Unable to open TIME!");
$filename1 = fopen("temp.list", "r") or die("Unable to open TIME!");
while(!feof($filename1)) {
$k=trim(fgets($filename1));
if($k=="")break;
$k=$k."\n";
$num++;
fwrite($filename,$k);
}
fclose($filename);
fclose($filename1);
}
public function insertline($name,$cnum,$word){
$num=0;
$filename = fopen($name, "r") or die("Unable to open TIME!");
$filename1 = fopen("temp.list", "w") or die("Unable to open TIME!");
while(!feof($filename)) {
$k=trim(fgets($filename))."\n";
$num++;
if($num==$cnum){
fwrite($filename1,$word."\n");
}
fwrite($filename1,$k);
}
fclose($filename);
fclose($filename1);
$num=0;
$filename = fopen($name, "w") or die("Unable to open TIME!");
$filename1 = fopen("temp.list", "r") or die("Unable to open TIME!");
while(!feof($filename1)) {
$k=trim(fgets($filename1));
if($k=="")break;
$k=$k."\n";
$num++;
fwrite($filename,$k);
}
fclose($filename);
fclose($filename1);
}
public function deleteline($name,$cnum){
$num=0;
$filename = fopen($name, "r") or die("Unable to open TIME!");
$filename1 = fopen("temp.list", "w") or die("Unable to open TIME!");
while(!feof($filename)) {
$k=trim(fgets($filename))."\n";
$num++;
if($num==$cnum){
continue;
}
fwrite($filename1,$k);
}
fclose($filename);
fclose($filename1);
$num=0;
$filename = fopen($name, "w") or die("Unable to open TIME!");
$filename1 = fopen("temp.list", "r") or die("Unable to open TIME!");
while(!feof($filename1)) {
$k=trim(fgets($filename1));
if($k=="")break;
$k=$k."\n";
$num++;
fwrite($filename,$k);
}
fclose($filename);
fclose($filename1);
}
}
$fileio = new filedo();
?>