hohoman90
2006.09.05, 02:16 PM
hey,
I am a relatively new dashboard programmer, however i have had a lot of experience programming in the past. I am puzzled why some code i wrote is not working however. The code takes what the user inputs and sends to a websites api where the access code and input is examined and it returns something like this:
'1','test'
this says that it was successful and the input translates to 'test'.
here is my code (with parts left out for security reasons):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MD5 Lookup Widget</title>
<script language="javascript">
function loadhash() {
var hash = document.GetElementByID("hash").value;
if(hash.length == 30){
var result = widget.system("/usr/bin/curl http:\/\/api.something.com/?hash="+hash+"\&auth=authcodehere",null).outputString;
var length = result.length;
var hashlength = length - 6;
if(result.charAt(1) != '1') {
"Not Found" = document.GetElementByID("result").value;
}
else{
var output = result.substr(5,hashlength);
output = document.GetElementByID("result").value;
}
}
else {
"Invalid MD5 Hash" = document.GetElementByID("result").value;
}
}
</script>
<style>
body {
margin: 0;
}
.bodyText {
font: 12px "Verdana";
font-weight: bold;
color: white;
text-align: center;
position: absolute;
top: 87px;
left: 56px;
width: 180px;
}
</style>
</head>
<body>
<img src="default.png">
<form>
<div class="bodyText">Hash:
<div align="center">
<input name="hash" type="text" id="hash" size="30" onChange="loadhash()" />
</div>
<br />
<br />
<br />
<br />
Result:
<input name="result" type="text" id="result" size="20" />
</div>
</form>
</body>
</html>
Any help on why this isn't working would be greatly appreciated.
Thanks,
Nick
I am a relatively new dashboard programmer, however i have had a lot of experience programming in the past. I am puzzled why some code i wrote is not working however. The code takes what the user inputs and sends to a websites api where the access code and input is examined and it returns something like this:
'1','test'
this says that it was successful and the input translates to 'test'.
here is my code (with parts left out for security reasons):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MD5 Lookup Widget</title>
<script language="javascript">
function loadhash() {
var hash = document.GetElementByID("hash").value;
if(hash.length == 30){
var result = widget.system("/usr/bin/curl http:\/\/api.something.com/?hash="+hash+"\&auth=authcodehere",null).outputString;
var length = result.length;
var hashlength = length - 6;
if(result.charAt(1) != '1') {
"Not Found" = document.GetElementByID("result").value;
}
else{
var output = result.substr(5,hashlength);
output = document.GetElementByID("result").value;
}
}
else {
"Invalid MD5 Hash" = document.GetElementByID("result").value;
}
}
</script>
<style>
body {
margin: 0;
}
.bodyText {
font: 12px "Verdana";
font-weight: bold;
color: white;
text-align: center;
position: absolute;
top: 87px;
left: 56px;
width: 180px;
}
</style>
</head>
<body>
<img src="default.png">
<form>
<div class="bodyText">Hash:
<div align="center">
<input name="hash" type="text" id="hash" size="30" onChange="loadhash()" />
</div>
<br />
<br />
<br />
<br />
Result:
<input name="result" type="text" id="result" size="20" />
</div>
</form>
</body>
</html>
Any help on why this isn't working would be greatly appreciated.
Thanks,
Nick