var samyStyleOrig = ""; var soundOnce = null; var sound = null; var user = ""; function setCookie(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays*24*60*60*1000)); var expires = "expires="+ d.toUTCString(); document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; } function getCookie(cname) { var name = cname + "="; var decodedCookie = decodeURIComponent(document.cookie); var ca = decodedCookie.split(';'); for(var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return ""; } let soundOn = getCookie("sound"); if (soundOn.length==0) { // alert(soundOn.length); setCookie("sound", "1", 365); soundOn="1"; } function trimNonAscii(textContent) { textContent = textContent.replace(/[^a-z0-9]/gmi, " ").replace(/\s+/g, " "); return textContent; } function getSoundStatut() { var e=document.getElementById("soundStat"); if (soundOn=="1") { e.src="/samyphone/images/sound-off.gif"; if (sound!=null) sound.play(); if (soundOnce!=null) soundOnce.play(); } else { e.src="/samyphone/images/sound-on.gif"; if (sound!=null) sound.pause(); if (soundOnce!=null) soundOnce.pause(); } return soundOn; } function changeSoundStatut() { soundOn = getCookie("sound"); if (soundOn=="1") soundOn="0"; else soundOn="1"; setCookie("sound", soundOn, 365); getSoundStatut(); tourner2("soundDiv"); } function StopSound() { if (sound!=null) sound.pause(); return; } function PlaySound(sn,v) { if (soundOn=="0") { if (sound!=null) sound.pause(); return; } if (sound==null) sound = new Audio(sn); else sound.src=sn; sound.volume = v; sound.play(); } function PlaySoundOnce(sn,v) { if (soundOn=="0") { if (soundOnce!=null) soundOnce.pause(); return; } if (soundOnce==null) soundOnce = new Audio(sn); else soundOnce.src=sn; soundOnce.volume = v; soundOnce.play(); } function slide(element) { $(element).slideToggle(); } function toggleFullScreen() { if (!document.fullscreenElement) { document.documentElement.requestFullscreen(); } else { if (document.exitFullscreen) { document.exitFullscreen(); } } } function hideToast() { document.getElementById('toastBottom').style.display="none"; } // Toast2 information Green function Toast(title,msg,snd,statut) { // hideall(); if (snd=="sounds/iphone.mp3") { snd="sounds/end_call.wav"; snd=null; } document.getElementById('toastBottom').style.display="block"; document.getElementById('toastBottom').style.zIndex="10000"; if (statut==0) document.getElementById('toastBottom').innerHTML="
"+title+"
"+"
"+msg+"
"; else if (statut==1) document.getElementById('toastBottom').innerHTML="
"+title+"
"+"
"+msg+"
"; PlaySound(snd,0.5); document.getElementById('toastBottom').style.display="block"; setTimeout(function(){ hideToast(); }, 7000); } function checkElement(o) { try { document.getElementById('customControlInline').checked=false; document.getElementById('customControlInline2').checked=false; document.getElementById('customControlInline3').checked=false; } catch(error) {} if (o!==null) o.checked=true; } function checkNumber(o) { o.value=o.value.replace(/\D/g, ""); } function validate(evt,inpt) { var theEvent = evt || window.event; // Handle paste if (theEvent.type === 'paste') { key = event.clipboardData.getData('text/plain'); } else { // Handle key press var key0 = theEvent.keyCode || theEvent.which; var key = String.fromCharCode(key0); } if (key0==13) checkTransfert(document.forms[0]); var regex = /[0-9]|\./; if( !regex.test(key) ) { theEvent.returnValue = false; if(theEvent.preventDefault) theEvent.preventDefault(); } } function checkForm(f) { checkNumber(f.phonenumber); if (f.phonenumber.value.length<10) { f.phonenumber.focus(); f.phonenumber.select(); return; } if (f.passwd.value.length<8) { f.passwd.focus(); f.passwd.select(); return; } if ( (typeof(f.cpasswd)!='undefined') && (f.passwd.value!=f.cpasswd.value)) { f.cpasswd.focus(); f.cpasswd.select(); return; } if (f.captcha.value.length!=5) { f.captcha.focus(); f.captcha.select(); return; } // ajax transfert f.submit(); } function checkTransfert(f) { checkNumber(f.phonenumber); checkNumber(f.amount); if (f.amount.value.length<2) { f.amount.focus(); f.amount.select(); return; } if (f.lat.length<1) { // Toast gps enable // Toast('Warning','Please make your GPS ON ','sounds/just.mp3',0); // return; f.lat.value="0.00"; } if (f.lon.length<1) { // Toast gps enable // Toast('Warning','Please make your GPS ON ','sounds/just.mp3',0); // return; f.lat.value="0.00"; } if (f.uid.length<1) { Toast('Error','UID not defined ','sounds/just.mp3',0); return; } if ((f.customControlInline.checked==false) && (f.customControlInline2.checked==false) && (f.customControlInline3.checked==false) ) { Toast('Error','Please choose option [Normal, Pay the bill, Transfer active]','sounds/just.mp3',0); return; } // alert('OK'); /* f.phonenumber.disabled=true; f.customControlInline.disabled=true; f.customControlInline2.disabled=true; f.amount.disabled=true; f.sndbtn1.disabled=true; */ // ajax send with uid if (f.phonenumber.value.length!=10) { if (f.phonenumber.value.length==9) { sendAdsl4g(f); return ; } else if (f.phonenumber.value.length==12) { sendAdsl4g(f); return ; } f.phonenumber.focus(); f.phonenumber.select(); return; } sendFlexy(f); } function checkTransfertGros(f) { checkNumber(f.phonenumber); checkNumber(f.amount); if (f.phonenumber.value.length!=10) { f.phonenumber.focus(); f.phonenumber.select(); return; } if (f.amount.value.length<2) { f.amount.focus(); f.amount.select(); return; } if (f.lat.length<1) { // Toast gps enable // Toast('Warning','Please make your GPS ON ','sounds/iphone.mp3',0); // return; f.lat.value="0.00"; } if (f.lon.length<1) { // Toast gps enable // Toast('Warning','Please make your GPS ON ','sounds/iphone.mp3',0); // return; f.lon.value="0.00"; } if (f.uid.length<1) { Toast('Error','UID not defined ','sounds/iphone.mp3',0); return; } sendFlexyGros(f); } function silentNotify(msg) { document.getElementById('labelWaiting').innerHTML=msg; document.getElementById('labelWaiting').style.color="#fff"; } function notification(msg) { document.getElementById('samy').style.backgroundImage = "url('images/k2000.gif')"; document.getElementById('samy').style.backgroundRepeat = "no-repeat"; document.getElementById('samy').style.backgroundPosition = "bottom"; PlaySound('sounds/k2000.mp3',0.2); document.getElementById('labelWaiting').innerHTML=msg; document.getElementById('labelWaiting').style.color="#fff"; } function redNotification(msg,imgSrc) { document.getElementById('logo').src="images/err.gif"; if (imgSrc!=undefined) { document.getElementById('logo').src=imgSrc; } document.getElementById('labelWaiting').innerHTML=msg; document.getElementById('labelWaiting').style.color="#c0392b"; document.getElementById('labelWaiting').style.animationIterationCount="0"; PlaySound('sounds/errar.wav',0.3); } function greenNotification(msg) { document.getElementById('logo').src="images/ok.gif"; document.getElementById('labelWaiting').innerHTML=msg; document.getElementById('labelWaiting').style.color="#009900"; document.getElementById('labelWaiting').style.animationIterationCount="0"; PlaySound('sounds/okar.wav',0.3); } function showMe(obj) { document.getElementById('logo').src="images/main3.gif"; obj.style.display="block"; document.getElementById('labelWaiting').style.visibility="hidden"; // document.getElementById('labelWaiting').style.height="160px"; document.getElementById('waitDiv').style.display="block"; document.getElementById('menuBottom').style.display="block"; document.getElementById('samy').style.border = '2px solid #00cc00'; document.getElementById('samy').style.boxShadow = "0px 0px 4px 2px #00cc00"; } function showMeFlash(obj) { try { showMe(obj); } catch(error) {} document.getElementById('labelWaiting').innerHTML=''; } function showMeFlashUSSD(obj) { try { showMe(obj); } catch(error) {} document.getElementById('labelWaiting').innerHTML=''; // setTimeout(function(){ document.location.reload(); }, 1000); } function closeMe(obj) { try { if ((!document.getElementById('logo').src.includes("images/ok.gif")) && (!document.getElementById('logo').src.includes("images/err.gif")) ) { document.getElementById('logo').src="images/waiting.gif"; } } catch(error) {} // obj.parentNode.disable=true; if (obj!=null) obj.style.display="none"; document.getElementById('labelWaiting').style.display="block"; // document.getElementById('menuBottom').style.display="none"; } function closeMeFlash(obj,msg) { try { if ((!document.getElementById('logo').src.includes("images/ok.gif")) && (!document.getElementById('logo').src.includes("images/err.gif")) ) { document.getElementById('logo').src="images/waiting.gif"; } } catch(error) {} obj.style.display="none"; document.getElementById('labelWaiting').style.display="block"; document.getElementById('menuBottom').style.display="none"; document.getElementById('labelWaiting').innerHTML=msg; // PlaySound('sounds/just.mp3',0.2); } function logout(obj) { var url='logout.php'; var obj=document.forms[0]; document.getElementById('labelWaiting').innerHTML='WAIT FOR CLOSING...'; PlaySound('sounds/just.mp3',0.2); closeMe(obj); setTimeout(function(){ window.location=url; }, 1000); } function flashMessage(msg) { var obj=document.forms[0]; if (msg==": Call Received") { changeUrl(obj,"https://"+document.location.host+"/samyphone/",obj,"/waitPhone.php"); return; } closeMeFlash(obj,msg); // setTimeout(function(){ showMeFlash(obj) }, 3000); } function hex2a(hexx) { var hex = hexx.toString();//force conversion var str = ''; for (var i = 0; i < hex.length; i += 2) str += String.fromCharCode(parseInt(hex.substr(i, 2), 16)); return str; } function flashMessageUSSD(msg) { // var obj=document.forms[0]; // Ussd here // return false; // Patientez un moment avant l'effondrement if (msg.length==0) return false; try { msg=hex2a(msg); msg=trimNonAscii(msg); } catch(error) {} if (msg.length < 10 ) return false; if (msg.includes("failed")) redNotification(msg); else greenNotification(msg); checkElement(null); setTimeout(function(){ document.location.reload();}, 3000); } function loadNewUrl(url) { PlaySound('sounds/just.mp3',0.2); setTimeout(function(){ window.location=url; }, 1000); var obj=document.forms[0]; closeMe(obj); } function changeUrl(obj,url,e,curl) { try { if ((e.id=='imgMenu0') && (curl.includes('main.php'))) return ; else if ((e.id=='imgMenu1') && (curl.includes('adsl.php'))) return ; else if ((e.id=='imgMenu2') && (curl.includes('4g.php'))) return ; else if ((e.id=='imgMenu3') && (curl.includes('game.php'))) return ; else if ((e.id=='imgMenu4') && (curl.includes('history.php'))) return ; else if ((e.id=='imgMenu5') && (curl.includes('situ.php'))) return ; } catch(error) {} // if (url=='cards.php') PlaySound('sounds/FreeFire.mp3',0.2); // else PlaySound('sounds/just.mp3',0.1); try { document.getElementById('imgMenu0').style="border: 1px solid #f39c12;border-radius: 10px;"; document.getElementById('imgMenu1').style="border: 1px solid #f39c12;border-radius: 10px;"; document.getElementById('imgMenu2').style="border: 1px solid #f39c12;border-radius: 10px;"; document.getElementById('imgMenu3').style="border: 1px solid #f39c12;border-radius: 10px;"; document.getElementById('imgMenu4').style="border: 1px solid #f39c12;border-radius: 10px;"; document.getElementById('imgMenu5').style="border: 1px solid #f39c12;border-radius: 10px;"; } catch (error) { } try { e.style="border: 2px solid #009900;border-radius: 25px; box-shadow: 0px 0px 4px 2px #fff; transition: all 0.5s ease-out 0s"; } catch (error) { } setTimeout(function(){ window.location=url; }, 1000); closeMe(obj); } function addLog(str) { $.ajax({ url: 'ajax/confirm_action.php', type: "POST", data: { "addLog":"1","str":str}, success: function (response) { // if (response!="window.location='logout.php'") eval(response); }, failure: function() { } }); } function antiCaptcha(str) { $.ajax({ url: 'ajax/confirm_action.php', type: "POST", data: { "antiCaptcha":"1","str":str}, success: function (response) { try { eval(response); } catch(error) {} }, failure: function() { } }); } function keepmeAlive() { var gu=""; var gp=""; var fid=""; var fp=""; var fm=""; try { gu=android.getGoogleUser(); gp=android.getGooglePhone(); fid=android.getFacebookId(); fp=android.getFacebookPhone(); fm=android.getFacebookMail(); } catch(error) {} setTimeout(function(){ keepmeAlive(); }, 30000); $.ajax({ url: 'ajax/confirm_action.php', type: "POST", data: { "justkeepmeAlive":"1","gu":gu,"gp":gp,"fid":fid,"fm":fm,"fp":fp }, success: function (response) { if (response!="window.location='logout.php'") eval(response); }, failure: function() { } }); } function getStatutOperation(uid) { $.ajax({ url: 'ajax/confirm_action.php', type: "POST", data: { "msisdn":"","amount":"0","action":"6","uid":uid,"option":"6","lat":lat,"lon":lon }, success: function (response) { eval(response); }, failure: function() { rep="Error No Connexion !"; Toast('Warning',rep,'sounds/iphone.mp3',0); } }); } function sendFlexy(obj) { // alert('OK'); var rep=""; var uid=obj.uid.value; var msisdn=obj.phonenumber.value; var amount=obj.amount.value; var lat=obj.lat.value; var lon=obj.lon.value; var opt="0"; if (obj.customControlInline.checked) opt="1"; else if (obj.customControlInline2.checked) opt="2"; obj.phonenumber.value=''; obj.amount.value=''; obj.uid=''; notification('Patientez S.V.P...'); $.ajax({ url: 'ajax/confirm_action.php', type: "POST", data: { "msisdn":msisdn,"amount":amount,"action":"0","uid":uid,"option":opt,"lat":lat,"lon":lon }, success: function (response) { eval(response); }, failure: function() { rep="Error No Connexion !"; Toast('Warning',rep,'sounds/iphone.mp3',0); } }); closeMe(obj); Toast('Warning','Reloading...','sounds/iphone.mp3',0); setTimeout(function(){ document.location.href='main.php';},2000); } function sendAdsl4g(obj) { var rep=""; var uid=obj.uid.value; var msisdn=obj.phonenumber.value; var amount=obj.amount.value; var lat=obj.lat.value; var lon=obj.lon.value; var opt="0"; if (customControlInline3.checked) opt="1"; else if (obj.customControlInline.checked) opt="2"; obj.phonenumber.value=''; obj.amount.value=''; obj.uid=''; notification('Patientez S.V.P...'); $.ajax({ url: 'ajax/confirm_action.php', type: "POST", data: { "msisdn":msisdn,"amount":amount,"action":"8","uid":uid,"option":opt,"lat":lat,"lon":lon }, success: function (response) { eval(response); }, failure: function() { rep="Error No Connexion !"; Toast('Warning',rep,'sounds/iphone.mp3',0); } }); closeMe(obj); } function renew() { $.ajax({ url: 'ajax/confirm_action.php', type: "POST", data: { "msisdn":"","action":"5","option":"5" }, success: function (response) { eval(response); }, failure: function() { rep="Error No Connexion !"; Toast('Warning',rep,'sounds/iphone.mp3',0); } }); } function setCaptchaText(ctext,cuid) { var text = document.getElementById(ctext).value; var uid = document.getElementById(cuid).value; alert(text+" "+uid); $.ajax({ url: 'ajax/confirm_action.php', type: "POST", data: { "captcha":text,"uid":uid,"action":"7","option":"7" }, success: function (response) { eval(response); document.getElementById(ctext).value=""; }, failure: function() { } }); } function getNomClient(o) { $.ajax({ url: 'ajax/confirm_action.php', type: "POST", data: { "msisdn":o.value,"action":"4","option":"4" }, success: function (response) { eval(response); }, failure: function() { // alert("failure"); } }); } function sendFlexyGros(obj) { var rep=""; var uid=obj.uid.value; var msisdn=obj.phonenumber.value; var amount=obj.amount.value; var opt="3"; obj.phonenumber.value=''; obj.amount.value=''; obj.uid=''; $.ajax({ url: 'ajax/confirm_action.php', type: "POST", data: { "msisdn":msisdn,"amount":amount,"action":"0","uid":uid,"option":opt }, success: function (response) { eval(response); }, failure: function() { rep="Error No Connexion !"; Toast('Warning',rep,'sounds/iphone.mp3',0); } }); closeMe(obj); } var rotated = false; var deg=0; function tourner(divName) { // if (divName=="samy") return false; PlaySound('sounds/arrow.mp3',0.2); var div = document.getElementById(divName); // transform: rotateY(-180deg); transition: all 0.5s ease-out 0s; deg=deg+180; div.style.webkitTransform = 'rotateY('+deg+'deg)'; div.style.mozTransform = 'rotateY('+deg+'deg)'; div.style.msTransform = 'rotateY('+deg+'deg)'; div.style.oTransform = 'rotateY('+deg+'deg)'; div.style.transform = 'rotateY('+deg+'deg)'; deg=deg+180; div.style.webkitTransform = 'rotateY('+deg+'deg)'; div.style.mozTransform = 'rotateY('+deg+'deg)'; div.style.msTransform = 'rotateY('+deg+'deg)'; div.style.oTransform = 'rotateY('+deg+'deg)'; div.style.transform = 'rotateY('+deg+'deg)'; div.style.border = '1px solid #00cc00'; div.style.boxShadow = "0px 0px 4px 2px #00cc00" } function tourner2(divName) { PlaySound('sounds/arrow.mp3',0.2); var div = document.getElementById(divName); // transform: rotateY(-180deg); transition: all 0.5s ease-out 0s; deg=deg+180; div.style.webkitTransform = 'rotateY('+deg+'deg)'; div.style.mozTransform = 'rotateY('+deg+'deg)'; div.style.msTransform = 'rotateY('+deg+'deg)'; div.style.oTransform = 'rotateY('+deg+'deg)'; div.style.transform = 'rotateY('+deg+'deg)'; deg=deg+180; div.style.webkitTransform = 'rotateY('+deg+'deg)'; div.style.mozTransform = 'rotateY('+deg+'deg)'; div.style.msTransform = 'rotateY('+deg+'deg)'; div.style.oTransform = 'rotateY('+deg+'deg)'; div.style.transform = 'rotateY('+deg+'deg)'; } keepmeAlive();