Guest User

Untitled

a guest
Dec 7th, 2024
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.49 KB | None | 0 0
  1. <?php
  2. // Extract parameters from the URL
  3. $redirectUrl = isset($_GET['redirect_to']) ? $_GET['redirect_to'] : 'https://default.url';
  4. $additionalData = isset($_GET['data']) ? $_GET['data'] : '';
  5.  
  6. // Output the HTML with embedded JavaScript
  7. ?>
  8. <!DOCTYPE html>
  9. <html>
  10. <head>
  11.     <title>Redirecting...</title>
  12.     <script>
  13.         // Facebook Pixel or other JavaScript code
  14.         (function() {
  15.             // Example of setting cookies
  16.             document.cookie = "example_cookie=value; path=/; expires=Fri, 31 Dec 2024 23:59:59 GMT";
  17.  
  18.             // Simulate tracking with Facebook Pixel
  19.             console.log("Facebook Pixel code would run here");
  20.  
  21.             // Add any additional JavaScript for tracking or cookies
  22.         })();
  23.  
  24.         // Redirect after a delay (to ensure JavaScript executes)
  25.         setTimeout(function() {
  26.             var redirectUrl = "<?php echo htmlspecialchars($redirectUrl); ?>";
  27.             var additionalData = "<?php echo htmlspecialchars($additionalData); ?>";
  28.  
  29.             // If you need to append data to the redirect URL
  30.             if (additionalData) {
  31.                 redirectUrl += (redirectUrl.includes('?') ? '&' : '?') + "data=" + encodeURIComponent(additionalData);
  32.             }
  33.  
  34.             // Perform the redirection
  35.             window.location.href = redirectUrl;
  36.         }, 2000); // Adjust delay as needed (e.g., 2000ms = 2 seconds)
  37.     </script>
  38. </head>
  39. <body>
  40.     <p>Processing your request... Please wait.</p>
  41. </body>
  42. </html>
  43.  
Advertisement
Add Comment
Please, Sign In to add comment