81d21c311f
Moved config into $GLOBALS Moved request_uri into $GLOBALS Modified all files accordingly Modified logout page for future improvements (not deleting the entire $_SESSION) Fixed LICENSEs, moved LICENSE for PHP files in /lib/php subfolder instead of /lib
33 lines
1.3 KiB
JavaScript
33 lines
1.3 KiB
JavaScript
function urlinsert() {
|
|
var url = document.getElementById ( "form-url" ).value;
|
|
var xhr = new XMLHttpRequest ( );
|
|
xhr.open ( "POST", 'insert', true );
|
|
xhr.onreadystatechange = function ( ) {
|
|
if ( xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200 ) {
|
|
if (xhr.status == 200) {
|
|
var response = xhr.responseText;
|
|
response = JSON.parse ( response );
|
|
if ( response [ 'status' ] == 200 ) {
|
|
document.getElementById ( "responsetext" ).innerHTML = response [ 'message' ];
|
|
var div = document.createElement ( 'div' );
|
|
div.innerHTML = response [ 'last_insert' ] + " | " + url;
|
|
document.getElementById ( "urllist" ).appendChild ( div );
|
|
document.getElementById ( "form-url" ).value = "";
|
|
}
|
|
else {
|
|
document.getElementById ( "responsetext" ).innerHTML = response [ 'error_message' ];
|
|
}
|
|
}
|
|
else {
|
|
console.log ( 'Server communication error: ' + xhr.statusText );
|
|
}
|
|
}
|
|
}
|
|
data = new FormData ( );
|
|
data.append('url', url);
|
|
xhr.send( data );
|
|
}
|
|
function logout ( ) {
|
|
window.location.href = script_name+"/logout";
|
|
}
|