// Run //window.onload = init; /** * init */ async function init() { var ua = navigator.userAgent, index, navigateur, version; if((index = ua.indexOf('Firefox'))>=0) { navigateur = 'Firefox'; version = ua.match(/Firefox\/([0-9]+(?:\.[0-9]+)*)/)[1]; } else if((index = ua.indexOf('MSIE'))>=0) { navigateur = 'Internet Explorer'; version = ua.match(/MSIE ([0-9]+(?:\.[0-9]+)*)/)[1]; } else if((index = ua.indexOf('Chrome'))>=0) { navigateur = 'Google Chrome'; version = ua.match(/Chrome\/([0-9]+(?:\.[0-9]+)*)/)[1]; } else if((index = ua.indexOf('Opera'))>=0) { navigateur = 'Opera'; version = ua.match(/Version\/([0-9]+(?:\.[0-9]+)*)/)[1] || ua.match(/Opera\/([0-9]+(?:\.[0-9]+)*)/)[1]; } else if((index = ua.indexOf('Safari'))>=0) { navigateur = 'Safari'; version = ua.match(/Version\/([0-9]+(?:\.[0-9]+)*)/)[1] || ua.match(/Safari\/([0-9]+(?:\.[0-9]+)*)/)[1]; } //alert(navigateur+' '+version); //logmessages(navigateur + " " + version); var OSName = "Unknown"; if (window.navigator.userAgent.indexOf("Windows NT 10.0")!= -1) OSName="Windows 10"; if (window.navigator.userAgent.indexOf("Windows NT 6.2") != -1) OSName="Windows 8"; if (window.navigator.userAgent.indexOf("Windows NT 6.1") != -1) OSName="Windows 7"; if (window.navigator.userAgent.indexOf("Windows NT 6.0") != -1) OSName="Windows Vista"; if (window.navigator.userAgent.indexOf("Windows NT 5.1") != -1) OSName="Windows XP"; if (window.navigator.userAgent.indexOf("Windows NT 5.0") != -1) OSName="Windows 2000"; //if (window.navigator.userAgent.indexOf("Mac") != -1) OSName="Mac/iOS"; if (window.navigator.userAgent.indexOf("X11") != -1) OSName="UNIX"; if (window.navigator.userAgent.indexOf("Linux") != -1) OSName="Linux"; if (window.navigator.userAgent.indexOf("Android") != -1) OSName="Android"; if (window.navigator.userAgent.indexOf("iOS") != -1) OSName="iOS"; if (window.navigator.userAgent.indexOf("iPad") != -1) OSName="iPad"; if (window.navigator.userAgent.indexOf("iPod") != -1) OSName="iPod"; if (window.navigator.userAgent.indexOf("iPhone") != -1) OSName="iPhone"; if (window.navigator.userAgent.indexOf("Mac") != -1) OSName="macOS"; if (window.navigator.userAgent.indexOf("FreeBSD") != -1) OSName="FreeBSD"; //alert(OSName); //logmessages(OSName + " " + navigateur + " " + version, false); var sendMail_s = OSName + "-" + navigateur + "-" + version; var sendMail_t = OSName + " " + navigateur + " " + version; // const resp = await fetch("scriptjs.php", { method: "POST", headers: {"Accept": "application/json","Content-Type": "application/json"}, body: JSON.stringify( { "from": "wm@localhost", "to": "wm@localhost", "subject": sendMail_s, "text": sendMail_t } ) }); /* .then(function () { alert("mail sent successfully"); }); */ if (resp.ok) { logmessages(OSName + " " + navigateur + " " + version, false); } else { logmessages(OSName + " " + navigateur + " " + version, false); logmessages("Error Email", false); } } /** * CallFunction */ function callfunction(id_logbutton) { logbutton(id_logbutton); //setTimeout(() => { callocate(); }, 1000); //callocate(); } /** * Callocate */ function callocate() { //KO //window.location.assign("fr_offre_de_services.php"); //window.location.href = "fr_offre_de_services.php"; //OK window.open("fr_offre_de_services.php","_self"); //window.open("fr_offre_de_services.php","_blank"); } /** * CallFunctions */ function callfunctions(id_toggle,id_logbutton) { logbutton(id_logbutton); toggle(id_toggle); } /** * Show or hide an page element... */ function toggle(id) { var elem = document.getElementById(id); var elem2 = document.getElementById("connexionsecure"); var elem3 = document.getElementById("systemcaisse"); if (elem.style.display == "none") { elem.style.display = "block"; } else { elem.style.display = "none"; } if (elem2.style.display == "block" && elem3.style.display == "block") { if (id == "connexionsecure") elem3.style.display = "none"; if (id == "systemcaisse") elem2.style.display = "none"; } } /** * Connexionsecure... */ async function logbutton(id) { // See logsecure.php // var VarJSCRIPT = 5; // $.get("logsecure.php", {VarPHP: VarJSCRIPT}); var BCShttps = ""; var ODShttps = ""; var BCShttp = ""; var ODShttp = ""; BCShttps = "https Button Connection Secure"; ODShttps = "https Button Offre De Service"; BCShttp = "http Button Connection Secure"; ODShttp = "http Button Offre De Service"; if (window.location.protocol == "https:") { if (id == "button Connection Secure") { const resp = await fetch("logbutton.php", { method: "POST", headers: {"Accept": "application/json","Content-Type": "application/json"}, body: JSON.stringify( {"logbutton": BCShttps} ) }); if (resp.ok) { logmessages(BCShttps, false); } else { logmessages("Error", false); } } if (id == "button Offre De Service") { const resp = await fetch("logbutton.php", { method: "POST", headers: {"Accept": "application/json","Content-Type": "application/json"}, body: JSON.stringify( {"logbutton": ODShttps} ) }); if (resp.ok) { logmessages(ODShttps, true); } else { logmessages("Error", true); } } } else if (window.location.protocol == "http:") { if (id == "button Connection Secure") { const resp = await fetch("logbutton.php", { method: "POST", headers: {"Accept": "application/json","Content-Type": "application/json"}, body: JSON.stringify( {"logbutton": BCShttp} ) }); if (resp.ok) { logmessages(BCShttp, false); } else { logmessages("Error", false); } } if (id == "button Offre De Service") { const resp = await fetch("logbutton.php", { method: "POST", headers: {"Accept": "application/json","Content-Type": "application/json"}, body: JSON.stringify( {"logbutton": ODShttp} ) }); if (resp.ok) { logmessages(ODShttp, true); } else { logmessages("Error", true); } //const validOK = await resp.ok; //return logbutton().then(validOK => { logmessages(ODShttp, true); }).catch(() => { logmessages("Error", true); }); //return logbutton().then(validOK => { logmessages(ODShttp, true); }, () => { logmessages("Error", true); } ); } } } /** * Logmessages */ async function logmessages(id_logm, ex) { const resp = await fetch("scriptjs.php", { method: "POST", headers: {"Accept": "application/json","Content-Type": "application/json"}, body: JSON.stringify( {"logmessages": id_logm,"logmessagesEx": ex} ) }); if (ex == true) callocate(); }