aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/bin/testadmin.htm
blob: 1e34cf768a9ac81b033dc86c6d68076d47016868 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<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:800">
<br>
</div><br />
<button onclick="loadXMLDoc('Admin/Clients')">Clients</button>
<button onclick="loadXMLDoc('Admin/Accounts')">Accounts</button>

</body>

</html>