Skip to content

Commit 8bbe954

Browse files
Merge pull request #4 from sqlitecloud/#3-PHP-Admin-do-not-work-in-a-sub-directory
#3 - PHP Admin doesn't work in a sub-directory
2 parents f1a6137 + e1974a9 commit 8bbe954

File tree

7 files changed

+10
-15
lines changed

7 files changed

+10
-15
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ repos:
3232
- --runtime-set
3333
- ignore_warnings_on_exit 1
3434
- --ignore=^admin/.*$
35+
files: \.php$
3536
require_serial: true

.vscode/settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"php.suggest.basic": false,
3-
"phpserver.relativePath": "./admin",
43
"intelephense.environment.phpVersion": "7.0.0",
54
"intelephense.telemetry.enabled": false,
65
"php-cs-fixer.executablePath": "${workspaceFolder}/vendor/bin/php-cs-fixer",

admin/common.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
require_once __DIR__ . '/../bootstrap.php';
3+
require_once __DIR__ . '/../vendor/autoload.php';
44

55
use SQLiteCloud\SQLiteCloudClient;
66

admin/console.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ form.addEventListener('submit', function(event) {
5050

5151
async function postData(data) {
5252
try {
53-
const response = await fetch ('/console_action.php', {
53+
const response = await fetch ('./console_action.php', {
5454
method: 'POST',
5555
body: JSON.stringify(data)
5656
}

admin/login.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ form.addEventListener('submit', function(event) {
2323
div.style.display = "block";
2424
return;
2525
}
26-
location.href = '/index.php';
26+
location.href = './index.php';
2727
});
2828
});
2929

3030
async function postData(data) {
3131
try {
32-
const response = await fetch ('/login_action.php', {
32+
const response = await fetch ('./login_action.php', {
3333
method: 'POST',
3434
body: JSON.stringify(data)
3535
}

admin/upload.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function uploadStart(file, key, size, chunkSize) {
4646
if (enableLogging) console.log("reqcount: " + reqcount);
4747

4848
var xhr = new XMLHttpRequest();
49-
xhr.open('POST', '/upload_action.php', false);
49+
xhr.open('POST', './upload_action.php', false);
5050
xhr.setRequestHeader("Connection", "keep-alive");
5151
xhr.setRequestHeader("Keep-Alive", "timeout=15, max=" + reqcount + "\"");
5252
xhr.send(formdata);
@@ -63,13 +63,13 @@ function uploadEnd() {
6363
formdata.append('action', 2); // END
6464

6565
var xhr = new XMLHttpRequest();
66-
xhr.open('POST', '/upload_action.php', false);
66+
xhr.open('POST', './upload_action.php', false);
6767
xhr.send(formdata);
6868

6969
progressSet(100);
7070
displayMessage("Database succesfully uploaded.");
7171

72-
setTimeout(() => {location.href = '/databases.php';}, 500);
72+
setTimeout(() => {location.href = './databases.php';}, 500);
7373
return true;
7474
}
7575

@@ -82,7 +82,7 @@ function uploadAbort() {
8282
formdata.append('action', 666); // ABORT
8383

8484
var xhr = new XMLHttpRequest();
85-
xhr.open('POST', '/upload_action.php', false);
85+
xhr.open('POST', './upload_action.php', false);
8686
xhr.send(formdata);
8787

8888
return true;
@@ -129,7 +129,7 @@ function uploadLoop (file, start, end, size) {
129129
formdata.append('encoding', 1); // 1 -> base64, 2 -> binary
130130

131131
// post data
132-
xhr.open('POST', '/upload_action.php', true);
132+
xhr.open('POST', './upload_action.php', true);
133133
xhr.send(formdata);
134134
}
135135
reader.readAsDataURL(chunk);

admin/upload_action.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ function do_upload_loop()
2626
} else {
2727
echo 0;
2828
}
29-
30-
// DEBUG CODE
31-
// $fp = fopen('/Users/marco/Desktop/lidn.txt', ($start == 0) ? 'w' : 'a');
32-
// fwrite($fp, $chunk);
33-
// fclose($fp);
3429
}
3530

3631
function do_upload_start()

0 commit comments

Comments
 (0)