/*
* Used by chainchecker www.digicert.com/help
* */
$(document).ready(function() {
//var host = getURLParameter('host');
$("#host").select();
var host = document.getElementById("host").value;
if (host.length>5 && host.indexOf('.')!=-1)
{
checkServer();
}
});
function getURLParameter(name) {
return decodeURIComponent(
(location.search.match(RegExp("[?|&]"+name+'=(.+?)(&|$)'))||[,null])[1]
);
}
function checkServer() { //old
checkServerWithVuln('heartbleed');
return false;
}
function checkServerBoth() { //new
checkServerWithVuln('checkvuln');
return false;
}
function checkServerWithVuln(vulnfield) {
var host = document.getElementById("host").value;
var order_id = document.getElementById("order_id").value;
var vulncheck = $("#"+vulnfield).is(":checked");
var message1 = 'Checking SSL chain...';
var message2 = 'Checking for common vulnerabilities...';
var r = Math.floor(Math.random()*1000);
if (host.length>5 && host.indexOf('.')!=-1)
{
$('#loadingMessage').html('
'+message1);
$('#loadingMessage').show();
$('#results').fadeOut(400);
$.ajax({
url: "/api/check-host.php",
global: false,
type: "POST",
data: {'r':r,'host':host,'order_id':order_id},
dataType: "html",
success: function(response) {
$('#loadingMessage').hide();
$('#results').html(response);
$('#results').fadeIn(400);
if (vulncheck)
{
$('#loadingMessage').html('
'+message2);
$('#loadingMessage').show();
$.ajax({
url: "/api/check-vuln.php",
global: false,
type: "POST",
data: {'r':r,'host':host},
dataType: "html",
success: function(response) {
$('#loadingMessage').hide();
$('#results').append(response);
$('#results').fadeIn(400);
}
});
}
},
error: function (jqxhr, textStatus, errorThrown) {
$("#loadingMessage").hide();
$("#results").text(errorThrown).fadeIn(400);
}
});
}
return false;
}