Problem with value of $_GET from php to javascript
Posted: 02 Apr 2019, 06:27
I found a script from: tutorialzine.com/2014/09/cute-file-browser-jquery-ajax-php
what I wanna use for my website.
But I can`t find out how to place $id = (int) $_GET['id']; in the document
I`m now for 8 hours buisy to find-out without any succes
PLEASE HELP ME
I wanna place $_GET into this document scan.php
but when I place $id = (int) $_GET['id']; I don`t get any result
But when I put manual a number in WHERE id='' " it is working
scan.php
This under is the index file but the $_GET[id] is not working in the scan.php
what I wanna use for my website.
But I can`t find out how to place $id = (int) $_GET['id']; in the document
I`m now for 8 hours buisy to find-out without any succes
PLEASE HELP ME
I wanna place $_GET into this document scan.php
but when I place $id = (int) $_GET['id']; I don`t get any result
But when I put manual a number in WHERE id='' " it is working
Code: Select all
$sql = mysqli_query($conn,"SELECT * FROM `user` WHERE id='' ");
Code: Select all
<?php
include "../inc/init.php";
include '../lib/pagination.class.php';
include "connection.php";
$sql = mysqli_query($conn,"SELECT * FROM `user` WHERE id='' ");
$users = mysqli_fetch_assoc($sql);
$dir = "$users[name]";
// Run the recursive function
$response = scan($dir);
// This function scans the files folder recursively, and builds a large array
function scan($dir){
$JanMolendijk = array();
// Is there actually such a folder/file?
if(file_exists($dir)){
foreach(scandir($dir) as $f) {
if(!$f || $f[0] == '.') {
continue; // Ignore hidden files
}
if(is_dir($dir . '/' . $f)) {
// The path is a folder
$JanMolendijk[] = array(
"name" => $f,
"type" => "folder",
"path" => $dir . '/' . $f,
"items" => scan($dir . '/' . $f) // Recursively get the contents of the folder
);
}
else {
// It is a file
$JanMolendijk[] = array(
"name" => $f,
"type" => "file",
"path" => $dir . '/' . $f,
"size" => filesize($dir . '/' . $f) // Gets the size of this file
);
}
}
}
return $JanMolendijk;
}
// Output the directory listing as JSON
header('Content-type: application/json');
echo json_encode(array(
"name" => "$users[name]",
"type" => "folder",
"path" => $dir,
"items" => $response
));
?>
Code: Select all
<?php
include('connection.php');
$id = (int) $_GET['id'];
$sql=mysqli_query($conn,"SELECT * FROM `user` WHERE id='" . $id . "' ");
$users=mysqli_fetch_assoc($sql);
?>
okok{<?php echo $user->filter->username ?>}
<br><?php echo $user->filter->userid ?>
<br><br>
<?php echo $users['name'];?>
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>Cute file browser</title>
<!-- Include our stylesheet -->
<link href="assets/css/styles.css" rel="stylesheet"/>
</head>
<body>
<div class="filemanager">
<div class="search">
<input type="search" placeholder="Find a file.." />
</div>
<div class="breadcrumbs"></div>
<ul class="data"></ul>
<div class="nothingfound">
<div class="nofiles"></div>
<span>No files here.</span>
</div>
</div>
<footer>
@ Molendijk <div id="tzine-actions"></div>
<span class="close"></span>
</footer>
<!-- Include our script files -->
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="script.js"></script>
</body>
</html>