OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
firebase
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
05/09/2025 11:18:49 AM
rwxr-xr-x
📄
app.js
1.07 KB
08/12/2024 10:32:50 AM
rw-r--r--
📄
composer.json
66 bytes
08/12/2024 10:32:50 AM
rw-r--r--
📄
composer.lock
93.17 KB
08/12/2024 10:32:50 AM
rw-r--r--
📁
config
-
08/12/2024 10:32:51 AM
rwxr-xr-x
📄
db.php
285 bytes
08/12/2024 10:32:50 AM
rw-r--r--
📄
debug.log
0 bytes
08/12/2024 10:32:50 AM
rw-r--r--
📄
firebase-messaging-sw.js
1.08 KB
08/12/2024 10:32:51 AM
rw-r--r--
📄
index.php
2.03 KB
08/12/2024 10:32:51 AM
rw-r--r--
📄
logo.png
49.4 KB
08/12/2024 10:32:51 AM
rw-r--r--
📄
save-token.php
773 bytes
08/12/2024 10:32:51 AM
rw-r--r--
📄
send-notification.php
1.5 KB
08/12/2024 10:32:51 AM
rw-r--r--
📁
vendor
-
08/12/2024 10:33:06 AM
rwxr-xr-x
Editing: index.php
Close
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Firebase Notification Example</title> </head> <body> <h1>Subscribe to Notifications</h1> <button id="subscribeButton">Subscribe</button> <!-- Firebase App (the core Firebase SDK) --> <script type="module"> import { initializeApp } from "https://www.gstatic.com/firebasejs/9.22.1/firebase-app.js"; import { getMessaging, getToken } from "https://www.gstatic.com/firebasejs/9.22.1/firebase-messaging.js"; // Firebase configuration object const firebaseConfig = { apiKey: "AIzaSyAJBznUSMPDjYXxWtZgAcLR5OxtHNl9Afg", authDomain: "push-notification-41dcd.firebaseapp.com", projectId: "push-notification-41dcd", storageBucket: "push-notification-41dcd.appspot.com", messagingSenderId: "449897008446", appId: "1:449897008446:web:9ca467577cba318b3eb06f", measurementId: "G-NRZVFH2Y4T" }; // Initialize Firebase const app = initializeApp(firebaseConfig); const messaging = getMessaging(app); // Function to handle token retrieval and save it async function subscribeUser() { try { const token = await getToken(messaging, { vapidKey: 'BBH31S4UH9FkvWlSB8euuHi9aft10kZ8xOoKXooev14bV7FIxv5n3VKAzGDDKMffaz9rsdNECeMkVB_74xWSEhk' }); console.log('Token:', token); if (token) { // Send the token to your server await fetch('/save-token.php', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ token }), }); } } catch (error) { console.error('Error getting token:', error); } } // Event listener for the subscribe button document.getElementById('subscribeButton').addEventListener('click', subscribeUser); </script> <!-- Include app.js --> <script src="app.js"></script> </body> </html>