Add exams from exam58 to exam98
This commit is contained in:
0
exam82/64115txt
Normal file
0
exam82/64115txt
Normal file
13
exam82/checkfile.php
Normal file
13
exam82/checkfile.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
$filename = 'file.txt';
|
||||
|
||||
if(file_exists($filename)){
|
||||
echo 'File already exists';
|
||||
} else {
|
||||
$handle = fopen($filename, 'w');
|
||||
fwrite($handle, 'Nothing');
|
||||
fclose($handle);
|
||||
}
|
||||
|
||||
?>
|
||||
1
exam82/file.txt
Normal file
1
exam82/file.txt
Normal file
@@ -0,0 +1 @@
|
||||
Nothing
|
||||
1
exam82/files/firstfile.txt
Normal file
1
exam82/files/firstfile.txt
Normal file
@@ -0,0 +1 @@
|
||||
First file
|
||||
1
exam82/files/secondfile.txt
Normal file
1
exam82/files/secondfile.txt
Normal file
@@ -0,0 +1 @@
|
||||
Second File
|
||||
1
exam82/files/thirdfile.txt
Normal file
1
exam82/files/thirdfile.txt
Normal file
@@ -0,0 +1 @@
|
||||
Third file
|
||||
16
exam82/listingFiles.php
Normal file
16
exam82/listingFiles.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
$directory = 'files';
|
||||
|
||||
if ($handle = opendir($directory.'/')){
|
||||
echo 'Looking inside \'' . $directory . '\': <br>';
|
||||
|
||||
while($file = readdir($handle)){
|
||||
if ($file != '.' && $file != '..') {
|
||||
echo '<a href="'.$directory.'/'.$file.'">'.$file.'</a><br>';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
22
exam82/rdfiles.php
Normal file
22
exam82/rdfiles.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
$filename = 'filetodelete.txt';
|
||||
|
||||
if(@unlink($filename)){
|
||||
echo 'File <strong>'. $filename .'</strong> has been deleted';
|
||||
} else {
|
||||
echo 'File cannot be deleted!';
|
||||
}
|
||||
|
||||
$file = 'filetorename.txt';
|
||||
$rand = rand(10000,99999);
|
||||
|
||||
if(@rename($file,$rand.'txt')){
|
||||
echo 'File has been renamed successfully to ' . $rand;
|
||||
} else {
|
||||
echo 'File cannot be renamed!';
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user