-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmove.php
More file actions
85 lines (73 loc) · 2.88 KB
/
move.php
File metadata and controls
85 lines (73 loc) · 2.88 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
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
<?php
//Start session to access session variables.
session_start();
$filename = $_POST['filename'];
$currDir = $_POST['current_dir'];
echo '<link rel="stylesheet" href="css/dropdown.css" type="text/css">';
//Set variables to perform database query.
$user = $_SESSION['user'];
//Establish connection.
$query = "SELECT * FROM filesystem WHERE owner='$user' AND isFolder='1' ORDER BY isFolder DESC";
$con=mysqli_connect("localhost","root","r00tpass","mysql_db");
if (mysqli_connect_errno())
{
//Unable to establish connection.
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
//Perform query.
$result = mysqli_query($con, $query);
//If query is performed unsuccessfully.
if(!$result)
{
echo "Unable to access database.<br>";
}
//Create options table.
echo '<div style="margin-top:-10px">';
echo '<div class="tablehead">';
echo '<div id = "options"></div>';
//File parameter table.
echo '
<table width="79%" cellpadding="8px" class="heading">
<tr class="border_bottom">
<td width="59%">Folder Name</td>
<td >Path</td>
<tr>
</table><br>
';
echo '</div>';
echo '<div class="tables">';
echo '<table width="80%" cellpadding="10px" class="table">';
echo '<tr class="border_bottom"><td width="5%" class="data"><span class="glyphicon glyphicon-folder-open"></span></td><td class="data" width="50%" onclick="DestDirMove(\''.$filename.'\',\''.$currDir.'\',\''.'!'.'\')">';
echo "Home<br>";
echo "</td>";
echo'<td class="data" width="45%">';
echo "";
echo"</td >";
echo "</tr>";
//Traverse through query results.
while($row = mysqli_fetch_array($result))
{
$name = $row['file_name'];
$folder_name = substr($name, 6) ; //Remove dwalin tag.
$folder_name = str_replace("_", " ", $folder_name); //Replace underscore by blank spaces.
$path = str_replace('!'," \ ",$row["directory_path"]);
$path = substr($path,3);
if($path == ""){
$path = "Home";
}
else{
$path = "Home ".$path;
}
echo '<tr class="border_bottom"><td width="5%" class="data"><span class="glyphicon glyphicon-folder-open"></span></td><td class="data" width="50%" onclick="DestDirMove(\''.$filename.'\',\''.$currDir.'\',\''.$row['directory_path'].$folder_name.'!'.'\')">';
echo $folder_name."<br>";
echo "</td>";
echo'<td class="data" width="45%">';
echo $path;
echo"</td >";
echo "</tr>";
}
echo "</table>";
//echo '<iframe style="height:auto; width:auto;border:0;" id = "preview"></iframe>';
echo '</div>';
echo '</div>';
?>