OpenSimMirror/bin/testadmin.htm

125 lines
3.3 KiB
HTML
Raw Normal View History

<html>
<head>
<script type="text/javascript">
var http_request
var adminpadd
function loadXMLDoc(url)
{
http_request=null
// code for Mozilla, etc.
if (window.XMLHttpRequest)
{
http_request=new XMLHttpRequest()
}
// code for IE
else if (window.ActiveXObject)
{
http_request=new ActiveXObject("Microsoft.XMLHTTP")
}
if (http_request!=null)
{
http_request.onreadystatechange=state_Change
http_request.open("GET",url,true)
http_request.send(null)
}
else
{
alert("Your browser does not support XMLHTTP.")
}
}
function state_Change()
{
// if xmlhttp shows "loaded"
if (http_request.readyState==4)
{
// if "OK"
if (http_request.status==200)
{
document.getElementById('T1').innerHTML=http_request.responseText
}
else
{
alert("Problem retrieving data:" + http_request.statusText)
}
}
}
//var http_request = false;
function makePOSTRequest(url, parameters) {
http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
// set type accordingly to anticipated content type
//http_request.overrideMimeType('text/xml');
http_request.overrideMimeType('text/html');
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
alert('Cannot create XMLHTTP instance');
return false;
}
http_request.onreadystatechange =state_Change
http_request.open('POST', url, true);
http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http_request.setRequestHeader("Content-length", parameters.length);
http_request.setRequestHeader("Connection", "close");
http_request.send(parameters);
}
function alertContents() {
if (http_request.readyState == 4) {
if (http_request.status == 200) {
//alert(http_request.responseText);
result = http_request.responseText;
document.getElementById('T1').innerHTML = result;
} else {
alert('There was a problem with the request.');
}
}
}
function get(obj) {
var poststr = "FirstName=" + encodeURI( document.getElementById("FirstName").value ) +
"&LastName=" + encodeURI( document.getElementById("LastName").value )
+ "&PassWord=" + encodeURI( document.getElementById("PassWord").value )
+ "&AdminPass=" + adminpass;
makePOSTRequest('Admin/NewAccount', poststr);
}
function setpass(obj)
{
adminpass = encodeURI( document.getElementById("Adminpss").value );
makePOSTRequest('Admin/Login', adminpass);
}
</script>
</head>
<body onload="loadXMLDoc('Admin/Welcome')">
<div id="T1" style="border:1px solid black;height:500;width:600">
<br>
</div><br />
<button onclick="loadXMLDoc('Admin/Clients')">Clients</button>
<button onclick="loadXMLDoc('Admin/Accounts')">Accounts</button>
</body>
</html>