-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1.php
More file actions
59 lines (57 loc) · 2.92 KB
/
Copy path1.php
File metadata and controls
59 lines (57 loc) · 2.92 KB
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Audio Recorder Online</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="style.css">
<script type = "text/javascript"><!-- rename script-->
<!--
function getValue(pili) {
var retVal = prompt("Enter new name : ", "your name here");
if(retVal == null || retVal == ""){ }
else { var text = "<a href='1.php?rename=" + retVal +'&oldName='+ pili +"'>Click to Rename</a>"; document.getElementById(pili).innerHTML = text;
/*THIS LINE TO CHANGE WHOLE PAGE CONTENT document.write("click to Rename : <a href='1.php?rename=" + retVal +'&oldName='+ pili +"'>rename</a>");*/ }
}
//-->
</script>
</head>
<body>
<h1>Audio Recorder Online</h1>
<div id="controls">
<button id="recordButton" onclick="window.location.href='<?php $ref = $_SERVER['PHP_SELF']; echo $ref; ?>'">Refresh</button>
<button id="recordButton" onclick="window.location.href='.'">Main Page</button>
</div> <br><br>
<?php error_reporting(0);
/********** Rename coding start ***********/
if (isset($_GET['rename'])) {
$new_name = 'rec/'.$_GET['rename'].'.wav';
$old_name = 'rec/'.$_GET['oldName'];
// Checking If File Already Exists
if(file_exists($new_name))
{ echo "Error While Renaming $old_name" ; }
else {
if(rename( $old_name, $new_name))
{ echo "Successfully Renamed $old_name to $new_name" ; }
else
{ echo "A File With The Same Name Already Exists" ; }
}
} /* Rename coding end */
/************ delete coding start *******/
if (isset($_GET['delete'])) {
$file = 'rec/'.$_GET["delete"];
if (!unlink($file)){ echo ("(Error deleting file<b><i>".$_GET["delete"]."</i></b>. <br> This file is already deleted)<br>"); }
else { echo ("Deleted $file".$_GET["delete"]."<br>"); }
}
else { } /* delete coding end */
$files = glob("rec/*.wav");
$files_names = str_replace("rec/","",$files);
$total = count($files_names);
if($total==0) die("No files found");
for ($x = 0; $x < $total; $x++) {
$data[] = '<li class="dele">'.$files_names[$x].'  <a href="1.php?delete='.$files_names[$x].'">Delete</a> <c id="'.$files_names[$x].'"><input type = "button" value = "Rename" onclick = "getValue(\''.$files_names[$x].'\');" /></c><br><audio controls=""><source src="'.$files[$x].'"></audio></li>';
}
$files_name1 = implode("",$data);
echo "<ol>";
echo$files_name1;
?>