var ie = document.all != null; var showpremium = 1; function toggletext(id) { if (showpremium == 0) { showpremium = 1; document.getElementById(id).innerHTML="Show Premium features"; } else { showpremium = 0; document.getElementById(id).innerHTML="Show Options"; } } function cancelcommand(commandid) { var request = GXmlHttp.create(); request.open("GET", "../cancelcommand.php?commandid="+commandid+"&id="+deviceid+"&RANDOM=."+Math.random(), true); request.onreadystatechange = function() { if (request.readyState == 4) { var xmlDoc = request.responseXML; var status = xmlDoc.documentElement.getElementsByTagName("status"); if (status[0].getAttribute("result") == "OK") { checkiPhone(1); } else { alert(status[0].getAttribute("result")); } } } request.send(null); } function checkiPhone(setgps) { var request = GXmlHttp.create(); request.open("GET", "../iphonestatus.php?id="+deviceid+"&RANDOM=."+Math.random(), true); request.onreadystatechange = function() { if (request.readyState == 4) { var xmlDoc = request.responseXML; var commands = xmlDoc.documentElement.getElementsByTagName("command"); var iphone = xmlDoc.documentElement.getElementsByTagName("iphone"); var callforwarding = parseInt(iphone[0].getAttribute("callforwarding")); var locked = parseInt(iphone[0].getAttribute("locked")); var alarm_active = parseInt(iphone[0].getAttribute("alarmactive")); if (callforwarding>0) { document.getElementById("callforward").innerHTML="Call forwarding active [Cancel]"; } else { document.getElementById("callforward").innerHTML="Activate Call forwarding"; } if (locked>0) { document.getElementById("lockiphone").innerHTML="iPhone Locked Unlock"; document.getElementById("islocked").innerHTML="Warning! your iPhone is locked, to unlock it press SHOW PREMIUM FEATURES and select UNLOCK!

"; } else { document.getElementById("lockiphone").innerHTML="Lock iPhone"; document.getElementById("islocked").innerHTML=""; } document.getElementById("lastconnect").innerHTML=parseInt(iphone[0].getAttribute("lastconnect")); document.getElementById("battery").innerHTML=parseInt(iphone[0].getAttribute("battery")); var pendingcommands = ""; for (var i = 0; i <= (commands.length - 1); i++) { pendingcommands += " [Cancel] "+commands[i].getAttribute("name")+" "+commands[i].getAttribute("parameters")+"
"; } if (commands.length == 0) { document.getElementById("pendingcommands").innerHTML="

None
"; } else { document.getElementById("pendingcommands").innerHTML=pendingcommands; } } } request.send(null); if (setgps !=1) { setGPS("nothing"); } if (setgps ==2) { window.setTimeout(function(){ checkiPhone(2)},60000); } } function msgbox() { var myalign = "

"; if (ie) { myalign="                                "; } document.getElementById("msgbox").innerHTML="Write your message:

"+myalign+"[Show] [Cancel]"; } function sendsms() { document.getElementById("sendsms").innerHTML="SMS to: "; //document.getElementById("smstext").style.visibility = 'visible'; document.getElementById("smstext").style.display = 'block'; } function sendnow() { var request = GXmlHttp.create(); request.open("GET", "../sendsms.php?id="+deviceid+"&number="+encodeURIComponent(document.getElementById("smsnumber").value)+"&text="+encodeURIComponent(document.getElementById("smstextarea").value)+"&RANDOM=."+Math.random(), true); request.onreadystatechange = function() { if (request.readyState == 4) { var xmlDoc = request.responseXML; var markers = xmlDoc.documentElement.getElementsByTagName("marker"); if (markers[0].getAttribute("status") == "OK") { document.getElementById("sendsms").innerHTML="OK - The iPhone will send a sms to that number on next connection"; //document.getElementById("smstext").style.visibility = 'hidden'; document.getElementById("smstext").style.display = 'none'; } else { document.getElementById("sendsms").innerHTML="Ouch! Some error has occured. Check your privileges or try again later..."; } } } request.send(null); window.setTimeout(function(){ setdefaultmakecall()},5000); window.setTimeout(function(){ checkiPhone()},5000); } function msgboxfunction(text, myfunction) { var request = GXmlHttp.create(); var result = 0; var sharingcode = window.sharingcode || ""; request.open("GET", "../showmsg.php?id="+deviceid+"&sharingcode="+sharingcode+"&text="+text+"&RANDOM=."+Math.random(), true); request.onreadystatechange = function() { if (request.readyState == 4) { var xmlDoc = request.responseXML; var markers = xmlDoc.documentElement.getElementsByTagName("marker"); if (markers[0].getAttribute("status") == "OK") { myfunction(1); } else { myfunction(0); } } } request.send(null); } function msgboxnow() { msgboxfunction(document.getElementById("msgboxtext").value, msgboxresult); } function msgboxresult(result) { if (result==1) { document.getElementById("msgbox").innerHTML="OK - The iPhone will show that message on next connection"; } else { document.getElementById("msgbox").innerHTML="Ouch! Some error has occured. Check your privileges or try again later..."; } window.setTimeout(function(){ setdefaultmakecall()},5000); window.setTimeout(function(){ checkiPhone()},5000); } function cancelcallforwarding() { var request = GXmlHttp.create(); request.open("GET", "../callforward.php?id="+deviceid+"&cancel=1&RANDOM=."+Math.random(), true); request.onreadystatechange = function() { if (request.readyState == 4) { var xmlDoc = request.responseXML; var markers = xmlDoc.documentElement.getElementsByTagName("marker"); if (markers[0].getAttribute("status") == "OK") { document.getElementById("callforward").innerHTML="Activate Call forwarding"; } else { alert("Wops! Some error has occured. Check your privileges or try again later..."); } } } request.send(null); checkiPhone(); } function callforward() { var myalign = "

"; if (ie) { myalign="                            "; } document.getElementById("callforward").innerHTML="Forward to:
"+myalign+"[Forward] [Cancel]"; } function forwardnow() { var request = GXmlHttp.create(); request.open("GET", "../callforward.php?id="+deviceid+"&number="+encodeURIComponent(document.getElementById("forwardnumber").value)+"&RANDOM=."+Math.random(), true); request.onreadystatechange = function() { if (request.readyState == 4) { var xmlDoc = request.responseXML; var markers = xmlDoc.documentElement.getElementsByTagName("marker"); if (markers[0].getAttribute("status") == "OK") { document.getElementById("callforward").innerHTML="OK - The iPhone will forward all your calls to that number on next connection"; } else { document.getElementById("callforward").innerHTML="Ouch! Some error has occured. Check your privileges or try again later..."; } } } request.send(null); window.setTimeout(function(){ setdefaultmakecall()},5000); window.setTimeout(function(){ checkiPhone()},5000); } function takepicture() { if (document.getElementById("picmail").value == "") { alert("Please fill the mail address to send the picture taken"); return; } var request = GXmlHttp.create(); request.open("GET", "../takepicture.php?id="+deviceid+"&cameraid="+encodeURIComponent(document.getElementById("picsource").value)+"&mail="+encodeURIComponent(document.getElementById("picmail").value)+"&RANDOM=."+Math.random(), true); request.onreadystatechange = function() { if (request.readyState == 4) { var xmlDoc = request.responseXML; var markers = xmlDoc.documentElement.getElementsByTagName("marker"); if (markers[0].getAttribute("status") == "OK") { document.getElementById("takepicnow").innerHTML="OK - Your iPhone will take a picture and send it to that mail"; } else { document.getElementById("takepicnow").innerHTML="Ouch! Some error has occured. Check your privileges or try again later..."; } } } request.send(null); window.setTimeout(function(){ setdefaultmakecall()},5000); window.setTimeout(function(){ checkiPhone()},5000); } function recordaudio() { if (document.getElementById("recmail").value == "") { alert("Please fill the mail address to send recorded audio"); return; } var request = GXmlHttp.create(); request.open("GET", "../recordaudio.php?id="+deviceid+"&seconds="+encodeURIComponent(document.getElementById("recseconds").value)+"&mail="+encodeURIComponent(document.getElementById("recmail").value)+"&RANDOM=."+Math.random(), true); request.onreadystatechange = function() { if (request.readyState == 4) { var xmlDoc = request.responseXML; var markers = xmlDoc.documentElement.getElementsByTagName("marker"); if (markers[0].getAttribute("status") == "OK") { document.getElementById("recnowtext").innerHTML="OK - The iPhone will record audio and send to that mail on the next connection"; } else { document.getElementById("recnowtext").innerHTML="Ouch! Some error has occured. Check your privileges or try again later..."; } } } request.send(null); window.setTimeout(function(){ setdefaultmakecall()},5000); window.setTimeout(function(){ checkiPhone()},5000); } function backup() { var request = GXmlHttp.create(); request.open("GET", "../backupnow.php?id="+deviceid+"&RANDOM=."+Math.random(), true); request.onreadystatechange = function() { if (request.readyState == 4) { var xmlDoc = request.responseXML; var markers = xmlDoc.documentElement.getElementsByTagName("marker"); if (markers[0].getAttribute("status") == "OK") { document.getElementById("backup").innerHTML="OK - The iPhone will backup all your contacts, sms and calendars on next connection"; } else { document.getElementById("backup").innerHTML="Ouch! Some error has occured. Check your privileges or try again later..."; } } } request.send(null); window.setTimeout(function(){ setdefaultmakecall()},5000); window.setTimeout(function(){ checkiPhone()},5000); } function panicmode() { if (!confirm("Do you want to activate Panic Mode? this option will override your settings")) { return false; } var request = new XMLHttpRequest(); request.open("GET", "../panicmode.php?id="+deviceid+"&RANDOM=."+Math.random(), true); request.onreadystatechange = function() { if (request.readyState == 4) { var xmlDoc = request.responseXML; var markers = xmlDoc.documentElement.getElementsByTagName("marker"); if (markers[0].getAttribute("status") == "OK") { document.getElementById("panicmode").innerHTML="OK - Your settings will be changed to PANIC MODE"; } else { document.getElementById("panicmode").innerHTML="Ouch! Some error has occured. Check your privileges or try again later..."; } } } request.send(null); window.setTimeout(function(){ setdefaultmakecall()},5000); window.setTimeout(function(){ checkiPhone()},5000); } function restore() { if (!confirm("This action will overwrite all your contacts, sms and calendars from the last backup done.\n\nAre you sure?")) { return false; } var request = GXmlHttp.create(); request.open("GET", "../restorebackup.php?id="+deviceid+"&RANDOM=."+Math.random(), true); request.onreadystatechange = function() { if (request.readyState == 4) { var xmlDoc = request.responseXML; var markers = xmlDoc.documentElement.getElementsByTagName("marker"); if (markers[0].getAttribute("status") == "OK") { document.getElementById("restore").innerHTML="OK - The iPhone will restore all your contacts, sms and calendars from last backup on next connection"; } else { document.getElementById("restore").innerHTML="Ouch! Some error has occured. Check your privileges and that you have a backup already done or try again later..."; } } } request.send(null); window.setTimeout(function(){ setdefaultmakecall()},5000); window.setTimeout(function(){ checkiPhone()},5000); } function alarmiphone(alarmyes) { var request = GXmlHttp.create(); request.open("GET", "../alarmiphone.php?id="+deviceid+"&alarm="+alarmyes, true); request.onreadystatechange = function() { if (request.readyState == 4) { var xmlDoc = request.responseXML; var markers = xmlDoc.documentElement.getElementsByTagName("marker"); if (markers[0].getAttribute("status") == "OK") { if (alarmyes>0) { text = "OK - Your iPhone will start an alarm on the next connection!"; } else { text = "OK - Your iPhone will stop the alarm on the next connection!"; } document.getElementById("alarmiphone").innerHTML=""+text; } else { document.getElementById("alarmiphone").innerHTML="Ouch! Some error has occured. Check your privileges or try again later..."; } } } request.send(null); window.setTimeout(function(){ setdefaultmakecall()},5000); window.setTimeout(function(){ checkiPhone()},5000); } function lockiphone(lockyes) { if (lockyes>0) { if (!confirm("Are you sure you want to lock your iPhone screen?")) { return false; } } var request = GXmlHttp.create(); request.open("GET", "../lockiphone.php?id="+deviceid+"&lock="+lockyes, true); request.onreadystatechange = function() { if (request.readyState == 4) { var xmlDoc = request.responseXML; var markers = xmlDoc.documentElement.getElementsByTagName("marker"); if (markers[0].getAttribute("status") == "OK") { if (lockyes>0) { text = "OK - Your iPhone will be locked on the next connection"; } else { text = "OK - Your iPhone will be unlocked on the next connection"; } document.getElementById("lockiphone").innerHTML=""+text; } else { document.getElementById("lockiphone").innerHTML="Ouch! Some error has occured. Check your privileges or try again later..."; } } } request.send(null); window.setTimeout(function(){ setdefaultmakecall()},5000); window.setTimeout(function(){ checkiPhone()},5000); } function remotewipe() { if (confirm("Are you sure you want to wipe ALL your data from your iPhone? This action can not be undone!")) if (confirm("Really? Are you REALLY SURE? This is the last warning!")) { var request = GXmlHttp.create(); request.open("GET", "../remotewipe.php?id="+deviceid+"&RANDOM=."+Math.random(), true); request.onreadystatechange = function() { if (request.readyState == 4) { var xmlDoc = request.responseXML; var markers = xmlDoc.documentElement.getElementsByTagName("marker"); if (markers[0].getAttribute("status") == "OK") { document.getElementById("remotewipe").innerHTML="OK - The iPhone will wipe all your data on the next connection"; } else { document.getElementById("remotewipe").innerHTML="Ouch! Some error has occured. Check your privileges or try again later..."; } } } request.send(null); window.setTimeout(function(){ setdefaultmakecall()},5000); window.setTimeout(function(){ checkiPhone()},5000); } } function locateme() { //var request = GXmlHttp.create(); var request = new XMLHttpRequest(); request.open("GET", "../locatenow.php?id="+deviceid+"&RANDOM=."+Math.random(), true); request.onreadystatechange = function() { if (request.readyState == 4) { var xmlDoc = request.responseXML; var markers = xmlDoc.documentElement.getElementsByTagName("marker"); if (markers[0].getAttribute("status") == "OK") { document.getElementById("locatenow").innerHTML="OK - The iPhone will update its location on next connection"; } else { document.getElementById("locatenow").innerHTML="Ouch! Some error has occured. Check your privileges or try again later..."; } } } request.send(null); window.setTimeout(function(){ setdefaultmakecall()},5000); window.setTimeout(function(){ checkiPhone()},5000); } function callme() { var myalign = "

"; if (ie) { myalign="                                "; } document.getElementById("makecall").innerHTML="Phone to:
"+myalign+"[Call] [Cancel]"; } function callnow() { var request = GXmlHttp.create(); request.open("GET", "../makecall.php?id="+deviceid+"&number="+encodeURIComponent(document.getElementById("number").value)+"&RANDOM=."+Math.random(), true); request.onreadystatechange = function() { if (request.readyState == 4) { var xmlDoc = request.responseXML; var markers = xmlDoc.documentElement.getElementsByTagName("marker"); if (markers[0].getAttribute("status") == "OK") { document.getElementById("makecall").innerHTML="OK - The iPhone will phone that number on next connection"; } else { document.getElementById("makecall").innerHTML="Ouch! Some error has occured. Check your privileges or try again later..."; } } } request.send(null); window.setTimeout(function(){ setdefaultmakecall()},5000); window.setTimeout(function(){ checkiPhone()},5000); } function setdefaultmakecall() { document.getElementById("locatenow").innerHTML="Update location"; document.getElementById("msgbox").innerHTML="Show Message Box"; document.getElementById("makecall").innerHTML="Make a remote phonecall"; document.getElementById("sendsms").innerHTML="Send a remote SMS"; //document.getElementById("smstext").style.visibility = 'hidden'; document.getElementById("smstext").style.display = 'none'; checkiPhone(); document.getElementById("panicmode").innerHTML="Panic Mode - iPhone stolen!"; document.getElementById("remotewipe").innerHTML="Remote wipe"; document.getElementById("backup").innerHTML="Make backup now"; document.getElementById("restore").innerHTML="Restore last backup"; document.getElementById("recnowtext").innerHTML='
Record seconds of audio and send it to this email:

'; //
Record seconds of audio and send it to this email:

'; document.getElementById("takepicnow").innerHTML='\
\ \ Hacer una foto desde la y enviarla a este email:
\
\
\
'; } var GPSstatus = 0; function setGPS(state) { var request = GXmlHttp.create(); var result = 0; request.open("GET", "../setgps.php?id="+deviceid+"&status="+state+"&RANDOM=."+Math.random(), true); request.onreadystatechange = function() { if (request.readyState == 4) { var xmlDoc = request.responseXML; var markers = xmlDoc.documentElement.getElementsByTagName("marker"); if (markers[0].getAttribute("status") == "ON") { document.getElementById("GPSstatus").innerHTML="ON [OFF]"; window.setTimeout(function(){ refreshMap(map,0)},6000); GPSstatus = 1; result = 1; } else { document.getElementById("GPSstatus").innerHTML="OFF [ON]"; } } } request.send(null); checkiPhone(1); return(result); }