mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-04 12:29:28 +00:00
- LehreinheitenOverlay Erweiterungen
This commit is contained in:
@@ -10,7 +10,8 @@
|
||||
// wir uebergeben das als Parameter
|
||||
//End Configuration
|
||||
|
||||
function doLogin() {
|
||||
function doLogin()
|
||||
{
|
||||
var username = document.getElementById('loginUser').value;
|
||||
var password = document.getElementById('loginPass').value;
|
||||
|
||||
@@ -23,22 +24,26 @@ function doLogin() {
|
||||
}
|
||||
|
||||
//Start phpRequest Object
|
||||
function phpRequest(server_url,uname,passw) {
|
||||
function phpRequest(server_url,uname,passw)
|
||||
{
|
||||
this.parms = new Array();
|
||||
this.parmsIndex = 0;
|
||||
this.execute = phpRequestExecute;
|
||||
this.executePOST = phpRequestExecutePOST;
|
||||
this.add = phpRequestAdd;
|
||||
this.server = server_url;
|
||||
this.uname = uname;
|
||||
this.passw = passw;
|
||||
}
|
||||
|
||||
function phpRequestAdd(name,value) {
|
||||
function phpRequestAdd(name,value)
|
||||
{
|
||||
this.parms[this.parmsIndex] = new Pair(name,value);
|
||||
this.parmsIndex++;
|
||||
}
|
||||
|
||||
function phpRequestExecute() {
|
||||
function phpRequestExecute()
|
||||
{
|
||||
var targetURL = this.server;
|
||||
|
||||
try {
|
||||
@@ -56,7 +61,7 @@ function phpRequestExecute() {
|
||||
//alert('sende '+txt);
|
||||
//Two options here, only uncomment one of these
|
||||
//GET REQUEST
|
||||
httpRequest.open("GET", targetURL+txt, false, '<?php echo $_SERVER['PHP_AUTH_USER'] ?>','<?php echo $_SERVER['PHP_AUTH_PASSW'] ?>');
|
||||
httpRequest.open("GET", targetURL+txt, false, '','');
|
||||
|
||||
//POST REQUEST EXAMPLE
|
||||
/*
|
||||
@@ -88,7 +93,66 @@ function phpRequestExecute() {
|
||||
return response;
|
||||
}
|
||||
|
||||
function Pair(name,value) {
|
||||
|
||||
function phpRequestExecutePOST()
|
||||
{
|
||||
var targetURL = this.server;
|
||||
|
||||
try
|
||||
{
|
||||
var httpRequest = new XMLHttpRequest();
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
alert('Error creating the connection!');
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var txt = "";
|
||||
for(var i in this.parms)
|
||||
{
|
||||
txt = txt+'&'+this.parms[i].name+'='+this.parms[i].value;
|
||||
}
|
||||
//alert('sende '+txt);
|
||||
|
||||
//POST REQUEST
|
||||
httpRequest.open("POST", targetURL, false, '', '');
|
||||
httpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
|
||||
httpRequest.send(txt);
|
||||
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
alert('An error has occured calling the external site: '+e);
|
||||
return false;
|
||||
}
|
||||
|
||||
switch(httpRequest.readyState)
|
||||
{
|
||||
case 1,2,3:
|
||||
alert('Bad Ready State: '+httpRequest.status);
|
||||
return false;
|
||||
break;
|
||||
case 4:
|
||||
if(httpRequest.status !=200)
|
||||
{
|
||||
alert('The server respond with a bad status code: '+httpRequest.status);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
var response = httpRequest.responseText;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
function Pair(name,value)
|
||||
{
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user