-- Veritabanı Yedekleme
-- Tarih: 2026-10-24 03:41:11
-- Veritabanı: silayolu_newapp

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- Tablo yapısı: bottom_menu_items
DROP TABLE IF EXISTS `bottom_menu_items`;
CREATE TABLE `bottom_menu_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(50) NOT NULL,
  `content_id` int(10) unsigned DEFAULT NULL,
  `is_home` tinyint(1) NOT NULL DEFAULT 0,
  `icon_color` varchar(20) DEFAULT NULL,
  `use_white_filter` tinyint(1) NOT NULL DEFAULT 0,
  `image_url` varchar(500) DEFAULT NULL,
  `image_path` varchar(500) DEFAULT NULL,
  `image_url_filled` varchar(500) DEFAULT NULL,
  `image_path_filled` varchar(500) DEFAULT NULL,
  `sort_order` int(10) unsigned NOT NULL DEFAULT 100,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk_bottom_menu_content` (`content_id`),
  CONSTRAINT `fk_bottom_menu_content` FOREIGN KEY (`content_id`) REFERENCES `contents` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_turkish_ci;

-- Tablo verileri: bottom_menu_items
INSERT INTO `bottom_menu_items` (`id`, `title`, `content_id`, `is_home`, `icon_color`, `use_white_filter`, `image_url`, `image_path`, `image_url_filled`, `image_path_filled`, `sort_order`, `created_at`, `updated_at`) VALUES
('1', 'Vinyet', '117', '0', '#ffffff', '0', '', 'uploads/c5b449c6ee6ec47e.svg', '', 'uploads/9ae2ccc98e67ad36.svg', '2', '2025-08-11 15:24:12', '2025-09-04 20:46:49'),
('2', 'Kameralar', '13', '0', '#ffffff', '0', '', 'uploads/ad5b3030e1c5b029.svg', '', 'uploads/6a5a101f2cd5f1e0.svg', '3', '2025-08-11 15:25:29', '2025-09-04 23:11:50'),
('4', 'Home', NULL, '1', '#ffffff', '0', '', 'uploads/2a207e886af018d8.svg', '', 'uploads/d6b61246f662f566.svg', '1', '2025-08-11 15:35:45', '2025-09-03 21:21:59'),
('5', 'Safak Sayar', '103', '0', '#ffffff', '0', '', 'uploads/778ee37e9e7401c6.svg', '', 'uploads/f910ee94406a0e21.svg', '4', '2025-08-11 16:09:34', '2025-09-04 20:46:28'),
('7', 'E-sim', '64', '0', '#ffffff', '0', '', 'uploads/623d2a4d2b05eefc.svg', '', 'uploads/4e8b9b67701e4255.svg', '5', '2025-08-11 16:11:10', '2025-09-04 20:46:46');

-- Tablo yapısı: categories
DROP TABLE IF EXISTS `categories`;
CREATE TABLE `categories` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `parent_id` int(10) unsigned DEFAULT NULL,
  `name` varchar(150) NOT NULL,
  `slug` varchar(160) NOT NULL,
  `note` text DEFAULT NULL,
  `sort_order` int(10) unsigned NOT NULL DEFAULT 100,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `slug` (`slug`),
  KEY `fk_categories_parent` (`parent_id`),
  CONSTRAINT `fk_categories_parent` FOREIGN KEY (`parent_id`) REFERENCES `categories` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_turkish_ci;

-- Tablo verileri: categories
INSERT INTO `categories` (`id`, `parent_id`, `name`, `slug`, `note`, `sort_order`, `created_at`, `updated_at`) VALUES
('1', NULL, 'Ana Menü', 'ana-menu', NULL, '1', '2025-08-10 14:02:02', '2025-08-10 14:02:02');

-- Tablo yapısı: contents
DROP TABLE IF EXISTS `contents`;
CREATE TABLE `contents` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `parent_id` int(10) unsigned DEFAULT NULL,
  `name` varchar(150) NOT NULL,
  `link_url` varchar(500) DEFAULT NULL,
  `open_in_new_tab` tinyint(1) NOT NULL DEFAULT 0,
  `view_mode` tinyint(1) NOT NULL DEFAULT 0,
  `is_sponsor` tinyint(1) NOT NULL DEFAULT 0,
  `sponsor_show_name` tinyint(1) NOT NULL DEFAULT 0,
  `sponsor_card_image_path` varchar(500) DEFAULT NULL,
  `sponsor_logo_path` varchar(500) DEFAULT NULL,
  `sponsor_big_image_path` varchar(500) DEFAULT NULL,
  `sponsor_small_image_path` varchar(500) DEFAULT NULL,
  `sponsor_big_named_image_path` varchar(500) DEFAULT NULL,
  `hide_text` tinyint(1) NOT NULL DEFAULT 0,
  `card_background_color` varchar(20) DEFAULT NULL,
  `card_size` tinyint(1) NOT NULL DEFAULT 0,
  `html_content` mediumtext DEFAULT NULL,
  `image_url` varchar(500) DEFAULT NULL,
  `image_path` varchar(500) DEFAULT NULL,
  `note` text DEFAULT NULL,
  `is_hidden` tinyint(1) NOT NULL DEFAULT 0,
  `is_admin_only` tinyint(1) NOT NULL DEFAULT 0,
  `sort_order` int(10) unsigned NOT NULL DEFAULT 100,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk_contents_parent` (`parent_id`),
  CONSTRAINT `fk_contents_parent` FOREIGN KEY (`parent_id`) REFERENCES `contents` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=131 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_turkish_ci;

-- Tablo verileri: contents
INSERT INTO `contents` (`id`, `parent_id`, `name`, `link_url`, `open_in_new_tab`, `view_mode`, `is_sponsor`, `sponsor_show_name`, `sponsor_card_image_path`, `sponsor_logo_path`, `sponsor_big_image_path`, `sponsor_small_image_path`, `sponsor_big_named_image_path`, `hide_text`, `card_background_color`, `card_size`, `html_content`, `image_url`, `image_path`, `note`, `is_hidden`, `is_admin_only`, `sort_order`, `created_at`, `updated_at`) VALUES
('9', '13', 'Sırbistan', '', '0', '0', '0', '0', NULL, NULL, '', '', '', '0', '', '2', '', 'https://via.placeholder.com/100?text=SRB', 'uploads/722a56ccd3907448.jpg', '', '0', '0', '2', '2025-08-10 14:04:44', '2025-08-30 22:00:55'),
('13', NULL, 'Gümrükler Canlı', '', '0', '0', '0', '0', '', '', '', '', '', '0', '', '1', '', '', 'uploads/658a4d47add18c17.png', '', '0', '0', '1', '2025-08-10 15:23:11', '2025-09-02 18:29:17'),
('15', '13', 'Türkiye', '', '0', '0', '0', '0', NULL, NULL, '', '', '', '0', '', '2', '', '', 'uploads/5722a362e433820c.png', '', '0', '0', '1', '2025-08-10 17:13:07', '2025-08-30 20:29:35'),
('16', '15', 'Kapikule', 'https://go.silayolusevenler.eu/kapikule', '0', '0', '0', '0', NULL, NULL, '', '', '', '1', '', '2', '', '', 'uploads/e3c99a41a0b9ace6.svg', '', '0', '0', '1', '2025-08-10 17:14:10', '2025-08-27 10:23:27'),
('39', '15', 'Pazarkule', 'https://go.silayolusevenler.eu/pazarkule', '0', '0', '0', '0', NULL, NULL, '', '', '', '1', '', '2', '', '', 'uploads/2026bc5023a1194f.svg', '', '0', '0', '4', '2025-08-11 11:08:09', '2025-08-27 10:26:01'),
('41', '15', 'Ipsala', 'https://go.silayolusevenler.eu/ipsala', '0', '0', '0', '0', NULL, NULL, '', '', '', '1', '', '2', '', '', 'uploads/a446b37830120f7b.svg', '', '0', '0', '2', '2025-08-11 11:53:41', '2025-08-27 10:24:46'),
('42', '15', 'Hamzabeyli', 'https://go.silayolusevenler.eu/hamzabeyli', '0', '0', '0', '0', NULL, NULL, '', '', '', '1', '', '2', '', '', 'uploads/a93b02cf38b9e357.svg', '', '0', '0', '3', '2025-08-11 12:14:39', '2025-08-27 10:18:49'),
('43', '15', 'Dereköy', 'https://go.silayolusevenler.eu/derekoy', '0', '0', '0', '0', NULL, NULL, '', '', '', '1', '', '2', '', '', 'uploads/e470221ff1544796.svg', '', '0', '0', '7', '2025-08-11 12:16:06', '2025-08-27 10:28:13'),
('46', NULL, 'Whatsapp Sohbet Grubu', 'https://go.silayolusevenler.eu/185-gun-hesabi', '0', '0', '0', '0', '', '', NULL, NULL, NULL, '0', '', '0', '', '', 'uploads/cff5f83b888b8901.png', '', '0', '0', '16', '2025-08-11 12:38:06', '2025-09-06 13:30:45'),
('47', NULL, 'Sıla Takip', 'https://www.silayolusevenler.nl/appnew/silatakip/harita.php', '0', '0', '0', '0', NULL, NULL, NULL, NULL, NULL, '0', NULL, '0', '', '', 'uploads/933133bb3b1d6d41.png', '', '0', '0', '17', '2025-08-11 12:40:58', '2025-09-06 13:30:45'),
('49', '9', 'Röszke-Horgos', 'https://go.silayolusevenler.eu/Roszke-Horgos', '0', '0', '0', '0', NULL, NULL, NULL, NULL, NULL, '0', NULL, '0', '', '', 'uploads/0e01b2c1aa919dc8.png', '', '0', '0', '1', '2025-08-11 13:31:32', '2025-08-11 14:47:59'),
('50', '9', 'Horgos-Röszke', 'https://go.silayolusevenler.eu/Horgos-Roszke', '0', '0', '0', '0', NULL, NULL, NULL, NULL, NULL, '0', NULL, '0', '', '', 'uploads/6e078478701eb21b.png', '', '0', '0', '2', '2025-08-11 13:32:08', '2025-08-11 14:47:54'),
('52', NULL, 'Acil Yol Yardım', 'https://linktr.ee/silayolusevenler', '0', '0', '0', '0', '', '', '', '', '', '0', '', '1', '', '', 'uploads/c81b6659e9286be8.png', '', '0', '0', '6', '2025-08-16 15:45:16', '2025-09-06 13:29:41'),
('56', NULL, 'Radyo', 'https://go.silayolusevenler.eu/WAyolgrubu', '0', '0', '0', '0', '', '', NULL, NULL, NULL, '0', '', '0', '', '', 'uploads/fcb6412fc893a4bf.png', '', '0', '0', '19', '2025-08-16 20:12:17', '2025-09-06 13:29:09'),
('57', NULL, 'Sıla Takip', 'https://www.silayolusevenler.nl/appnew/silatakip/harita.php', '0', '0', '0', '0', '', '', NULL, NULL, NULL, '0', '', '1', '', '', 'uploads/6fabfa461b3566c9.png', '', '0', '0', '2', '2025-08-16 20:13:05', '2025-09-04 20:49:03'),
('58', '57', 'Türkiye', '', '0', '0', '0', '0', NULL, NULL, NULL, NULL, NULL, '0', NULL, '0', NULL, '', 'uploads/e9ffbc9b4f74025b.png', '', '0', '0', '1', '2025-08-16 20:13:05', '2025-08-16 20:13:05'),
('59', '57', 'Sırbistan', '', '0', '0', '0', '0', NULL, NULL, NULL, NULL, NULL, '0', NULL, '0', '', 'https://via.placeholder.com/100?text=SRB', 'uploads/14727d812539ac81.png', '', '0', '0', '2', '2025-08-16 20:13:05', '2025-08-16 20:13:05'),
('60', NULL, 'AloSim', 'https://go.silayolusevenler.eu/e-sim', '0', '0', '1', '0', 'uploads/41eae0f9e254c7aa.png', 'uploads/1847ebb923d04086.png', 'uploads/2e33fc44a37ce860.jpg', 'uploads/1847ebb923d04086.png', 'uploads/41eae0f9e254c7aa.png', '0', '', '1', '', '', 'uploads/3214ff900a0d1b03.png', '', '0', '0', '4', '2025-08-16 20:13:07', '2026-10-24 05:39:57'),
('61', '60', 'Türkiye', '', '0', '0', '0', '0', NULL, NULL, NULL, NULL, NULL, '0', NULL, '0', NULL, '', 'uploads/e9ffbc9b4f74025b.png', '', '0', '0', '2', '2025-08-16 20:13:07', '2025-08-17 00:01:32'),
('62', '60', 'Sırbistan', '', '0', '0', '0', '0', NULL, NULL, NULL, NULL, NULL, '0', NULL, '0', '', 'https://via.placeholder.com/100?text=SRB', 'uploads/14727d812539ac81.png', '', '0', '0', '1', '2025-08-16 20:13:07', '2025-08-17 00:01:29'),
('63', NULL, 'HUD', '', '0', '0', '0', '0', '', '', '', '', '', '0', '', '0', '<!doctype html>
<html lang=\"tr\">
<head>
<meta charset=\"utf-8\" />
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, viewport-fit=cover\" />
<title>HUD Speedometer (KM/H)</title>
<style>
  :root{ --fg:#fff; --muted:#bfbfbf; --accent:#ff3b30; --bg:#000; }
  html,body{height:100%;margin:0;background:var(--bg);color:var(--fg);font-family: -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, \"Helvetica Neue\", Arial, system-ui, sans-serif;}
  #rotator{ position:fixed; inset:0; z-index:0; }
  .wrap{position:absolute; inset:0; display:flex; flex-direction:column; justify-content:space-between; padding: env(safe-area-inset-top) 24px env(safe-area-inset-bottom) 24px;}
  .mirrored{ transform: scaleX(-1); }
  .topbar, .bottombar{display:flex; align-items:center; justify-content:space-between;}
  .time{font-size: clamp(22px,4vw,36px); letter-spacing:1px; opacity:.95}
  .battery{font-size: clamp(20px,3.6vw,32px); display:flex; gap:.35em; align-items:center; opacity:.95}
  .bolt{font-weight:700;}
  .units{ text-align:center; font-size: clamp(18px,3.2vw,28px); color:var(--accent); letter-spacing:2px; margin-top:6px;}
  .speed{ text-align:center; font-weight:700; font-size: clamp(140px, 26vw, 420px); line-height:1; letter-spacing:.02em; text-shadow: 0 0 18px rgba(255,255,255,.15); }
  .stats{display:grid; grid-template-columns: repeat(4,1fr); gap: 8px 10px; align-items:end;}
  .label{ color:var(--muted); font-size: clamp(16px,2.8vw,26px); }
  .value{ font-size: clamp(28px,4.4vw,40px); font-weight:700; }
  .value .unit{ color:var(--accent); margin-left:.25em; letter-spacing:1px; font-weight:700;}
  .footer{height:5px; border-radius:4px; background:rgba(255,255,255,.12); overflow:hidden;}
  .gpsbar{height:100%; width:0%; background:linear-gradient(90deg, #aaa, #0f0); transition:width .3s;}
  /* SOL TARAFTA DİKEY BUTONLAR */
  .controls{
    position:fixed; left:10px; top:50%; transform:translateY(-50%);
    display:flex; flex-direction:column; gap:10px;
    z-index:9999;
  }
  button{
    background:#111; color:#fff; border:1px solid #333; padding:10px 14px; border-radius:12px;
    font-size:14px; letter-spacing:.3px; touch-action: manipulation;
    width:90px;
  }
  button:active{transform:scale(.98)}
  .hint{position:fixed; left:50%; bottom:10px; transform:translateX(-50%); font-size:12px; color:#aaa; opacity:.85; text-align:center;}
</style>
</head>
<body>
  <div id=\"rotator\">
    <div id=\"hud\" class=\"wrap mirrored\">
      <div class=\"topbar\">
        <div id=\"clock\" class=\"time\">00:00</div>
        <div class=\"units\">KM/H</div>
        <div class=\"battery\"><span class=\"bolt\">⚡</span><span id=\"bat\">--%</span></div>
      </div>

      <div class=\"speed\" id=\"speed\">0</div>

      <div class=\"bottombar\">
        <div class=\"stats\" style=\"width:100%\">
          <div>
            <div class=\"label\">Avg</div>
            <div class=\"value\"><span id=\"avg\">0</span><span class=\"unit\">KM/H</span></div>
          </div>
          <div>
            <div class=\"label\">Top</div>
            <div class=\"value\"><span id=\"top\">0</span><span class=\"unit\">KM/H</span></div>
          </div>
          <div>
            <div class=\"label\">Alt</div>
            <div class=\"value\"><span id=\"alt\">--</span><span class=\"unit\">M</span></div>
          </div>
          <div>
            <div class=\"label\">Dist</div>
            <div class=\"value\"><span id=\"dist\">0.00</span><span class=\"unit\">KM</span></div>
          </div>
        </div>
      </div>
      <div class=\"footer\"><div id=\"gpsbar\" class=\"gpsbar\"></div></div>
    </div>
  </div>

  <!-- SOLDA DİKEY BUTONLAR -->
  <div class=\"controls\">
    <button id=\"startBtn\">Başlat</button>
    <button id=\"mirrorBtn\">Ayna</button>
    <button id=\"resetBtn\">Sıfırla</button>
  </div>
  <div class=\"hint\" id=\"hint\"></div>

<script>
(() => {
  const el = id => document.getElementById(id);
  const pad2 = n => n.toString().padStart(2, \'0\');
  const toKmh = ms => (ms*3.6);
  const haversine = (a,b) => {
    const R=6371000;
    const toRad = d=>d*Math.PI/180;
    const dLat = toRad(b.lat-a.lat);
    const dLon = toRad(b.lon-a.lon);
    const lat1 = toRad(a.lat), lat2 = toRad(b.lat);
    const h = Math.sin(dLat/2)**2 + Math.cos(lat1)*Math.cos(lat2)*Math.sin(dLon/2)**2;
    return 2*R*Math.asin(Math.sqrt(h));
  };

  const hud = el(\'hud\');
  const speedEl = el(\'speed\'), avgEl = el(\'avg\'), topEl = el(\'top\'), altEl = el(\'alt\'), distEl = el(\'dist\');
  const clockEl = el(\'clock\'), batEl = el(\'bat\'), gpsbar = el(\'gpsbar\');
  const startBtn = el(\'startBtn\'), mirrorBtn = el(\'mirrorBtn\'), resetBtn = el(\'resetBtn\');
  const hint = el(\'hint\');

  let watchId = null, wakeLock = null;
  let lastFix = null;
  let tripDistM = 0;
  let startTime = null;
  let topSpeed = 0;
  let displaySpeed = 0;

  function tickClock(){
    const d = new Date();
    clockEl.textContent = `${pad2(d.getHours())}:${pad2(d.getMinutes())}`;
    requestAnimationFrame(tickClock);
  }

  if (location.protocol !== \'https:\' && location.protocol !== \'file:\') {
    hint.textContent = \'Not: GPS için HTTPS gerekir. Dosyayı https ile açın.\';
  }

  if (navigator.getBattery) {
    navigator.getBattery().then(b => {
      const update=()=> batEl.textContent = Math.round(b.level*100) + (b.charging? \'%⚡\':\'%\');
      update();
      [\'levelchange\',\'chargingchange\'].forEach(ev=> b.addEventListener(ev, update));
    }).catch(()=>{});
  }

  async function keepAwake(){
    try { if (\'wakeLock\' in navigator) { wakeLock = await navigator.wakeLock.request(\'screen\'); } }
    catch(e){}
  }

  async function goFullscreen(){
    const root = document.documentElement;
    try {
      if (root.requestFullscreen) { await root.requestFullscreen(); }
      else if (root.webkitRequestFullscreen) { await root.webkitRequestFullscreen(); }
      else if (root.msRequestFullscreen) { await root.msRequestFullscreen(); }
    } catch(e){ console.warn(\'Fullscreen error\', e); }
    try {
      if (screen.orientation && screen.orientation.lock) {
        await screen.orientation.lock(\'landscape\').catch(()=>{});
      }
    } catch(e){}
  }

  function startGPS(){
    if (!(\'geolocation\' in navigator)) { alert(\'Cihaz konumu desteklemiyor.\'); return; }
    startTime = Date.now();
    watchId = navigator.geolocation.watchPosition(onFix, onGeoError, {
      enableHighAccuracy:true, maximumAge:0, timeout:15000
    });
  }

  function onGeoError(err){
    console.warn(err);
    gpsbar.style.width = \'5%\';
  }

  function onFix(pos){
    const c = pos.coords;
    const acc = Math.min(Math.max(c.accuracy || 100, 5), 100);
    const quality = Math.max(0, 100 - (acc));
    gpsbar.style.width = `${quality}%`;

    let spdMs = (c.speed != null && !isNaN(c.speed)) ? c.speed : null;

    const nowPoint = {lat:c.latitude, lon:c.longitude, t:pos.timestamp};
    if (lastFix){
      const dt = (nowPoint.t - lastFix.t)/1000;
      if (dt > 0.5 && dt < 60){
        const d = haversine({lat:lastFix.lat, lon:lastFix.lon}, nowPoint);
        if ((c.accuracy||100) < 60) tripDistM += d;
        if (spdMs == null) spdMs = d / dt;
      }
    }
    lastFix = nowPoint;

    if (c.altitude != null) altEl.textContent = Math.round(c.altitude);
    else altEl.textContent = \'--\';

    const targetKmh = Math.max(0, toKmh(spdMs || 0));
    displaySpeed = displaySpeed + (targetKmh - displaySpeed) * 0.25;
    speedEl.textContent = Math.round(displaySpeed);

    if (targetKmh > topSpeed) { topSpeed = targetKmh; topEl.textContent = Math.round(topSpeed); }

    const elapsedH = (Date.now() - startTime)/3600000;
    const avg = elapsedH > 0 ? (tripDistM/1000)/elapsedH : 0;
    avgEl.textContent = Math.round(avg);

    distEl.textContent = (tripDistM/1000).toFixed(2);
  }

  startBtn.addEventListener(\'click\', async () => {
    await goFullscreen();
    await keepAwake();
    startGPS();
    startBtn.disabled = true;
    const retry = async () => { await goFullscreen(); document.removeEventListener(\'touchend\', retry); };
    document.addEventListener(\'touchend\', retry, { once:true });
  });

  mirrorBtn.addEventListener(\'click\', () => {
    hud.classList.toggle(\'mirrored\');
  });

  resetBtn.addEventListener(\'click\', () => {
    tripDistM = 0; topSpeed = 0; startTime = Date.now();
    topEl.textContent = \'0\'; avgEl.textContent = \'0\'; distEl.textContent = \'0.00\';
  });

  tickClock();
})();
</script>
</body>
</html>
', '', 'uploads/d552546e4a78faa6.png', '', '0', '0', '14', '2025-08-16 23:58:45', '2025-09-06 14:38:32'),
('64', NULL, 'E-SIM', 'https://go.silayolusevenler.eu/e-sim-menu', '0', '0', '0', '0', '', '', '', '', '', '0', '', '0', '', '', 'uploads/3c69aaa057b4c420.png', '', '0', '0', '12', '2025-08-17 17:05:24', '2025-09-06 13:30:37'),
('66', NULL, 'Vinyet', 'https://go.silayolusevenler.eu/e-sim', '0', '0', '0', '0', '', '', '', '', '', '0', '', '1', '', '', 'uploads/5bfc06f979c686e1.png', '', '0', '0', '15', '2025-08-17 18:36:05', '2025-09-06 13:30:45'),
('72', NULL, 'Yol Üstü', '', '0', '0', '0', '0', '', '', '', '', '', '0', '', '1', '<!DOCTYPE html>
<html>
<head>
  <meta http-equiv=\"refresh\" content=\"0; URL=\'https://go.silayolusevenler.eu/POI\'\" />
  <title>Yönlendiriliyor...</title>
</head>
<body>
  <p>Eğer otomatik olarak yönlendirilmediyseniz, <a href=\"https://go.silayolusevenler.eu/POI\">buraya tıklayın</a>.</p>
</body>
</html>', '', 'uploads/1b44de8998dc9a38.png', '', '0', '0', '7', '2025-08-19 01:07:18', '2025-09-06 13:29:41'),
('75', '13', 'Kamera Haritasi', 'https://go.silayolusevenler.eu/haritakamera', '0', '0', '0', '0', '', '', '', '', '', '0', '', '6', '', '', 'uploads/d27f2a5130065990.png', '', '0', '0', '8', '2025-08-23 09:09:13', '2025-09-04 20:44:19'),
('76', '13', 'Macaristan', '', '0', '0', '0', '0', NULL, NULL, '', '', '', '0', '', '0', '', '', 'uploads/463f7efa929943bf.png', '', '0', '0', '4', '2025-08-23 09:33:10', '2025-08-30 22:00:57'),
('77', '13', 'Hırvatistan', '', '0', '0', '0', '0', NULL, NULL, '', '', '', '0', '', '0', '', '', 'uploads/f18bd4903f6abec7.png', '', '0', '0', '3', '2025-08-23 09:37:19', '2025-08-30 22:00:57'),
('78', '13', 'Slovenya', '', '0', '0', '0', '0', NULL, NULL, NULL, NULL, NULL, '0', NULL, '0', '', '', 'uploads/0f21c53fe7b23fcc.png', '', '0', '0', '5', '2025-08-23 09:39:51', '2025-08-30 22:00:57'),
('79', '13', 'Kuzey Makedonya', '', '0', '0', '0', '0', NULL, NULL, NULL, NULL, NULL, '0', NULL, '0', '', '', 'uploads/db2f1e7fe870409e.png', '', '0', '0', '6', '2025-08-23 09:41:14', '2025-08-30 22:00:57'),
('80', '9', 'Tompa-Kelebija', 'https://go.silayolusevenler.eu/Horgos-Roszke', '0', '0', '0', '0', NULL, NULL, NULL, NULL, NULL, '0', NULL, '0', '', '', 'uploads/6e078478701eb21b.png', '', '0', '0', '2', '2025-08-23 09:44:55', '2025-08-23 09:45:50'),
('81', '9', 'Kelebija-Tompa', 'https://go.silayolusevenler.eu/Horgos-Roszke', '0', '0', '0', '0', NULL, NULL, NULL, NULL, NULL, '0', NULL, '0', '', '', 'uploads/6e078478701eb21b.png', '', '0', '0', '2', '2025-08-23 09:44:57', '2025-08-23 09:45:59'),
('82', '9', 'Tiszasziget-Dala', 'https://go.silayolusevenler.eu/Horgos-Roszke', '0', '0', '0', '0', NULL, NULL, NULL, NULL, NULL, '0', NULL, '0', '', '', 'uploads/6e078478701eb21b.png', '', '0', '0', '2', '2025-08-23 09:45:00', '2025-08-23 09:46:11'),
('83', '9', 'Dala-Tiszasziget', 'https://go.silayolusevenler.eu/Horgos-Roszke', '0', '0', '0', '0', NULL, NULL, NULL, NULL, NULL, '0', NULL, '0', '', '', 'uploads/6e078478701eb21b.png', '', '0', '0', '2', '2025-08-23 09:45:01', '2025-08-23 09:46:41'),
('84', '9', 'Bajakovo-Batrovci', 'https://go.silayolusevenler.eu/Horgos-Roszke', '0', '0', '0', '0', NULL, NULL, NULL, NULL, NULL, '0', NULL, '0', '', '', 'uploads/6e078478701eb21b.png', '', '0', '0', '2', '2025-08-23 09:45:03', '2025-08-23 09:47:00'),
('85', '9', 'Batrovci-Bajakovo', 'https://go.silayolusevenler.eu/Horgos-Roszke', '0', '0', '0', '0', NULL, NULL, NULL, NULL, NULL, '0', NULL, '0', '', '', 'uploads/6e078478701eb21b.png', '', '0', '0', '2', '2025-08-23 09:45:04', '2025-08-23 09:47:12'),
('86', '9', 'Tovarnik-Sid', 'https://go.silayolusevenler.eu/Horgos-Roszke', '0', '0', '0', '0', NULL, NULL, NULL, NULL, NULL, '0', NULL, '0', '', '', 'uploads/6e078478701eb21b.png', '', '0', '0', '2', '2025-08-23 09:45:06', '2025-08-23 09:47:31'),
('87', '9', 'Sid-Tovarnik', 'https://go.silayolusevenler.eu/Horgos-Roszke', '0', '0', '0', '0', NULL, NULL, NULL, NULL, NULL, '0', NULL, '0', '', '', 'uploads/6e078478701eb21b.png', '', '0', '0', '2', '2025-08-23 09:45:07', '2025-08-23 09:47:38'),
('88', '9', 'Kalotina-Gradina', 'https://go.silayolusevenler.eu/Horgos-Roszke', '0', '0', '0', '0', NULL, NULL, NULL, NULL, NULL, '0', NULL, '0', '', '', 'uploads/6e078478701eb21b.png', '', '0', '0', '2', '2025-08-23 09:45:09', '2025-08-23 09:47:58'),
('89', '9', 'Gradina-Kalotina', 'https://go.silayolusevenler.eu/Horgos-Roszke', '0', '0', '0', '0', NULL, NULL, NULL, NULL, NULL, '0', NULL, '0', '', '', 'uploads/6e078478701eb21b.png', '', '0', '0', '2', '2025-08-23 09:45:10', '2025-08-23 09:48:07'),
('90', '9', 'Vrashka Chuka-Vrška Čuka', 'https://go.silayolusevenler.eu/Horgos-Roszke', '0', '0', '0', '0', NULL, NULL, NULL, NULL, NULL, '0', NULL, '0', '', '', 'uploads/6e078478701eb21b.png', '', '0', '0', '2', '2025-08-23 09:45:12', '2025-08-23 09:48:48'),
('91', '9', 'Vrška Čuka-Vrashka Chuka', 'https://go.silayolusevenler.eu/Horgos-Roszke', '0', '0', '0', '0', NULL, NULL, NULL, NULL, NULL, '0', NULL, '0', '', '', 'uploads/6e078478701eb21b.png', '', '0', '0', '2', '2025-08-23 09:45:13', '2025-08-23 09:48:40'),
('92', '9', 'Tabanovtse-Presovo', 'https://go.silayolusevenler.eu/Horgos-Roszke', '0', '0', '0', '0', NULL, NULL, NULL, NULL, NULL, '0', NULL, '0', '', '', 'uploads/6e078478701eb21b.png', '', '0', '0', '2', '2025-08-23 09:48:58', '2025-08-23 09:49:22'),
('93', '9', 'Presevo-Tabanovtse', 'https://go.silayolusevenler.eu/Horgos-Roszke', '0', '0', '0', '0', NULL, NULL, NULL, NULL, NULL, '0', NULL, '0', '', '', 'uploads/6e078478701eb21b.png', '', '0', '0', '2', '2025-08-23 09:49:01', '2025-08-23 09:49:37'),
('98', NULL, 'Exotoll', 'https://go.silayolusevenler.eu/exotoll', '0', '0', '1', '0', 'uploads/fdc3ebe6ee766da8.png', 'uploads/e9a84da76b03e479.png', '', '', '', '0', '', '1', '', '', 'uploads/5e2eeda569c5cbee.png', '', '0', '0', '3', '2025-08-23 13:46:07', '2025-09-01 23:45:11'),
('103', NULL, 'Şafak Sayar', 'https://www.silayolusevenler.nl/apptrae/safaksayar/index.php', '0', '0', '0', '0', '', '', '', '', '', '0', '', '0', '', '', 'uploads/67284420fe5aa6b5.png', '', '0', '0', '9', '2025-08-27 20:27:23', '2025-09-06 21:59:20'),
('106', NULL, 'Tam Ekran Kart', 'https://go.silayolusevenler.eu/WAyolgrubu', '0', '0', '0', '0', '', '', '', '', '', '1', '', '5', '', '', 'uploads/d6b61246f662f566.svg', '', '1', '0', '17', '2025-08-30 14:07:50', '2025-09-04 15:59:30'),
('111', NULL, 'Leaderbord', 'https://go.silayolusevenler.eu/WAyolgrubu', '0', '0', '0', '0', '', '', NULL, NULL, NULL, '1', '', '7', '', '', 'uploads/32a8523cce5baf4b.png', '', '0', '0', '21', '2025-08-31 16:55:20', '2025-09-04 19:33:21'),
('112', '13', 'Leaderbord - Kopya', 'https://go.silayolusevenler.eu/WAyolgrubu', '0', '0', '0', '0', '', '', NULL, NULL, NULL, '1', '', '7', '', '', 'uploads/32a8523cce5baf4b.png', '', '0', '0', '9', '2025-08-31 17:05:19', '2025-09-04 20:44:43'),
('114', '13', 'Saat', '', '0', '0', '0', '0', '', '', NULL, NULL, NULL, '0', '', '8', '<!doctype html>
<html lang=\"tr\">
<head>
<meta charset=\"utf-8\" />
<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\" />
<title>EV İstasyonları – Sade ve Stabil</title>

<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.css\" />
<style>
  html, body { height:100%; margin:0; font:14px system-ui,-apple-system,Segoe UI,Roboto,Arial; }
  #map { height:100vh; width:100%; }

  .panel, .counter {
    position:absolute; z-index:1000; background:rgba(255,255,255,.95);
    padding:8px 10px; border-radius:8px; box-shadow:0 2px 10px rgba(0,0,0,.12);
  }
  .panel  { top:10px; left:10px; }
  .counter{ top:10px; right:10px; }

  .btn { cursor:pointer; padding:6px 10px; border-radius:6px; border:1px solid #ddd; background:#fafafa; }
  .muted { color:#777; }

  /* Pin stilleri */
  .pin { position:relative; width:24px; height:24px; border:2px solid #fff; box-shadow:0 0 0 2px rgba(0,0,0,.15); }
  .pin-ac{border-radius:50%}        /* AC: daire */
  .pin-dc{transform:rotate(45deg)}  /* DC: elmas */
  .pin-both{border-radius:50%}      /* AC+DC: daire + çapraz */
  .pin-both::before,.pin-both::after{content:\"\";position:absolute;background:#fff;top:50%;left:0;width:100%;height:2px}
  .pin-both::before{transform:translateY(-50%) rotate(45deg)}
  .pin-both::after {transform:translateY(-50%) rotate(-45deg)}

  /* Renkler (availability\'e göre) */
  .green{background:#2ecc71}  /* hepsi boş */
  .orange{background:#f39c12} /* karışık */
  .red{background:#e74c3c}    /* boş yok */
  .grey{background:#95a5a6}   /* availability verisi yok/çekilmedi */

  .pin-label{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:9px;font-weight:700;color:#000}
  .pin-dc .pin-label{transform:rotate(-45deg)}
</style>
</head>
<body>
  <div id=\"map\"></div>

  <div class=\"panel\">
    <b>20 km içinde EV istasyonları</b><br>
    <div class=\"muted\" id=\"status\">Hazır.</div>
    <div style=\"margin-top:6px\">
      <button id=\"btnLoad\" class=\"btn\">Yakındakileri getir (1 non-tile)</button>
      <span class=\"muted\">— harita merkezine göre</span>
    </div>
  </div>

  <div class=\"counter\">
    <b>Çağrı sayacı</b><br>
    TomTom <code>non-tile</code>: <span id=\"ctNonTile\">0</span>
  </div>

  <script src=\"https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.js\"></script>
  <script>
    // --- Ayarlar ---
    const TOMTOM_KEY = \"uktyGAGT5RUlbNeg0NSqN4wU4qp0VdYj\";
    const RADIUS_M = 20000; // 20 km
    const DEFAULT_CENTER = { lat: 41.01, lon: 28.97 };

    // --- Harita ---
    const map = L.map(\'map\').setView([DEFAULT_CENTER.lat, DEFAULT_CENTER.lon], 12);
    L.tileLayer(\'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png\',
      { maxZoom: 19, attribution: \'&copy; OpenStreetMap contributors\' }
    ).addTo(map);

    const statusEl = document.getElementById(\'status\');
    const btnLoad = document.getElementById(\'btnLoad\');
    const ctNonTile = document.getElementById(\'ctNonTile\');
    let nonTileCount = 0;
    const incNonTile = () => { nonTileCount++; ctNonTile.textContent = nonTileCount; };

    const drawn = new Map(); // id -> marker (tekrar çizmemek için)

    function setStatus(t){ statusEl.textContent = t; }

    // --- Yardımcılar ---
    function stationType(item){
      const conns = item.chargingPark?.connectors || [];
      const hasAC = conns.some(c => (c.currentType||\'\').toUpperCase()===\'AC\');
      const hasDC = conns.some(c => (c.currentType||\'\').toUpperCase()===\'DC\');
      if (hasAC && hasDC) return \'BOTH\';
      if (hasDC) return \'DC\';
      return \'AC\';
    }
    function makeDivIcon(type, color){
      const el = document.createElement(\'div\');
      el.className = `pin ${color} ` + (type===\'AC\'?\'pin-ac\':type===\'DC\'?\'pin-dc\':\'pin-both\');
      const lbl = document.createElement(\'div\'); lbl.className=\'pin-label\'; lbl.textContent=(type===\'BOTH\'?\'A+D\':type);
      el.appendChild(lbl);
      return L.divIcon({ className:\'\', html: el, iconSize:[24,24], iconAnchor:[12,12] });
    }
    function connectorsHtml(item){
      const list = item.chargingPark?.connectors || [];
      if (!list.length) return \'<em>Soket verisi yok</em>\';
      return \'<ul style=\"padding-left:16px;margin:6px 0 0;\">\' +
        list.slice(0,12).map(c =>
          `<li>${c.connectorType||\'-\'} — ${c.currentType||\'-\'} ${c.ratedPowerKW? c.ratedPowerKW + \' kW\' : \'\'}</li>`
        ).join(\'\') + \'</ul>\';
    }
    function availabilityHtml(av){
      if (!av || !av.connectors || !av.connectors.length) return \'<em>Müsaitlik verisi yok</em>\';
      return \'<ul style=\"padding-left:16px;margin:6px 0 0;\">\' +
        av.connectors.map(c => {
          const cur = c.availability?.current || {};
          return `<li>${c.type} — Boş:${cur.available||0} • Dolu:${cur.occupied||0}</li>`;
        }).join(\'\') + \'</ul>\';
    }
    function availabilitySummary(av){
      if (!av || !Array.isArray(av.connectors)) return {a:null,o:null};
      let a=0,o=0; av.connectors.forEach(c => { const cur=c.availability?.current||{}; a+=(cur.available||0); o+=(cur.occupied||0); });
      return {a,o};
    }
    const statusColor = ({a,o}) => (a===null||o===null)?\'grey\' : (a===0?\'red\' : (o===0 && a>0?\'green\':\'orange\'));

    // --- TomTom çağrıları ---
    async function fetchStations(lat, lon){
      incNonTile(); // 1 non-tile
      const params = new URLSearchParams({ key: TOMTOM_KEY, lat, lon, radius: RADIUS_M, limit: 100, categorySet: \'7309\' });
      const url = `https://api.tomtom.com/search/2/nearbySearch/.json?${params.toString()}`;
      const res = await fetch(url);
      if (!res.ok) throw new Error(\'nearbySearch hata: \' + res.status);
      const data = await res.json();
      return data.results || [];
    }
    async function fetchAvailability(id){
      if (!id) return null;
      incNonTile(); // 1 non-tile
      const url = `https://api.tomtom.com/search/2/chargingAvailability.json?key=${TOMTOM_KEY}&chargingAvailability=${encodeURIComponent(id)}`;
      const res = await fetch(url);
      return res.ok ? res.json() : null;
    }

    // --- Çizim ---
    async function loadNearby(){
      const c = map.getCenter();
      setStatus(\'İstasyonlar yükleniyor… (1 non-tile)\');
      btnLoad.disabled = true;

      let results = [];
      try {
        results = await fetchStations(c.lat, c.lng);
      } catch(e) {
        setStatus(\'Hata: \' + e.message);
        btnLoad.disabled = false;
        return;
      }

      if (!results.length){
        setStatus(\'Bu bölgede istasyon bulunamadı.\');
        btnLoad.disabled = false;
        return;
      }

      setStatus(`${results.length} istasyon bulundu. Pinlere tıklayın.`);
      results.forEach((item, idx) => {
        const pos = item.position; if (!pos) return;
        const id = (item.id || item.poi?.id) ?? `${pos.lat},${pos.lon},${idx}`;
        if (drawn.has(id)) return; // aynı istasyonu tekrar çizme

        const typ = stationType(item);
        const marker = L.marker([pos.lat, pos.lon], { icon: makeDivIcon(typ, \'grey\') }).addTo(map);
        drawn.set(id, marker);

        const name = item.poi?.name || \'EV İstasyonu\';
        const addr = item.address?.freeformAddress || \'\';
        const dsId = item.dataSources?.chargingAvailability?.id;

        marker.bindPopup(
          `<b>${name}</b><br>${addr}<br>` +
          `<div><small><b>Soketler</b></small>${connectorsHtml(item)}</div>` +
          `<div style=\"margin-top:6px\"><small><b>Müsaitlik</b></small><div id=\"av-${id}\"><em>Henüz çekilmedi</em></div>` +
          (dsId ? `<button class=\"btn\" data-dsid=\"${dsId}\" data-id=\"${id}\" style=\"margin-top:6px\">Müsaitliği getir (1 non-tile)</button>` :
                  `<div class=\"muted\" style=\"margin-top:6px\">Bu istasyonda availability kaynağı yok</div>`) +
          `</div>`
        );

        marker.on(\'popupopen\', (e)=>{
          const root = e.popup.getElement();
          const btn  = root.querySelector(\\`button[data-id=\"\\${CSS.escape(id)}\"]\\`);
          const avDiv= root.querySelector(\\`#av-\\${CSS.escape(id)}\\`);
          if (!btn || !avDiv) return;

          btn.onclick = async ()=>{
            btn.disabled = true; avDiv.innerHTML = \'<em>Yükleniyor…</em>\';
            const av = await fetchAvailability(btn.dataset.dsid);
            avDiv.innerHTML = availabilityHtml(av);
            const color = statusColor(availabilitySummary(av));
            marker.setIcon(makeDivIcon(typ, color));
            setTimeout(()=> btn.disabled=false, 1500);
          };
        });
      });

      btnLoad.disabled = false;
    }

    // --- Başlat ---
    btnLoad.onclick = loadNearby;

    // İsterseniz başlangıçta otomatik bir kez de çalıştırabilirsiniz:
    if (navigator.geolocation) {
      navigator.geolocation.getCurrentPosition(
        (pos)=> map.setView([pos.coords.latitude, pos.coords.longitude], 12),
        ()=>{},
        { enableHighAccuracy:true, timeout:8000 }
      );
    }
  </script>
</body>
</html>', '', '', '', '1', '0', '7', '2025-08-31 18:47:02', '2025-09-04 20:43:54'),
('115', NULL, 'Saat - Kopya', '', '0', '0', '0', '0', '', '', NULL, NULL, NULL, '1', '', '8', '<!DOCTYPE html>
<html lang=\"tr\">
<head>
  <meta charset=\"utf-8\" />
  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />
  <title>Mobil Analog Saat</title>
  <style>
    :root{
      --bg: #0f1222;
      --bg-accent: #1b1f3b;
      --face: #121528;
      --face-inner: #0c0f20;
      --ring: #2b3160;
      --tick: #e8ecff;
      --tick-strong: #b8c2ff;
      --hand-hour: #ffffff;
      --hand-minute: #dfe6ff;
      --hand-second: #ff2b2b; /* saniye kırmızı */
      --accent: #7aa5ff;
      --text: #e8ecff;
      --muted: #b4badd;
    }

    *{box-sizing:border-box; margin:0; padding:0;}
    html,body{height:100%;}
    body{
      margin:0;
      font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, \"Noto Sans\", \"Apple Color Emoji\", \"Segoe UI Emoji\";
      color:var(--text);
      background:
        radial-gradient(1200px 800px at 80% -20%, #26306b 0%, transparent 60%),
        radial-gradient(800px 600px at -10% 110%, #1b2558 0%, transparent 60%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-accent) 100%);
      min-height:100dvh;
      display:flex; align-items:center; justify-content:center;
      overflow:hidden; /* taşma gizle */
    }

    /* Kare sahne: en ve boyun küçüğü kadar */
    .card{
      width:min(100dvw, 100dvh);
      height:min(100dvw, 100dvh);
      display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px;
      background:transparent;
    }

    .clock{
      position:relative;
      width:calc(min(100dvw, 100dvh) - 72px);
      aspect-ratio:1/1;           /* daima tam daire */
      border-radius:50%;
      display:grid; place-items:center;
      background: radial-gradient(120% 120% at 30% 25%, #1a1f44 0%, var(--face) 45%, var(--face-inner) 85%);
      box-shadow: inset 0 0 0 2px rgba(255,255,255,0.02), inset 0 20px 60px rgba(0,0,0,0.6), 0 10px 30px rgba(0,0,0,0.35);
      overflow:hidden;
    }

    .clock::before{
      content:\"\"; position:absolute; inset:6%; border-radius:50%;
      box-shadow: inset 0 0 0 2px var(--ring), inset 0 0 60px rgba(122,165,255,0.08);
    }

    .ticks{
      position:absolute; inset:8%; border-radius:50%;
      background:
        repeating-conic-gradient(from -90deg, var(--tick-strong) 0deg 1.4deg, transparent 1.4deg 30deg),
        repeating-conic-gradient(from -90deg, var(--tick) 0deg 0.6deg, transparent 0.6deg 6deg);
      -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 18px), #000 0);
              mask: radial-gradient(farthest-side, transparent calc(100% - 18px), #000 0);
      opacity:0.9;
    }

    .cap{ position:absolute; width:16px; height:16px; border-radius:50%; background:var(--accent);
      box-shadow: 0 0 0 3px #fff2, 0 0 18px rgba(122,165,255,0.6); left:50%; top:50%; transform:translate(-50%,-50%); z-index:3;}

    .hand{ position:absolute; bottom:50%; left:50%; transform-origin:50% 100%; transform:translateX(-50%) rotate(var(--rot, 0deg)); border-radius:999px;}
    .hand.hour{ width:8px; height:27%; background:linear-gradient(#ffffff, #cfd7ff); z-index:2;}
    .hand.minute{ width:6px; height:38%; background:linear-gradient(#e7edff, #bcc7ff); z-index:2;}
    .hand.second{ width:2px; height:44%; background:var(--hand-second); z-index:2;}

    .center-disc{ position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); width:52px; height:52px; border-radius:50%;
      background: linear-gradient(180deg, #1b2148, #0f132d); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), 0 2px 10px rgba(0,0,0,0.35); z-index:1;}

    .date{ margin:0; text-align:center; font-size:clamp(14px, 3.6vw, 16px); letter-spacing:0.2px; color:var(--muted);}
  </style>
</head>
<body>
  <div class=\"card\">
    <div class=\"clock\" aria-label=\"Analog saat\">
      <div class=\"ticks\" aria-hidden=\"true\"></div>
      <div class=\"hand hour\"  id=\"hour\"></div>
      <div class=\"hand minute\" id=\"minute\"></div>
      <div class=\"hand second\" id=\"second\" aria-hidden=\"true\"></div>
      <div class=\"center-disc\" aria-hidden=\"true\"></div>
      <div class=\"cap\" aria-hidden=\"true\"></div>
    </div>
    <div class=\"date\" id=\"date\" aria-live=\"polite\"></div>
  </div>

  <script>
    (function(){
      const hourEl = document.getElementById(\'hour\');
      const minuteEl = document.getElementById(\'minute\');
      const secondEl = document.getElementById(\'second\');
      const dateEl = document.getElementById(\'date\');

      function setDateText(d){
        dateEl.textContent = d.toLocaleDateString(\'tr-TR\', {
          weekday: \'long\', year: \'numeric\', month: \'long\', day: \'numeric\'
        });
      }

      function render(){
        const now = new Date();
        const ms = now.getMilliseconds();
        const s  = now.getSeconds() + ms/1000;
        const m  = now.getMinutes() + s/60;
        const h  = (now.getHours() % 12) + m/60;

        hourEl.style.setProperty(\'--rot\', (h * 30) + \'deg\');
        minuteEl.style.setProperty(\'--rot\', (m * 6) + \'deg\');
        secondEl.style.setProperty(\'--rot\', (s * 6) + \'deg\');

        setDateText(now);
        requestAnimationFrame(render);
      }

      render();
    })();
  </script>
</body>
</html>
', '', 'uploads/b9fe1b31e7b38e25.png', '', '0', '0', '20', '2025-08-31 18:52:02', '2025-09-04 20:12:46'),
('116', NULL, 'Whatsapp Yol Grubu', 'https://go.silayolusevenler.eu/WAyolgrubu', '0', '0', '0', '0', '', '', NULL, NULL, NULL, '0', '#3b82f6', '1', '', '', 'uploads/aff38277b5884331.png', '', '0', '0', '5', '2025-09-01 16:59:31', '2025-09-06 13:29:36'),
('117', NULL, '185 Gün Hesabı', '', '0', '0', '0', '0', '', '', NULL, NULL, NULL, '0', '', '0', '<!DOCTYPE html>
<html lang=\"tr\">
<head>
    <meta charset=\"UTF-8\">
    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">
    <title>Yönlendiriliyor...</title>
    <style>
        #redirect-container {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-color: #ffffff;
            margin: 0;
            font-family: Arial, sans-serif;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            z-index: 9999;
        }
        .container {
            text-align: center;
            background-color: #ffffff;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
            width: 300px;
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        .loader {
            width: 100px;
            height: 100px;
            background-image: url(\'https://upload.wikimedia.org/wikipedia/commons/b/b4/Flag_of_Turkey.svg\');
            background-size: cover;
            border-radius: 50%;
            animation: spin 2s linear infinite;
            margin: 0 auto 20px auto;
        }
        .progress-bar {
            width: 200px;
            height: 4px;
            background-color: #ddd;
            border-radius: 2px;
            margin: 20px 0;
            overflow: hidden;
        }
        .progress {
            width: 0%;
            height: 100%;
            background-color: #e30a17;
            animation: progress 3s linear forwards;
        }
        .message {
            color: #333;
            margin: 10px 0;
        }
        .countdown {
            font-size: 24px;
            color: #e30a17;
            font-weight: bold;
        }
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        @keyframes progress {
            0% { width: 0%; }
            100% { width: 100%; }
        }
    </style>
</head>
<body>
    <div id=\"redirect-container\">
        <div class=\"container\">
            <div class=\"loader\"></div>
            <div class=\"message\">Yönlendiriliyor...</div>
            <div class=\"progress-bar\">
                <div class=\"progress\"></div>
            </div>
            <div class=\"countdown\">3</div>
        </div>
    </div>

    <script>
        let count = 3;
        const countdownElement = document.querySelector(\'.countdown\');
        const targetUrl = \"https://go.silayolusevenler.eu/185-gun-hesabi\";
        
        const countdown = setInterval(() => {
            count--;
            countdownElement.textContent = count;
            
            if (count <= 0) {
                clearInterval(countdown);
                // Sayfa geçişini daha temiz yapmak için
                document.getElementById(\'redirect-container\').style.opacity = \'0\';
                document.getElementById(\'redirect-container\').style.transition = \'opacity 0.5s\';
                setTimeout(() => {
                    window.location.replace(targetUrl);
                }, 500);
            }
        }, 1000);

        // Sayfa yüklendiğinde hedef URL\'yi konsola yazdır
        console.log(\'Yönlendirilecek URL:\', targetUrl);
        
        // Sayfa kapatılmaya çalışıldığında uyarı göster
        window.onbeforeunload = function() {
            return \"Yönlendirme işlemi devam ediyor. Çıkmak istediğinizden emin misiniz?\";
        };
    </script>
</body>
</html>', '', 'uploads/641fe5c67a2504c3.png', '', '0', '0', '11', '2025-09-01 18:38:31', '2025-09-06 13:30:37'),
('118', NULL, 'Yoğunluk Takvimi', 'https://go.silayolusevenler.eu/yogunluk-takvimi', '0', '0', '0', '0', '', '', NULL, NULL, NULL, '0', '', '0', '', '', 'uploads/7ce811e730b0738c.png', '', '0', '0', '13', '2025-09-01 19:07:31', '2025-09-06 14:05:15'),
('120', NULL, 'Harita Guzergah', 'https://go.silayolusevenler.eu/guzergah', '0', '0', '0', '0', '', '', NULL, NULL, NULL, '0', '', '0', '', '', 'uploads/7af9ba4b05857d6f.png', '', '0', '0', '18', '2025-09-01 19:45:30', '2025-09-06 13:30:37'),
('121', NULL, 'Döviz Kurları', 'https://go.silayolusevenler.eu/WAyolgrubu', '0', '0', '0', '0', '', '', NULL, NULL, NULL, '0', '', '0', '', '', 'uploads/f2d6bb004ddc9e40.png', '', '0', '0', '10', '2025-09-01 20:02:37', '2025-09-06 13:30:37'),
('123', NULL, 'Akaryakıt Fiyatları', 'https://www.silayolusevenler.nl/apptrae/akaryakit/index.php', '0', '0', '0', '0', '', '', NULL, NULL, NULL, '0', '', '0', '', '', 'uploads/fbf5e3a7288c4ed1.png', '', '0', '0', '27', '2025-09-01 21:39:43', '2025-09-06 13:36:49'),
('124', NULL, 'akaryakit', '', '0', '0', '0', '0', '', '', NULL, NULL, NULL, '1', '', '8', '<?php
// index.php — Overpass (OSM) + Leaflet: Sadece harita görünümü, 20 km içinde oteller
?>
<!doctype html>
<html lang=\"tr\">
<head>
  <meta charset=\"utf-8\" />
  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />
  <title>Yakınımdaki Oteller – Sadece Harita</title>
  <link rel=\"stylesheet\" href=\"https://unpkg.com/leaflet@1.9.4/dist/leaflet.css\" integrity=\"sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=\" crossorigin=\"anonymous\" />
  <script src=\"https://unpkg.com/leaflet@1.9.4/dist/leaflet.js\" integrity=\"sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=\" crossorigin=\"anonymous\"></script>
  <style>
    html, body { height: 100%; margin: 0; }
    #map { height: 100vh; width: 100vw; }
    .leaflet-control-attribution { font-size: 11px; }
  </style>
</head>
<body>
  <div id=\"map\"></div>

  <script>
    const RADIUS_METERS = 20000; // 20 km
    const OVERPASS_ENDPOINT = \"https://overpass-api.de/api/interpreter\";

    // Harita
    const map = L.map(\'map\');
    L.tileLayer(\'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png\', {
      maxZoom: 19,
      attribution: \'&copy; <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> katkıcıları\'
    }).addTo(map);

    // Varsayılan merkez: Amsterdam (konum izni verilmezse)
    const DEFAULT = { lat: 52.3676, lng: 4.9041, zoom: 12 };
    map.setView([DEFAULT.lat, DEFAULT.lng], DEFAULT.zoom);

    let markersLayer = L.layerGroup().addTo(map);
    let radiusCircle = null;
    let userMarker = null; // Kırmızı kullanıcı işareti

    function buildOverpassQL(lat, lng, radius){
      const around = `around:${radius},${lat},${lng}`;
      return `
        [out:json][timeout:25];
        (
          node[\"tourism\"~\"^(hotel|motel|guest_house|hostel|apartment|resort)$\"](${around});
          way[\"tourism\"~\"^(hotel|motel|guest_house|hostel|apartment|resort)$\"](${around});
          relation[\"tourism\"~\"^(hotel|motel|guest_house|hostel|apartment|resort)$\"](${around});
        );
        out center tags;`;
    }

    async function searchHotels(lat, lng){
      const ql = buildOverpassQL(lat, lng, RADIUS_METERS);
      const url = OVERPASS_ENDPOINT + \'?data=\' + encodeURIComponent(ql);
      let data;
      try {
        const res = await fetch(url, { headers: { \'Accept\':\'application/json\' } });
        if(!res.ok) throw new Error(\'Overpass hata: \' + res.status);
        data = await res.json();
      } catch (err){
        console.error(err);
        return;
      }

      markersLayer.clearLayers();
      if(radiusCircle){ map.removeLayer(radiusCircle); }
      radiusCircle = L.circle([lat, lng], { radius: RADIUS_METERS, color:\'#60a5fa\', weight:1, fillOpacity:0.05 }).addTo(map);

      const els = data.elements || [];
      const bounds = L.latLngBounds();

      els.forEach(el => {
        const c = el.type === \'node\' ? {lat: el.lat, lng: el.lon} : {lat: el.center?.lat, lng: el.center?.lon};
        if(!c.lat || !c.lng) return;
        const t = el.tags || {};
        const name = t.name || \'(İsimsiz)\';
        const addr = [t[\'addr:street\'], t[\'addr:housenumber\'], t[\'addr:city\']].filter(Boolean).join(\' \');
        const phone = t.phone || t[\'contact:phone\'] || \'\';
        const site = t.website || t[\'contact:website\'] || \'\';
        const email = t.email || t[\'contact:email\'] || \'\';

        const m = L.marker([c.lat, c.lng]).addTo(markersLayer);
        const html = `
          <strong>${name}</strong><br/>
          ${addr ? addr + \'<br/>\' : \'\'}
          ${phone ? \'Tel: \' + phone + \'<br/>\' : \'\'}
          ${email ? \'E-posta: \' + email + \'<br/>\' : \'\'}
          ${site ? \'<a href=\"\'+site+\'\" target=\"_blank\" rel=\"noopener\">Web</a>\' : \'\'}
        `;
        m.bindPopup(html);
        bounds.extend([c.lat, c.lng]);
      });

      // Kullanıcı marker\'ını da dahil et ki kadraj bozulmasın
      if(userMarker){ bounds.extend(userMarker.getLatLng()); }

      if(els.length){
        map.fitBounds(bounds.pad(0.1));
      } else {
        map.setView([lat, lng], 13);
      }
    }

    function addOrMoveUserMarker(lat, lng){
      // Kırmızı bir marker: circleMarker ile
      if(!userMarker){
        userMarker = L.circleMarker([lat, lng], { radius: 8, color: \'red\', fillColor: \'red\', fillOpacity: 0.9 });
        userMarker.addTo(map).bindPopup(\'Konumum\');
      } else {
        userMarker.setLatLng([lat, lng]);
      }
    }

    function locateAndSearch(){
      if(!(\'geolocation\' in navigator)) { return; }
      navigator.geolocation.getCurrentPosition(pos => {
        const { latitude, longitude } = pos.coords;
        addOrMoveUserMarker(latitude, longitude);
        map.setView([latitude, longitude], 13);
        searchHotels(latitude, longitude);
      }, err => {
        console.warn(err);
        // Reddedilirse varsayılan merkezden arama yapalım
        searchHotels(DEFAULT.lat, DEFAULT.lng);
      }, { enableHighAccuracy:true, timeout:10000, maximumAge:0 });
    }

    // Başlangıç: otomatik konum denemesi, ardından arama
    setTimeout(locateAndSearch, 400);
  </script>
</body>
</html>
', '', 'uploads/d27f2a5130065990.png', '', '1', '0', '23', '2025-09-01 22:28:22', '2025-09-04 19:35:24'),
('125', NULL, 'Leaderbord - Kopya', 'https://go.silayolusevenler.eu/WAyolgrubu', '0', '0', '0', '0', '', '', NULL, NULL, NULL, '1', '', '7', '', '', 'uploads/d7d921a657781776.png', '', '0', '0', '22', '2025-09-02 16:10:45', '2025-09-04 19:34:26'),
('126', NULL, 'Tomtom', '', '0', '0', '0', '0', '', '', NULL, NULL, NULL, '0', '', '0', '<!doctype html>
<html lang=\"tr\">
<head>
<meta charset=\"utf-8\" />
<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\" />
<title>EV İstasyonları – Akıllı Kapsam + Debug Panel</title>

<link rel=\"stylesheet\" href=\"https://unpkg.com/leaflet@1.9.4/dist/leaflet.css\"/>
<style>
  html, body { height:100%; margin:0; font:14px system-ui,-apple-system,Segoe UI,Roboto,Arial; }
  #map { height:100vh; width:100%; }

  .panel, .counter, .debug {
    position:absolute; z-index:1000; background:rgba(255,255,255,.95);
    padding:8px 10px; border-radius:8px; box-shadow:0 2px 10px rgba(0,0,0,.12);
  }
  .panel  { top:10px; left:10px; }
  .counter{ top:10px; right:10px; min-width:220px; }
  .debug  { right:10px; bottom:10px; width: min(520px, 90vw); max-height: 45vh; display:flex; flex-direction:column; }

  .btn { cursor:pointer; padding:6px 10px; border-radius:6px; border:1px solid #ddd; background:#fafafa; }
  .btn:disabled { opacity:.5; cursor:default; }
  .muted { color:#777; }
  .row { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
  .pill { font-size:12px; padding:2px 6px; border-radius:999px; border:1px solid #ddd; background:#f6f6f6; }
  .pill.ok { background:#e8f9e6; border-color:#9bd49b; }
  .pill.err{ background:#ffe9e9; border-color:#e0a3a3; }
  details.debuglist { margin-top:6px; }
  details.debuglist > summary { cursor:pointer; list-style:none; }
  details.debuglist > summary::-webkit-details-marker { display:none; }

  table { width:100%; border-collapse:collapse; font-size:12px; }
  th, td { border-bottom:1px solid #eee; padding:4px 6px; text-align:left; vertical-align:top; }
  th { position:sticky; top:0; background:#fff; z-index:1; }
  code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size:12px; }

  /* Pin stilleri */
  .pin { position:relative; width:24px; height:24px; border:2px solid #fff; box-shadow:0 0 0 2px rgba(0,0,0,.15); }
  .pin-ac{border-radius:50%} .pin-dc{transform:rotate(45deg)} .pin-both{border-radius:50%}
  .pin-both::before,.pin-both::after{content:\"\";position:absolute;background:#fff;top:50%;left:0;width:100%;height:2px}
  .pin-both::before{transform:translateY(-50%) rotate(45deg)} .pin-both::after{transform:translateY(-50%) rotate(-45deg)}
  .green{background:#2ecc71}.orange{background:#f39c12}.red{background:#e74c3c}.grey{background:#95a5a6}
  .pin-label{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:9px;font-weight:700;color:#000}
  .pin-dc .pin-label{transform:rotate(-45deg)}
</style>
</head>
<body>
  <div id=\"map\"></div>

  <div class=\"panel\">
    <b>20 km içinde EV istasyonları</b><br>
    <div class=\"muted\" id=\"status\">Konum alınıyor…</div>
    <div class=\"row\" style=\"margin-top:6px\">
      <button id=\"btnRequery\" class=\"btn\">Bu konumda yeniden ara</button>
      <span class=\"muted\" id=\"impactRequery\"></span>
    </div>
  </div>

  <div class=\"counter\">
    <b>Canlı sayaç</b><br>
    TomTom <code>non-tile</code>: <span id=\"ctNonTile\">0</span><br>
    OSM tile (tahmini): <span id=\"ctTile\">0</span><br>
    <div class=\"muted\" style=\"margin-top:6px\">Her işlemden önce istek etkisini burada gösteriyorum.</div>
  </div>

  <div class=\"debug\">
    <div class=\"row\" style=\"justify-content:space-between\">
      <b>Debug (TomTom non-tile & cache olayları)</b>
      <div class=\"row\">
        <button id=\"btnExport\" class=\"btn\">JSON indir</button>
        <button id=\"btnClear\" class=\"btn\">Temizle</button>
      </div>
    </div>
    <details class=\"debuglist\" open>
      <summary class=\"muted\">Son 50 kayıt</summary>
      <div style=\"overflow:auto\">
        <table id=\"logTable\">
          <thead>
            <tr>
              <th>Zaman</th><th>Tetikleyici</th><th>Tür</th><th>Etki</th><th>Durum</th><th>URL</th>
            </tr>
          </thead>
          <tbody></tbody>
        </table>
      </div>
    </details>
  </div>

  <script src=\"https://unpkg.com/leaflet@1.9.4/dist/leaflet.js\"></script>
  <script>
  // ==== AYARLAR ====
  const TOMTOM_KEY = \"uktyGAGT5RUlbNeg0NSqN4wU4qp0VdYj\";
  const SEARCH_RADIUS_M     = 20000;          // 20 km
  const COVER_MARGIN_M      = 2000;           // 18 km kapsama
  const MOVE_MIN_METERS     = 1500;           // 1.5 km hareket eşiği
  const GRID_KM             = 6;              // 6 km kare cache
  const STATIONS_TTL_MS     = 30*60*1000;     // 30 dk
  const AVAIL_TTL_MS        = 5*60*1000;      // 5 dk
  const DEFAULT_CENTER      = { lat: 41.01, lon: 28.97 };

  // ==== UI ====
  const map = L.map(\'map\').setView([DEFAULT_CENTER.lat, DEFAULT_CENTER.lon], 12);
  const osmLayer = L.tileLayer(\'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png\',
    { maxZoom: 19, attribution: \'&copy; OpenStreetMap contributors\',
      updateWhenIdle:true, updateWhenZooming:false, keepBuffer:3, detectRetina:false }).addTo(map);

  const statusEl = document.getElementById(\'status\');
  const ctNonTile = document.getElementById(\'ctNonTile\');
  const ctTile = document.getElementById(\'ctTile\');
  const btnRequery = document.getElementById(\'btnRequery\');
  const impactRequery = document.getElementById(\'impactRequery\');

  let tileCount=0; osmLayer.on(\'tileload\', ()=>{ tileCount++; ctTile.textContent = tileCount; });
  let nonTileCount=0; const incNonTile=(n=1)=>{ nonTileCount+=n; ctNonTile.textContent=nonTileCount; };

  // ==== Debug logger ====
  const logs = [];
  function ts(){ const d=new Date(); return d.toLocaleTimeString(); }
  function addLog({trigger, type, effect, url, status, cache}) {
    const entry = { time: ts(), trigger, type, effect, status: status ?? (cache?\'CACHE\':\'—\'), url, cache: !!cache };
    logs.push(entry);
    while (logs.length > 50) logs.shift();
    renderLogs();
  }
  function renderLogs(){
    const tb = document.querySelector(\'#logTable tbody\');
    tb.innerHTML = logs.slice().reverse().map(l=>{
      const st = l.status || \'—\';
      const pill = st===\'200\' || st===\'OK\' ? \'ok\' : (st===\'CACHE\' ? \'\' : \'err\');
      return `<tr>
        <td>${l.time}</td>
        <td>${l.trigger||\'\'}</td>
        <td><span class=\"pill\">${l.type||\'\'}</span></td>
        <td>${l.effect||\'\'}</td>
        <td><span class=\"pill ${pill}\">${st}</span></td>
        <td><code>${(l.url||\'\').replace(/[?&]key=[^&]+/,\'\')}</code></td>
      </tr>`;
    }).join(\'\');
  }
  document.getElementById(\'btnExport\').onclick = ()=>{
    const blob = new Blob([JSON.stringify(logs, null, 2)], {type:\'application/json\'});
    const a = document.createElement(\'a\');
    a.href=URL.createObjectURL(blob); a.download=\'debug-logs.json\'; a.click(); URL.revokeObjectURL(a.href);
  };
  document.getElementById(\'btnClear\').onclick = ()=>{ logs.length=0; renderLogs(); };

  const setStatus=t=>statusEl.textContent=t;
  const now=()=>Date.now();
  const toRad=d=>d*Math.PI/180;
  const haversine=(a,b)=>{ const R=6371000, dLat=toRad(b.lat-a.lat), dLon=toRad(b.lon-a.lon);
    const lat1=toRad(a.lat), lat2=toRad(b.lat);
    const h=Math.sin(dLat/2)**2 + Math.cos(lat1)*Math.cos(lat2)*Math.sin(dLon/2)**2;
    return 2*R*Math.asin(Math.sqrt(h)); };
  const gridKey=(lat,lon)=>`${Math.round(lat/(GRID_KM/110))}_${Math.round(lon/(GRID_KM/111))}`;

  const LS = {
    get(key, ttl){ try{ const raw=localStorage.getItem(key); if(!raw) return null;
      const o=JSON.parse(raw); if(now()-o.ts>ttl) return null; return o.val; }catch{ return null; } },
    set(key,val){ try{ localStorage.setItem(key, JSON.stringify({ts:now(),val})); }catch{} }
  };

  function stationType(item){
    const conns=item.chargingPark?.connectors||[];
    const hasAC=conns.some(c=>(c.currentType||\'\').toUpperCase()===\'AC\');
    const hasDC=conns.some(c=>(c.currentType||\'\').toUpperCase()===\'DC\');
    if(hasAC&&hasDC) return \'BOTH\'; if(hasDC) return \'DC\'; return \'AC\';
  }
  function makeDivIcon(type,color){
    const el=document.createElement(\'div\');
    el.className=`pin ${color} `+(type===\'AC\'?\'pin-ac\':type===\'DC\'?\'pin-dc\':\'pin-both\');
    const lbl=document.createElement(\'div\'); lbl.className=\'pin-label\'; lbl.textContent=(type===\'BOTH\'?\'A+D\':type);
    el.appendChild(lbl);
    return L.divIcon({className:\'\', html:el, iconSize:[24,24], iconAnchor:[12,12]});
  }
  function connectorsHtml(item){
    const list=item.chargingPark?.connectors||[]; if(!list.length) return \'<em>Soket yok</em>\';
    return \'<ul style=\"padding-left:16px;margin:6px 0 0;\">\'+
      list.slice(0,12).map(c=>`<li>${c.connectorType||\'-\'} — ${c.currentType||\'-\'} ${c.ratedPowerKW?c.ratedPowerKW+\' kW\':\'\'}</li>`).join(\'\')+
    \'</ul>\';
  }
  function availabilityHtml(av){
    if(!av||!av.connectors||!av.connectors.length) return \'<em>Müsaitlik verisi yok</em>\';
    return \'<ul style=\"padding-left:16px;margin:6px 0 0;\">\'+
      av.connectors.map(c=>{const cur=c.availability?.current||{}; return `<li>${c.type} — Boş:${cur.available||0} • Dolu:${cur.occupied||0}</li>`;}).join(\'\')+
    \'</ul>\';
  }
  function availabilitySummary(av){
    if(!av||!Array.isArray(av.connectors)) return {a:null,o:null};
    let a=0,o=0; av.connectors.forEach(c=>{const cur=c.availability?.current||{}; a+=(cur.available||0); o+=(cur.occupied||0);});
    return {a,o};
  }
  const statusColor=({a,o})=> (a===null||o===null)?\'grey\' : (a===0?\'red\' : (o===0 && a>0?\'green\':\'orange\'));

  const drawn=new Map();

  // TomTom fetch wrapper (non-tile sayaç + log)
  async function ttFetch(url, {trigger, type, effect}){
    incNonTile(1);
    addLog({trigger, type, effect, url, status:\'...\'});

    let status = \'ERR\';
    try {
      const res = await fetch(url);
      status = String(res.status);
      const json = res.ok ? await res.json() : null;
      addLog({trigger, type, effect, url, status});
      return json;
    } catch (e) {
      addLog({trigger, type, effect, url, status:\'ERR\'});
      return null;
    }
  }

  async function fetchStations(lat,lon, trigger=\'auto\'){
    const key=`stations_${gridKey(lat,lon)}_${Math.round(SEARCH_RADIUS_M/1000)}km`;
    const cached=LS.get(key, STATIONS_TTL_MS);
    if(cached){ setStatus(\'Önbellekten istasyonlar yüklendi.\'); addLog({trigger, type:\'search\', effect:\'CACHE\', url:`nearbySearch(${lat.toFixed(4)},${lon.toFixed(4)})`, cache:true}); return cached; }
    const params=new URLSearchParams({ key:TOMTOM_KEY, lat, lon, radius:SEARCH_RADIUS_M, limit:100, categorySet:\'7309\' });
    const data=await ttFetch(`https://api.tomtom.com/search/2/nearbySearch/.json?${params.toString()}`, {trigger, type:\'search\', effect:\'1 non-tile\'});
    const results=(data&&data.results)||[]; LS.set(key, results); return results;
  }
  async function fetchAvailability(id, trigger=\'popup\'){
    const key=`av_${id}`; const cached=LS.get(key, AVAIL_TTL_MS);
    if(cached!==null){ addLog({trigger, type:\'availability\', effect:\'CACHE\', url:`availability(${id})`, cache:true}); return cached; }
    const url=`https://api.tomtom.com/search/2/chargingAvailability.json?key=${TOMTOM_KEY}&chargingAvailability=${encodeURIComponent(id)}`;
    const data=await ttFetch(url, {trigger, type:\'availability\', effect:\'1 non-tile\'});
    LS.set(key, data); return data;
  }

  async function drawStations(center, trigger=\'auto\'){
    setStatus(\'İstasyonlar getiriliyor… (bu işlem 1 non-tile isteği)\');
    const list=await fetchStations(center.lat, center.lon, trigger);
    if(!list.length){ setStatus(\'İstasyon bulunamadı.\'); return; }
    setStatus(`${list.length} istasyon (cache aktif).`);

    list.forEach((item, idx)=>{
      const pos=item.position; if(!pos) return;
      const id=(item.id || item.poi?.id) ?? `${pos.lat},${pos.lon},${idx}`;
      if(drawn.has(id)) return;

      const typ=stationType(item);
      const marker=L.marker([pos.lat,pos.lon],{icon:makeDivIcon(typ,\'grey\')}).addTo(map);
      drawn.set(id, marker);

      const name=item.poi?.name||\'EV İstasyonu\';
      const addr=item.address?.freeformAddress||\'\';
      const dsId=item.dataSources?.chargingAvailability?.id;

      marker.bindPopup(
        `<b>${name}</b><br>${addr}<br>`+
        `<div><small><b>Soketler</b></small>${connectorsHtml(item)}</div>`+
        `<div><small><b>Müsaitlik</b></small><div id=\"av-${id}\"><em>Henüz çekilmedi</em></div>`+
        (dsId? `<button class=\"btn\" data-dsid=\"${dsId}\" data-id=\"${id}\">Müsaitliği getir (1 non-tile)</button>` : `<div class=\"muted\">Bu istasyonda availability kaynağı yok</div>`) +
        `</div>`
      );

      marker.on(\'popupopen\', (e)=>{
        const root=e.popup.getElement();
        const btn=root.querySelector(\\`button[data-id=\"\\${CSS.escape(id)}\"]\\`);
        const avDiv=root.querySelector(\\`#av-\\${CSS.escape(id)}\\`);
        if(!btn||!avDiv) return;
        btn.onclick=async ()=>{
          btn.disabled=true; avDiv.innerHTML=\'<em>Yükleniyor…</em>\';
          const av=await fetchAvailability(btn.dataset.dsid, \'popup\');
          avDiv.innerHTML=availabilityHtml(av);
          const color=statusColor(availabilitySummary(av));
          marker.setIcon(makeDivIcon(typ,color));
          setTimeout(()=>btn.disabled=false,2000);
        };
      });
    });
  }

  // --- Kapsam denetimi ---
  let lastQueryCenter = null;
  function viewportCorners(){
    const b=map.getBounds();
    return [
      {lat:b.getNorth(), lon:b.getWest()},
      {lat:b.getNorth(), lon:b.getEast()},
      {lat:b.getSouth(), lon:b.getWest()},
      {lat:b.getSouth(), lon:b.getEast()}
    ];
  }
  function viewportOutsideCoverage(){
    if(!lastQueryCenter) return true;
    const corners=viewportCorners();
    const limit=SEARCH_RADIUS_M - COVER_MARGIN_M; // 18 km
    return corners.some(c=>haversine(lastQueryCenter,c)>limit);
  }

  let lastCenter={lat:DEFAULT_CENTER.lat, lon:DEFAULT_CENTER.lon};
  function getCenter(){ const c=map.getCenter(); return {lat:c.lat, lon:c.lng}; }

  function planImpactText(){
    const center = getCenter();
    const moved=haversine(lastCenter, center);
    const sameGrid=gridKey(lastCenter.lat,lastCenter.lon)===gridKey(center.lat,center.lon);
    const outside=viewportOutsideCoverage();
    if(outside) return \' → Etki: ~1 non-tile (kapsam dışı alan görüldü)\';
    if(moved>MOVE_MIN_METERS && !sameGrid) return \' → Etki: ~1 non-tile (yeni grid)\';
    return \' → Etki: 0 (cache/aynı kapsam)\';
  }

  async function maybeQuery(trigger){
    impactRequery.textContent=planImpactText();
    const center=getCenter();
    const moved=haversine(lastCenter,center);
    const sameGrid=gridKey(lastCenter.lat,lastCenter.lon)===gridKey(center.lat,center.lon);
    const outside=viewportOutsideCoverage();

    if(outside||(moved>MOVE_MIN_METERS && !sameGrid)||!lastQueryCenter){
      lastCenter=center; lastQueryCenter=center;
      await drawStations(center, trigger);
    } else {
      setStatus(\\`Hareket küçük / kapsam içi (\\${trigger}). Yeni istek yapılmadı.\\`);
      addLog({trigger, type:\'search\', effect:\'0 (cache/ kapsam içi)\', url:\'—\', status:\'CACHE\', cache:true});
    }
  }

  btnRequery.onclick=()=>maybeQuery(\'buton\');
  let debounce=null; map.on(\'moveend\', ()=>{ clearTimeout(debounce); debounce=setTimeout(()=>maybeQuery(\'moveend\'),800); });

  function startAt(lat,lon){
    map.setView([lat,lon],12);
    L.marker([lat,lon]).addTo(map).bindPopup(\'Mevcut konum\').openPopup();
    lastCenter={lat,lon}; lastQueryCenter=null; maybeQuery(\'init\'); setStatus(\'Hazır.\');
  }

  if(navigator.geolocation){
    navigator.geolocation.getCurrentPosition(
      pos=>startAt(pos.coords.latitude,pos.coords.longitude),
      ()=>startAt(DEFAULT_CENTER.lat,DEFAULT_CENTER.lon),
      { enableHighAccuracy:true, timeout:8000 }
    );
  } else { startAt(DEFAULT_CENTER.lat,DEFAULT_CENTER.lon); }
  </script>
</body>
</html>', '', 'uploads/7af9ba4b05857d6f.png', '', '0', '0', '23', '2025-09-02 21:53:52', '2025-09-06 13:29:00'),
('127', NULL, 'Döviz', '', '0', '0', '0', '0', '', '', NULL, NULL, NULL, '0', '', '0', '<!doctype html>
<html lang=\"tr\">
<head>
<meta charset=\"utf-8\" />
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />
<title>Döviz Çevirici (Kompakt • Aydınlık)</title>
<style>
  :root{
    --bg:#f7f8fb; --card:#ffffff; --line:#e6e8ee; --text:#0e1320; --muted:#667085;
    --accent:#d81b60; --ring:rgba(216,27,96,.18); --input:#ffffff; --input-border:#d5dae3;
  }
  *{box-sizing:border-box}
  body{margin:0;background:var(--bg);color:var(--text);
       font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial}
  .wrap{max-width:760px;margin:12px auto;padding:0 10px}
  .head{display:flex;align-items:center;justify-content:space-between;margin:2px 0 8px}
  .title{font-weight:800;letter-spacing:.2px;font-size:20px}

  .card{background:var(--card);border:1px solid var(--line);border-radius:12px;overflow:hidden}

  /* yalnızca tarih için üst bar */
  .toolbar{display:flex;justify-content:flex-end;align-items:center;
           padding:6px 8px;border-bottom:1px solid var(--line)}
  .when{font-size:11px;color:var(--muted)}

  /* daha da kompakt grid */
  .grid{display:grid;grid-template-columns:24px minmax(140px,1fr) 26px minmax(84px,110px);align-items:center}
  .row{padding:4px 8px;border-bottom:1px dashed var(--line)}
  .row:last-child{border-bottom:none}
  .flag{font-size:18px;text-align:center}
  .name{font-size:12.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .name b{font-weight:700}
  .sym{font-size:12.5px;color:var(--muted);text-align:center}

  input.amount{
    width:100%;height:28px;background:var(--input);border:1px solid var(--input-border);
    border-radius:8px;color:var(--text);font-size:13.5px;padding:0 8px;outline:none;text-align:right;
  }
  input.amount:focus{border-color:var(--accent);box-shadow:0 0 0 3px var(--ring)}

  .foot{padding:6px 8px;font-size:11px;color:var(--muted);text-align:right}
  .foot a{color:inherit;text-decoration:none}

  @media (max-width:480px){
    .grid{grid-template-columns:22px minmax(116px,1fr) 24px minmax(80px,100px)}
    .name{font-size:12px}
    input.amount{height:26px;font-size:13px}
  }
</style>
</head>
<body>
<div class=\"wrap\">
  <div class=\"head\">
    <div class=\"title\">💱 Döviz Çevirici</div>
    <!-- üst sağda yalnızca tarih -->
  </div>

  <div class=\"card\" role=\"region\" aria-live=\"polite\">
    <div class=\"toolbar\">
      <div class=\"when\" id=\"stampTop\">—</div>
    </div>

    <div id=\"rows\"></div>

    <div class=\"foot\" id=\"stampBottom\">
      Kaynaklar: <a href=\"https://exchangerate.host\" target=\"_blank\" rel=\"noopener\">exchangerate.host</a> ·
      <a href=\"https://frankfurter.app\" target=\"_blank\" rel=\"noopener\">frankfurter.app</a>
    </div>
  </div>
</div>

<script>
(() => {
  // Sıra görseldekiyle aynı — adlar Türkçe
  const CURRENCIES = [
    {code:\"EUR\", label:\"Euro\",              flag:\"🇪🇺\", symbol:\"€\"},
    {code:\"TRY\", label:\"Türk Lirası\",       flag:\"🇹🇷\", symbol:\"₺\"},
    {code:\"BGN\", label:\"Bulgar Levası\",     flag:\"🇧🇬\", symbol:\"лв\"},
    {code:\"CHF\", label:\"İsviçre Frangı\",    flag:\"🇨🇭\", symbol:\"Fr\"},
    {code:\"CZK\", label:\"Çek Korunası\",      flag:\"🇨🇿\", symbol:\"Kč\"},
    {code:\"DKK\", label:\"Danimarka Kronu\",   flag:\"🇩🇰\", symbol:\"kr\"},
    {code:\"GBP\", label:\"İngiliz Sterlini\",  flag:\"🇬🇧\", symbol:\"£\"},
    {code:\"HRK\", label:\"Hırvat Kunası\",     flag:\"🇭🇷\", symbol:\"kn\"},
    {code:\"HUF\", label:\"Macar Forinti\",     flag:\"🇭🇺\", symbol:\"Ft\"},
    {code:\"MKD\", label:\"Makedon Dinarı\",    flag:\"🇲🇰\", symbol:\"ден\"},
    {code:\"RSD\", label:\"Sırp Dinarı\",       flag:\"🇷🇸\", symbol:\"дин\"},
    {code:\"SEK\", label:\"İsveç Kronu\",       flag:\"🇸🇪\", symbol:\"kr\"},
    {code:\"RON\", label:\"Romen Leyi\",        flag:\"🇷🇴\", symbol:\"L\"}
  ];

  const rowsEl = document.getElementById(\'rows\');
  const stampTop  = document.getElementById(\'stampTop\');

  const inputs = {};
  let rates = {}; // EUR baz
  const OFFLINE_RATES = {EUR:1, TRY:48.03, BGN:1.95, CHF:0.94, CZK:24.49, DKK:7.47, GBP:0.87, HRK:5.39, HUF:396.89, MKD:63.08, RSD:117.65, SEK:11.02, RON:5.10};

  // Satırları çiz — kompakt grid
  CURRENCIES.forEach(c=>{
    const row = document.createElement(\'div\'); row.className=\'row grid\';
    row.innerHTML = `<div class=\"flag\">${c.flag}</div>
                     <div class=\"name\"><b>${c.code}</b> — ${c.label}</div>
                     <div class=\"sym\">${c.symbol}</div>`;
    const input = document.createElement(\'input\');
    input.className=\'amount\'; input.type=\'text\'; input.inputMode=\'decimal\';
    input.placeholder=\'0\'; input.autocomplete=\'off\'; input.spellcheck=false;
    row.appendChild(input);
    rowsEl.appendChild(row);
    inputs[c.code] = input;
  });

  // TR sayı parse: \"1.205,45\" -> 1205.45
  function parseTR(s){
    if(s == null) return NaN;
    s = String(s).trim();
    if(!s) return NaN;
    s = s.replace(/\\./g,\'\').replace(\',\', \'.\');
    if(s.endsWith(\'.\')) s = s.slice(0,-1);
    if(!s) return NaN;
    return Number(s);
  }
  // Yazdırma: binlik nokta + ondalık virgül, en fazla 2 hane
  function formatTR2(n){
    if(!isFinite(n)) return \'\';
    return n.toLocaleString(\'tr-TR\',{minimumFractionDigits:2, maximumFractionDigits:2});
  }
  // Yazarken canlı biçimlendir: virgül görünür kalsın, fraksiyon en fazla 2 hane
  function formatLiveKeepTwo(el){
    let s = el.value;
    s = s.replace(/[^\\d,]/g, \'\');            // sadece rakam ve virgül
    const i = s.indexOf(\',\');
    const hasComma = i !== -1;
    let intRaw = hasComma ? s.slice(0, i) : s;
    let fracRaw = hasComma ? s.slice(i+1) : \'\';
    fracRaw = fracRaw.slice(0, 2);           // max 2 ondalık
    intRaw = intRaw.replace(/^0+(?=\\d)/,\'\') || \'0\';
    const intGrouped = intRaw.replace(/\\B(?=(\\d{3})+(?!\\d))/g, \'.\');
    el.value = hasComma ? (intGrouped + \',\' + fracRaw) : intGrouped;
  }

  function toEUR(a, code){const r=rates[code]; if(!r) return null; return a/r;}
  function fromEUR(e, code){const r=rates[code]; if(!r) return null; return e*r;}

  function propagateFrom(code){
    const src=inputs[code];
    const v=parseTR(src.value);
    if(isNaN(v)){ Object.entries(inputs).forEach(([k,i])=>{ if(k!==code) i.value=\'\';}); return; }
    const eur=toEUR(v,code); if(eur==null) return;
    CURRENCIES.forEach(c=>{
      if(c.code===code) return;
      inputs[c.code].value = formatTR2(fromEUR(eur,c.code));
    });
  }

  // Yazarken: önce girdiyi TR canlı biçimle, sonra dönüştür
  Object.entries(inputs).forEach(([code, el])=>{
    el.addEventListener(\'input\', ()=>{
      formatLiveKeepTwo(el);
      propagateFrom(code);
    });
    el.addEventListener(\'blur\', ()=>{
      const n=parseTR(el.value);
      if(isFinite(n)) el.value = formatTR2(n); // blur\'da 2 hane sabitle
    });
    el.addEventListener(\'focus\', ()=>{ el.select(); });
  });

  // Ağ: timeout + 2 kaynak + yedek
  function withTimeout(ms, factory){
    const ctrl=new AbortController(); const t=setTimeout(()=>ctrl.abort(\'timeout\'),ms);
    return factory(ctrl.signal).finally(()=>clearTimeout(t));
  }
  async function exHost(signal){
    const sy = CURRENCIES.map(c=>c.code).join(\',\');
    const r=await fetch(`https://api.exchangerate.host/latest?base=EUR&symbols=${encodeURIComponent(sy)}`,{signal,cache:\'no-store\'});
    if(!r.ok) throw new Error(\'exchangerate.host \'+r.status);
    const d=await r.json(); return {provider:\'exchangerate.host\', date:d.date, rates:d.rates};
  }
  async function frank(signal){
    const sy = CURRENCIES.map(c=>c.code).join(\',\');
    const r=await fetch(`https://api.frankfurter.app/latest?from=EUR&to=${encodeURIComponent(sy)}`,{signal,cache:\'no-store\'});
    if(!r.ok) throw new Error(\'frankfurter.app \'+r.status);
    const d=await r.json(); return {provider:\'frankfurter.app\', date:d.date, rates:d.rates};
  }

  async function fetchRates(){
    try{
      let p; try{ p=await withTimeout(10000, s=>exHost(s)); } catch(e){ p=await withTimeout(10000, s=>frank(s)); }
      rates={}; CURRENCIES.forEach(c=>{ rates[c.code]=(c.code===\'EUR\')?1:p.rates?.[c.code]; });
      CURRENCIES.forEach(c=>{ if(rates[c.code]==null) rates[c.code]=OFFLINE_RATES[c.code]; });

      inputs.EUR.value=\'1\';          // Açılış: 1 EUR
      propagateFrom(\'EUR\');

      const ts=p.date?new Date(p.date+\'T00:00:00Z\'):new Date();
      stampTop.textContent = `Güncelleme: ${ts.toLocaleDateString(\'tr-TR\')}`;
    }catch(err){
      rates=OFFLINE_RATES;
      inputs.EUR.value=\'1\';
      propagateFrom(\'EUR\');
      stampTop.textContent = \'Güncelleme: çevrimdışı (örnek kurlar)\';
    }
  }

  fetchRates();
  setInterval(fetchRates, 30*60*1000);
})();
</script>
</body>
</html>
', '', 'uploads/f2d6bb004ddc9e40.png', '', '0', '0', '24', '2025-09-02 22:13:22', '2025-09-06 13:29:00'),
('128', NULL, 'Güzergah.', 'https://www.silayolusevenler.nl/apptrae/guzergah/index.html', '0', '0', '0', '0', '', '', NULL, NULL, NULL, '0', '', '0', '', '', 'uploads/cfda1bb43e6f4722.png', '', '0', '0', '25', '2025-09-03 17:31:50', '2025-09-06 13:29:00'),
('129', '13', 'Kamera Haritasi', '', '0', '0', '0', '0', '', '', NULL, NULL, NULL, '0', '', '8', '<!DOCTYPE html>
<html lang=\"tr\">
<head>
  <meta charset=\"utf-8\" />
  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />
  <title>Gümrük Harita - Iframe</title>
  <style>
    html, body { height: 100%; margin: 0; }
    .frame-wrap { height: 100vh; }
    iframe { width: 100%; height: 100%; border: 0; display: block; }
  </style>
</head>
<body>
  <div class=\"frame-wrap\">
    <iframe
      src=\"https://silayolusevenler.nl/app/gumrukharita/harita.html\"
      title=\"Sıla Yolu Sevenler - Gümrük Harita\"
      loading=\"lazy\"
      referrerpolicy=\"no-referrer-when-downgrade\"
      allowfullscreen>
    </iframe>
  </div>
</body>
</html>
', '', '', '', '0', '0', '100', '2025-09-06 22:05:46', '2025-09-06 22:06:19'),
('130', NULL, 'Kadran', '', '0', '0', '0', '0', '', '', NULL, NULL, NULL, '0', '', '0', '<!doctype html>
<html lang=\"tr\">
<head>
<meta charset=\"utf-8\" />
<meta name=\"viewport\" content=\"width=device-width,initial-scale=1,viewport-fit=cover\" />
<title>Gösterge Paneli – Saat + GPS Hız</title>
<style>
  :root{
    --bg:#0a0f14; --panel:#0d1520; --ring:#1b2a3a;
    --accent:#2dd4bf; --accent2:#60a5fa; --warn:#ef4444;
    --text:#e5f1ff; --muted:#8aa4c2;
  }
  *{box-sizing:border-box}
  html,body{height:100%}
  body{margin:0;background:linear-gradient(180deg,#0a0f14,#06090d);color:var(--text);font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Arial}
  .chrome{position:fixed;inset:0;display:flex;flex-direction:column;gap:.75rem;padding:clamp(8px,2vw,18px)}
  header,footer{display:flex;gap:.5rem;align-items:center;justify-content:space-between}
  header h1{font-size:clamp(14px,2.8vw,18px);font-weight:600;margin:0;color:var(--muted)}
  .btns{display:flex;gap:.5rem;flex-wrap:wrap}
  button{background:linear-gradient(180deg,#102030,#0c1a28);color:var(--text);border:1px solid #1f2c3b;border-radius:10px;padding:.6rem .9rem;font-weight:600;letter-spacing:.2px;font-size:clamp(12px,2.6vw,14px);box-shadow:inset 0 0 0 1px #0b1420, 0 2px 8px rgba(0,0,0,.35);cursor:pointer}
  button:active{transform:translateY(1px)}
  .dashboard{flex:1;display:flex;gap:clamp(10px,2vw,18px)}
  .card{flex:1;position:relative;background:radial-gradient(120% 120% at 50% 0%, #0e1623 0%, #0a1019 55%, #070c14 100%);border:1px solid #162233;border-radius:18px;box-shadow:0 10px 45px rgba(0,0,0,.45), inset 0 0 30px rgba(13,26,44,.6);display:flex;align-items:center;justify-content:center;overflow:hidden}
  canvas{width:100%;height:100%;display:block}
  .readout{position:absolute;inset:auto 0 10%;display:flex;justify-content:center;pointer-events:none;font-weight:700;color:var(--muted);font-size:clamp(10px,2.2vw,12px)}
  .status{font-size:clamp(12px,2.6vw,14px);color:var(--muted)}
  /* Küçük ekranlar */
  @media (max-width:720px){ .chrome{gap:.5rem} }

  /* Fallback: API izin vermezse tüm UI’yı 90° çevir (yatay kilit taklidi) */
  html.fallback-landscape, html.fallback-landscape body{overflow:hidden;background:#000}
  html.fallback-landscape .chrome{
    position:fixed;left:0;top:0;width:100vh;height:100vw;
    transform:rotate(90deg) translateY(-100vh); transform-origin:top left;
  }
</style>
</head>
<body>
  <div class=\"chrome\">
    <header>
      <h1>Gösterge Paneli</h1>
      <div class=\"btns\">
        <button id=\"lockLandscape\">Yan Çevir (Kilitle)</button>
        <button id=\"unlock\">Kilidi Kaldır</button>
        <button id=\"startGPS\">GPS’i Başlat</button>
        <span class=\"status\" id=\"gpsStatus\">GPS: kapalı</span>
      </div>
    </header>

    <main class=\"dashboard\">
      <section class=\"card\" aria-label=\"Analog Saat\">
        <canvas id=\"clockCanvas\"></canvas>
        <div class=\"readout\"><span id=\"clockText\">--:--</span></div>
      </section>
      <section class=\"card\" aria-label=\"Hız Göstergesi\">
        <canvas id=\"speedCanvas\"></canvas>
        <div class=\"readout\"><span id=\"speedHint\">GPS izni gerekli</span></div>
      </section>
    </main>

    <footer>
      <div class=\"status\" id=\"info\">Hazır.</div>
      <div class=\"status\">v1.1</div>
    </footer>
  </div>

<script>
/* ---------- Ortam/Yön Kilidi ---------- */
const info = document.getElementById(\'info\');
async function goFullscreen(){
  if (!document.fullscreenElement) {
    const el = document.documentElement;
    if (el.requestFullscreen) await el.requestFullscreen();
  }
}
async function lockLandscape(){
  try{
    await goFullscreen();
    if (screen.orientation && screen.orientation.lock) {
      await screen.orientation.lock(\'landscape\');
      document.documentElement.classList.remove(\'fallback-landscape\');
      info.textContent = \'Yatay kilit aktif. Telefonu yan çevirin.\';
    } else {
      // iOS Safari ve desteklemeyenler
      document.documentElement.classList.add(\'fallback-landscape\');
      info.textContent = \'Tarayıcı kilidi desteklemiyor, görünüm 90° döndürüldü.\';
    }
  }catch(e){
    // Bazı tarayıcılarda tam ekran/onay gerekebilir
    document.documentElement.classList.add(\'fallback-landscape\');
    info.textContent = \'Kilit başarısız: \' + (e.message||e) + \' – Görünüm 90° döndürüldü.\';
  }
}
async function unlockAll(){
  document.documentElement.classList.remove(\'fallback-landscape\');
  try{ screen.orientation && screen.orientation.unlock && screen.orientation.unlock(); }catch{}
  try{ document.fullscreenElement && document.exitFullscreen && await document.exitFullscreen(); }catch{}
  info.textContent = \'Kilit kaldırıldı.\';
}
document.getElementById(\'lockLandscape\').addEventListener(\'click\', lockLandscape);
document.getElementById(\'unlock\').addEventListener(\'click\', unlockAll);

/* ---------- Yardımcılar ---------- */
const clamp=(v,min,max)=>Math.max(min,Math.min(max,v));
const toKmH=ms=>ms*3.6;
const haversine=(lat1,lon1,lat2,lon2)=>{
  const R=6371000,toRad=x=>x*Math.PI/180;
  const dLat=toRad(lat2-lat1), dLon=toRad(lon2-lon1);
  const a=Math.sin(dLat/2)**2 + Math.cos(toRad(lat1))*Math.cos(toRad(lat2))*Math.sin(dLon/2)**2;
  return 2*R*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));
};

/* ---------- Saat ---------- */
(function clock(){
  const canvas=document.getElementById(\'clockCanvas\'),ctx=canvas.getContext(\'2d\');
  function resize(){const r=canvas.parentElement.getBoundingClientRect();const s=Math.min(r.width,r.height)*0.9;canvas.width=canvas.height=Math.max(240,Math.floor(s));}
  addEventListener(\'resize\',resize,{passive:true}); resize();
  function draw(){
    const w=canvas.width,h=canvas.height,r=w/2; ctx.clearRect(0,0,w,h); ctx.save(); ctx.translate(r,r);
    ctx.beginPath(); ctx.arc(0,0,r-6,0,Math.PI*2);
    const grd=ctx.createRadialGradient(0,0,r*.4,0,0,r*.98); grd.addColorStop(0,\"#0e1b2b\"); grd.addColorStop(1,\"#07111b\");
    ctx.fillStyle=grd; ctx.fill(); ctx.lineWidth=2; ctx.strokeStyle=\"#162233\"; ctx.stroke();
    for(let i=0;i<60;i++){const a=i*Math.PI/30;const len=(i%5===0)?r*.12:r*.06; ctx.lineWidth=(i%5===0)?3:1.5; ctx.strokeStyle=(i%5===0)?\"rgba(45,212,191,.85)\":\"rgba(96,165,250,.6)\";
      ctx.beginPath(); ctx.moveTo(Math.cos(a)*(r*.82),Math.sin(a)*(r*.82)); ctx.lineTo(Math.cos(a)*(r*.82-len),Math.sin(a)*(r*.82-len)); ctx.stroke();}
    ctx.fillStyle=\"#a8c3e6\"; ctx.font=`${Math.floor(r*.14)}px system-ui`; ctx.textAlign=\"center\"; ctx.textBaseline=\"middle\";
    [[\"12\",0],[ \"3\",Math.PI/2],[ \"6\",Math.PI],[ \"9\",Math.PI*1.5]].forEach(([t,a])=>ctx.fillText(t,Math.cos(a)*(r*.6),Math.sin(a)*(r*.6)));
    const now=new Date(); document.getElementById(\'clockText\').textContent=now.toLocaleTimeString([], {hour:\'2-digit\', minute:\'2-digit\'});
    const sec=now.getSeconds()+now.getMilliseconds()/1000, min=now.getMinutes()+sec/60, hr=(now.getHours()%12)+min/60;
    ctx.strokeStyle=\"#2dd4bf\"; ctx.lineCap=\"round\"; ctx.lineWidth=6; ctx.beginPath(); ctx.rotate(hr*Math.PI/6); ctx.moveTo(0,r*.10); ctx.lineTo(0,-r*.45); ctx.stroke(); ctx.rotate(-hr*Math.PI/6);
    ctx.strokeStyle=\"#60a5fa\"; ctx.lineWidth=4; ctx.beginPath(); ctx.rotate(min*Math.PI/30); ctx.moveTo(0,r*.12); ctx.lineTo(0,-r*.64); ctx.stroke(); ctx.rotate(-min*Math.PI/30);
    ctx.strokeStyle=\"#ef4444\"; ctx.lineWidth=2; ctx.beginPath(); ctx.rotate(sec*Math.PI/30); ctx.moveTo(0,r*.16); ctx.lineTo(0,-r*.70); ctx.stroke(); ctx.rotate(-sec*Math.PI/30);
    ctx.fillStyle=\"#17304a\"; ctx.beginPath(); ctx.arc(0,0,8,0,Math.PI*2); ctx.fill(); ctx.restore();
    requestAnimationFrame(draw);
  }
  requestAnimationFrame(draw);
})();

/* ---------- Hız göstergesi ---------- */
(function speedometer(){
  const canvas=document.getElementById(\'speedCanvas\'),ctx=canvas.getContext(\'2d\');
  const hint=document.getElementById(\'speedHint\'); let currentSpeed=0, displaySpeed=0; const maxSpeed=260;
  function resize(){const r=canvas.parentElement.getBoundingClientRect();const s=Math.min(r.width,r.height)*0.9;canvas.width=canvas.height=Math.max(260,Math.floor(s));}
  addEventListener(\'resize\',resize,{passive:true}); resize();
  function draw(){
    const w=canvas.width,h=canvas.height,r=w/2; ctx.clearRect(0,0,w,h); ctx.save(); ctx.translate(r,r);
    ctx.beginPath(); ctx.arc(0,0,r-6,0,Math.PI*2);
    const grd=ctx.createRadialGradient(0,0,r*.35,0,0,r*.98); grd.addColorStop(0,\"#0c1726\"); grd.addColorStop(1,\"#06101a\");
    ctx.fillStyle=grd; ctx.fill(); ctx.lineWidth=2; ctx.strokeStyle=\"#152133\"; ctx.stroke();
    for(let i=0;i<=260;i+=10){const frac=i/maxSpeed, ang=(Math.PI*.75)+frac*(Math.PI*1.5); const big=i%20===0; const len=big?r*.12:r*.07;
      ctx.lineWidth=big?3:1.5; ctx.strokeStyle=big?\"rgba(96,165,250,.9)\":\"rgba(96,165,250,.55)\";
      ctx.beginPath(); ctx.moveTo(Math.cos(ang)*(r*.82),Math.sin(ang)*(r*.82));
      ctx.lineTo(Math.cos(ang)*(r*.82-len),Math.sin(ang)*(r*.82-len)); ctx.stroke();
      if(big){ctx.save(); ctx.fillStyle=\"#a8c3e6\"; ctx.font=`${Math.floor(r*.12)}px system-ui`; ctx.textAlign=\"center\"; ctx.textBaseline=\"middle\";
        const tx=Math.cos(ang)*(r*.82-len-18), ty=Math.sin(ang)*(r*.82-len-18); ctx.translate(tx,ty); ctx.rotate(ang+Math.PI/2); ctx.fillText(i.toString(),0,0); ctx.restore();}
    }
    displaySpeed += (currentSpeed - displaySpeed)*0.12;
    const start=(Math.PI*.75), end=start + clamp(displaySpeed,0,maxSpeed)/maxSpeed*(Math.PI*1.5);
    ctx.lineWidth=10; ctx.strokeStyle=displaySpeed<130?\"#2dd4bf\":(displaySpeed<200?\"#60a5fa\":\"#ef4444\");
    ctx.beginPath(); ctx.arc(0,0,r*.72,start,end); ctx.stroke();
    ctx.save(); ctx.rotate(end); ctx.strokeStyle=\"#e5f1ff\"; ctx.lineWidth=4; ctx.lineCap=\"round\"; ctx.beginPath(); ctx.moveTo(0,r*.10); ctx.lineTo(0,-r*.70); ctx.stroke(); ctx.restore();
    ctx.fillStyle=\"#17304a\"; ctx.beginPath(); ctx.arc(0,0,8,0,Math.PI*2); ctx.fill();
    ctx.fillStyle=\"#e9f3ff\"; ctx.font=`${Math.floor(r*.35)}px system-ui`; ctx.textAlign=\"center\"; ctx.textBaseline=\"alphabetic\"; ctx.fillText(Math.round(displaySpeed).toString(),0,r*.12);
    ctx.fillStyle=\"#8fb0d6\"; ctx.font=`${Math.floor(r*.12)}px system-ui`; ctx.fillText(\"km/h\",0,r*.24);
    ctx.restore(); requestAnimationFrame(draw);
  }
  requestAnimationFrame(draw);

  // GPS
  let lastPos=null;
  function startGPS(){
    if(!(\'geolocation\' in navigator)){ hint.textContent=\"Cihazınız geolokasyon desteklemiyor.\"; return; }
    hint.textContent=\"GPS açılıyor...\"; const opt={enableHighAccuracy:true, maximumAge:1000, timeout:10000};
    navigator.geolocation.watchPosition(onPos,onErr,opt);
  }
  function onPos(pos){
    const {speed,latitude,longitude}=pos.coords, now=pos.timestamp; let kmh=NaN;
    if (speed!=null && !Number.isNaN(speed)) kmh=toKmH(speed);
    else if(lastPos){ const dt=(now-lastPos.t)/1000; const d=haversine(lastPos.lat,lastPos.lon,latitude,longitude); if(dt>0 && d<2000) kmh=toKmH(d/dt); }
    lastPos={lat:latitude,lon:longitude,t:now};
    if(!Number.isNaN(kmh)){ currentSpeed=clamp(kmh,0,300); hint.textContent=\"GPS aktif\"; }
    else hint.textContent=\"Hız hesaplanıyor…\";
    document.getElementById(\'gpsStatus\').textContent=`GPS: ${hint.textContent}`;
  }
  function onErr(err){
    hint.textContent=(err.code===1)?\"İzin reddedildi\":(err.code===2)?\"Sinyal yok\":\"Zaman aşımı\";
    document.getElementById(\'gpsStatus\').textContent=`GPS: ${hint.textContent}`;
  }
  document.getElementById(\'startGPS\').addEventListener(\'click\', startGPS);
})();
</script>
</body>
</html>', '', '', '', '0', '0', '100', '2025-09-07 10:17:26', '2025-09-07 10:24:50');

-- Tablo yapısı: natively_locations
DROP TABLE IF EXISTS `natively_locations`;
CREATE TABLE `natively_locations` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) DEFAULT NULL,
  `identifier` varchar(255) DEFAULT NULL,
  `latitude` decimal(10,6) NOT NULL,
  `longitude` decimal(10,6) NOT NULL,
  `error_text` varchar(255) DEFAULT NULL,
  `ip` varchar(64) DEFAULT NULL,
  `user_agent` varchar(255) DEFAULT NULL,
  `headers_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`headers_json`)),
  `raw_json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`raw_json`)),
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_identifier` (`identifier`),
  KEY `idx_user` (`user_id`),
  KEY `idx_created` (`created_at`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_turkish_ci;

-- Tablo verileri: natively_locations
INSERT INTO `natively_locations` (`id`, `user_id`, `identifier`, `latitude`, `longitude`, `error_text`, `ip`, `user_agent`, `headers_json`, `raw_json`, `created_at`) VALUES
('1', NULL, 'TEST', '50.000001', '50.000001', 'null', '54.189.222.35', 'Bubble', '{\"accept-encoding\":\"gzip, deflate\",\"connection\":\"keep-alive\",\"host\":\"www.silayolusevenler.nl\",\"user-agent\":\"Bubble\",\"x-bubble-depth\":\"1\",\"traceparent\":\"00-c600252a947f79439f629f9a4ff2d289-059512c28b99ef29-01\",\"baggage\":\"bubblegroup.client.version=bcac3e2619d043701e9e985db1e26726c310882e,bubblegroup.client.commit_timestamp=1756935457000,bubblegroup.http.route=workflow%2Fstart,bubblegroup.http.host=app.buildnatively.com,bubblegroup.workflow.appname=nocodenoproblem,bubblegroup.workflow.app_version=live,bubblegroup.workflow.situation=page_wf,bubblegroup.workflow.id=cmTnN,bubblegroup.workflow.event.type=ButtonClicked,bubblegroup.workflow.action.id=cmVwF,bubblegroup.workflow.action.type=apiconnector2-cmVqu.cmVqz\",\"x-https\":\"1\",\"authorization\":\"\"}', '{\"latitude\":\"50.000001\",\"longitude\":\"50.000001\",\"identifier\":\"TEST\",\"error\":\"null\"}', '2025-09-04 13:09:35');

-- Tablo yapısı: pinned_message
DROP TABLE IF EXISTS `pinned_message`;
CREATE TABLE `pinned_message` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `msg_id` varchar(60) NOT NULL,
  `pinned_by` int(10) unsigned NOT NULL,
  `pinned_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `fk_pinned_msg` (`msg_id`),
  KEY `fk_pinned_user` (`pinned_by`),
  CONSTRAINT `fk_pinned_msg` FOREIGN KEY (`msg_id`) REFERENCES `st_messages` (`msg_id`) ON DELETE CASCADE,
  CONSTRAINT `fk_pinned_user` FOREIGN KEY (`pinned_by`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_turkish_ci;

-- Tablo yapısı: pinned_messages
DROP TABLE IF EXISTS `pinned_messages`;
CREATE TABLE `pinned_messages` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `message_id` varchar(60) NOT NULL,
  `pinned_by` int(10) unsigned NOT NULL,
  `pinned_at` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_message` (`message_id`),
  KEY `pinned_by` (`pinned_by`),
  CONSTRAINT `pinned_messages_ibfk_1` FOREIGN KEY (`pinned_by`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=73 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_turkish_ci;

-- Tablo verileri: pinned_messages
INSERT INTO `pinned_messages` (`id`, `message_id`, `pinned_by`, `pinned_at`) VALUES
('9', 'msg_1755687272_6921', '2', '1755782592'),
('45', 'msg_1755796904_6622', '2', '1755797244'),
('61', 'msg_1755859118_4404', '2', '1755859241'),
('63', 'msg_1755859073_4329', '2', '1755859266');

-- Tablo yapısı: remember_tokens
DROP TABLE IF EXISTS `remember_tokens`;
CREATE TABLE `remember_tokens` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `selector` varchar(64) NOT NULL,
  `validator_hash` varchar(255) NOT NULL,
  `user_agent_hash` varchar(64) DEFAULT NULL,
  `ip` varchar(64) DEFAULT NULL,
  `expires_at` datetime NOT NULL,
  `last_used` datetime DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `selector` (`selector`),
  KEY `idx_user` (`user_id`),
  CONSTRAINT `fk_rem_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=115 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_turkish_ci;

-- Tablo verileri: remember_tokens
INSERT INTO `remember_tokens` (`id`, `user_id`, `selector`, `validator_hash`, `user_agent_hash`, `ip`, `expires_at`, `last_used`, `created_at`) VALUES
('14', '11', '799371d904e58a5832', '$2y$10$Iaoa7VGOzyu73B4Rz8Ry3.3o4JZc9tbfoJB0X37hko2XHRk9aYB0G', NULL, '80.57.199.217', '2025-10-05 10:50:13', '2025-09-05 12:50:13', '2025-09-05 12:50:13'),
('19', '11', 'ca81c230ad0615e953', '$2y$10$fbEGF50q2E8vhd1ckC7e5OMltq3ZCBzkbF7m7OOqnfkFb3aKmS/Qy', NULL, '80.57.199.217', '2025-10-05 17:40:46', '2025-09-05 21:57:48', '2025-09-05 19:40:46'),
('91', '2', '595b63354d8f03313a', '$2y$10$.YGVh7uFnK8MTnzg1qUSjOvOpcKJwG5W61tIWUkji9jP9GEqq8XvG', NULL, '31.151.194.220', '2025-10-07 08:17:00', '2025-09-21 10:09:59', '2025-09-07 10:17:00'),
('98', '4', '05b85881dbcef7244b', '$2y$10$wyv/vVu4DSRjilTpt35reux4SGCVJa2WUIVrZ4n6XGYojzolnO4A.', NULL, '109.36.153.153', '2025-10-07 20:28:19', '2025-09-07 22:28:19', '2025-09-07 22:28:19'),
('100', '2', 'f9b31e8ef89653cbee', '$2y$10$cT6d5VZr6KkUYDE2Nd4jP./R54oDMbcfzU4ZQ58hXusgmKKHTSZ02', NULL, '31.151.194.220', '2025-10-08 07:50:50', '2025-09-08 18:06:32', '2025-09-08 09:50:50'),
('101', '4', 'dfedc5c92ec533dce2', '$2y$10$cWnc1Rjslm5ur7zEkgWxnuyxaIjx5Qsl5iAl0XnICnJZDQqIHyGqi', NULL, '31.151.194.220', '2025-10-08 12:50:34', '2025-09-08 15:30:59', '2025-09-08 14:50:34'),
('112', '14', '976467bb112db7c36b', '$2y$10$aOs1GQ4xJzKLNiTIvLTbGOyY.ucwhpLuY2.rRF3EnRak9ZNGiW9gq', NULL, '31.151.194.220', '2025-10-12 18:06:35', '2025-09-12 20:06:42', '2025-09-12 20:06:35'),
('113', '4', '8370787d53f6230727', '$2y$10$2TcCDDXGDh2qtejKUfNvm.5DABW14HVem7RMekYNTe70hIiFSNn0u', NULL, '31.151.194.220', '2025-10-22 09:15:43', '2025-09-22 11:15:43', '2025-09-22 11:15:43'),
('114', '2', '37f4e5be261ec4ee97', '$2y$10$qfhVeGlo1G5N5Aan8ZiemeU2AX.cDu4DfTlKNLMtCS4f9y9hWCium', NULL, '31.151.194.220', '2026-06-20 19:14:19', '2026-05-23 13:58:18', '2026-05-21 21:14:19');

-- Tablo yapısı: safaksayar_settings
DROP TABLE IF EXISTS `safaksayar_settings`;
CREATE TABLE `safaksayar_settings` (
  `user_id` int(10) unsigned NOT NULL,
  `title` varchar(200) DEFAULT NULL,
  `target_datetime` datetime DEFAULT NULL,
  `theme` varchar(40) NOT NULL DEFAULT 'glass',
  `beep` tinyint(1) NOT NULL DEFAULT 0,
  `voice_enabled` tinyint(1) NOT NULL DEFAULT 0,
  `voice_name` varchar(190) DEFAULT NULL,
  `background_image_path` varchar(600) DEFAULT NULL,
  `progress_start` datetime DEFAULT NULL,
  `show_on_home` tinyint(1) NOT NULL DEFAULT 0,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `target_datetime_iso` datetime DEFAULT NULL,
  `progress_start_iso` datetime DEFAULT NULL,
  PRIMARY KEY (`user_id`),
  CONSTRAINT `fk_ss_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_turkish_ci;

-- Tablo verileri: safaksayar_settings
INSERT INTO `safaksayar_settings` (`user_id`, `title`, `target_datetime`, `theme`, `beep`, `voice_enabled`, `voice_name`, `background_image_path`, `progress_start`, `show_on_home`, `updated_at`, `target_datetime_iso`, `progress_start_iso`) VALUES
('2', 'Sıla Yolu Sevenler sayac', '2025-09-08 15:15:00', 'oled', '0', '0', NULL, 'ssuploads/9754092caf42699b.jpg', '2025-09-06 19:46:47', '0', '2025-09-06 21:46:47', '2025-09-07 12:00:00', '2025-09-06 19:10:46'),
('4', 'Sıla Yolu', '2025-09-26 00:52:00', 'minimal', '0', '0', NULL, 'ssuploads/46814e5f3ffa9930.png', '2025-09-22 09:16:40', '0', '2025-09-22 11:16:40', NULL, NULL),
('10', NULL, '2025-09-05 14:21:00', 'glass', '0', '0', NULL, 'ssuploads/5f647366cf67f616.jpg', '2025-09-04 14:24:54', '0', '2025-09-04 16:24:54', NULL, NULL),
('13', 'Sıla Yolu', '2025-09-09 19:31:00', 'minimal', '0', '0', NULL, 'ssuploads/4bb7a8a403ed47d8.png', '2025-09-08 19:29:04', '0', '2025-09-08 21:29:04', NULL, NULL),
('14', 'Sıla Yolu', '2025-09-19 20:05:00', 'glass', '0', '0', NULL, '', '2025-09-12 18:05:47', '0', '2025-09-12 20:05:47', NULL, NULL);

-- Tablo yapısı: settings
DROP TABLE IF EXISTS `settings`;
CREATE TABLE `settings` (
  `name` varchar(100) NOT NULL,
  `value` text DEFAULT NULL,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_turkish_ci;

-- Tablo verileri: settings
INSERT INTO `settings` (`name`, `value`, `updated_at`) VALUES
('admob_banner_android', 'ca-app-pub-3443600270148944/1162904122', '2025-09-06 23:18:16'),
('admob_banner_custom_h', '', '2025-09-06 23:18:16'),
('admob_banner_custom_w', '', '2025-09-06 23:18:16'),
('admob_banner_enabled', '1', '2025-09-06 23:18:16'),
('admob_banner_ios', 'ca-app-pub-3443600270148944/9360371612', '2025-09-06 23:18:16'),
('admob_banner_pad_px', '0', '2025-09-06 23:18:16'),
('admob_banner_position', 'BOTTOM', '2025-09-06 23:18:16'),
('admob_banner_preload', '1', '2025-09-06 23:18:16'),
('admob_banner_show', '1', '2025-09-06 23:18:16'),
('admob_banner_size_type', 'AUTO', '2025-09-06 23:18:16'),
('admob_interstitial_android', 'ca-app-pub-3443600270148944/2826752859', '2025-09-06 23:18:16'),
('admob_interstitial_autoreload', '1', '2025-09-06 23:18:16'),
('admob_interstitial_enabled', '1', '2025-09-06 23:18:16'),
('admob_interstitial_ios', 'ca-app-pub-3443600270148944/4036479471', '2025-09-06 23:18:16'),
('admob_use_test_ids', '1', '2025-09-05 23:41:03'),
('bottom_bar_height', '79', '2025-09-06 23:18:16'),
('bottom_bar_hidden', '1', '2025-09-06 23:18:16'),
('bottombar_icon_color', '#000000', '2025-09-06 23:18:16'),
('card_height_big', '', '2025-09-06 23:18:16'),
('card_height_small', '', '2025-09-06 23:18:16'),
('card_outer_padding', '3', '2025-09-06 23:18:16'),
('card_shadow_enabled', '1', '2025-09-06 23:18:16'),
('color_bg', '#eeeff1', '2025-09-06 23:18:16'),
('color_bottombar', '#ffffff', '2025-09-06 23:18:16'),
('color_card', '#ffffff', '2025-09-06 23:18:16'),
('color_text', '#2a2a2b', '2025-09-06 23:18:16'),
('color_text_inverse', '#000000', '2025-09-06 23:18:16'),
('color_topbar', '#ffffff', '2025-09-06 23:18:16'),
('font_big_family', '-apple-system, system-ui, BlinkMacSystemFont, \"SF Pro Text\", \"SF Pro Display\", \"Helvetica Neue\", Helvetica, Arial, sans-serif', '2025-09-06 23:18:16'),
('font_big_weight', '600', '2025-09-06 23:18:16'),
('font_small_family', '-apple-system, system-ui, BlinkMacSystemFont, \"SF Pro Text\", \"SF Pro Display\", \"Helvetica Neue\", Helvetica, Arial, sans-serif', '2025-09-06 23:18:16'),
('font_small_weight', '500', '2025-09-06 23:18:16'),
('fuel_card_bg', '', '2025-09-06 23:18:16'),
('fuel_card_bg_color', '#ffffff', '2025-09-06 23:18:16'),
('fuel_card_bg_opacity', '1', '2025-09-06 23:18:16'),
('fuel_card_border', '', '2025-09-06 23:18:16'),
('fuel_card_border_color', '#000000', '2025-09-06 23:18:16'),
('fuel_card_border_enabled', '0', '2025-09-06 23:18:16'),
('fuel_card_border_width', '', '2025-09-06 23:18:16'),
('fuel_card_corner_radius', '9', '2025-09-06 23:18:16'),
('fuel_card_enabled_default', '0', '2025-09-06 23:18:16'),
('fuel_card_html', '<!doctype html>
<html lang=\"tr\">
<head>
<meta charset=\"utf-8\" />
<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\" />
<title>Akaryakıt Fiyatları – Widget</title>

<!-- Dar font: sadece widget içinde kullanılacak -->
<link href=\"https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@400;600;700&display=swap\" rel=\"stylesheet\">

<style>
  /* ========= SADECE WIDGET İÇİN ========= */
  .fuel-widget{
    --bg:#ffffff;
    --text:#1f2937;
    --muted:#6b7280;
    --line:#e5e7eb;
    --head-bg:#f8fafc;
    --head-text:#111827;

    --font:\"Roboto Condensed\",\"SF Pro\",-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif;

    --fs-11:11px;
    --fs-12:12px;
    --fs-13:13px;
    --fs-14:14px;
    --fs-15:15px;

    color:var(--text);
    background:transparent;
    font-family:var(--font);   /* sadece widget’ta dar font */
  }

  .fuel-widget .wrap{max-width:920px;margin:0 auto;padding:10px}
  .fuel-widget .card{border:1px solid var(--line);border-radius:10px;overflow:hidden;background:#fff}

  .fuel-widget .table{width:100%;border-collapse:collapse;table-layout:fixed}

  .fuel-widget .thead th{
    background:var(--head-bg);
    color:var(--head-text);
    text-align:left;
    font-weight:700;
    font-size:var(--fs-13);
    padding:10px 12px;
    border-bottom:1px solid var(--line);
    white-space:nowrap;
    vertical-align:bottom;
  }

  /* Sütun genişlikleri – her cihazda sabit */
  .fuel-widget .col-country{width:30%}
  .fuel-widget .col-diesel{width:17.5%}
  .fuel-widget .col-gasoline{width:17.5%}
  .fuel-widget .col-lpg{width:17.5%}

  .fuel-widget .tbody td{
    padding:12px;
    border-bottom:1px solid var(--line);
    font-size:var(--fs-14);
    vertical-align:middle;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  .fuel-widget .tbody tr:last-child td{border-bottom:none}

  /* ülke hücresi */
  .fuel-widget .country-cell{display:flex;align-items:center;gap:8px;min-width:0}
  .fuel-widget .flag{width:18px;height:12px;object-fit:cover;border-radius:2px;background:#f3f4f6;box-shadow:0 0 0 1px rgba(0,0,0,.06)}
  .fuel-widget .country-name{
    font-weight:700;font-size:var(--fs-15);
    overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  }

  /* fiyat hücreleri (EUR + yerel alt satır) */
  .fuel-widget .price{white-space:nowrap}
  .fuel-widget .price-main{
    font-weight:700;
    font-variant-numeric:tabular-nums;
    line-height:1.05;
    display:block;
  }
  .fuel-widget .price-local{
    display:block;
    color:var(--muted);
    font-size:var(--fs-12);
    line-height:1.05;
    margin-top:2px;
  }
  .fuel-widget .dash{color:var(--muted)}
</style>
</head>
<body>

<!-- ==== WIDGET ==== -->
<div class=\"fuel-widget\" id=\"fuel-widget\">
  <div class=\"wrap\">
    <div class=\"card\">
      <table class=\"table\">
        <thead class=\"thead\">
          <tr>
            <th class=\"col-country\">Ülke</th>
            <th class=\"col-diesel\">Dizel</th>
            <th class=\"col-gasoline\">Benzin</th>
            <th class=\"col-lpg\">LPG</th>
          </tr>
        </thead>
        <tbody class=\"tbody\" id=\"fuel-tbody\">
          <tr><td colspan=\"4\" style=\"text-align:center;color:var(--muted);padding:16px\">Yükleniyor…</td></tr>
        </tbody>
      </table>
    </div>
  </div>
</div>
<!-- ==== /WIDGET ==== -->

<script>
/* ========= Ayarlar ========= */
const DATA_URL  = \"akaryakit/data/fuel_eu.json\";   // JSON veritabanı
const ROTATE_MS = 3500;                            // ikinci satır dönüş hızı

/* ISO -> bayrak (flagcdn.com) */
const flagUrl = cc => `https://flagcdn.com/24x18/${cc.toLowerCase()}.png`;

/* Para birimi sembolleri */
const CURRENCY_SYMBOL = {
  \"EUR\":\"€\", \"GBP\":\"£\", \"CHF\":\"CHF\", \"DKK\":\"kr\", \"SEK\":\"kr\", \"NOK\":\"kr\",
  \"PLN\":\"zł\", \"HUF\":\"Ft\", \"TRY\":\"₺\", \"UAH\":\"₴\", \"RUB\":\"₽\", \"BAM\":\"KM\",
  \"BGN\":\"лв\", \"MKD\":\"ден\", \"BYN\":\"Br\", \"RON\":\"lei\", \"CZK\":\"Kč\"
};

/* Sayı formatı */
function fmtNumber(v){
  return Number(v).toLocaleString(\"tr-TR\",{ minimumFractionDigits:2, maximumFractionDigits:2 });
}

/* EUR ana satır + opsiyonel yerel alt satır HTML’i */
function priceCell(eurVal, localPair){
  const eur = (eurVal!=null && isFinite(Number(eurVal)) && Number(eurVal)>0) ? `€\\u00A0${fmtNumber(eurVal)}` : null;
  let localHtml = \"\";
  if(Array.isArray(localPair) && localPair.length>=2){
    const code = String(localPair[0]||\"\").toUpperCase();
    const val  = Number(localPair[1]);
    if(code && isFinite(val) && val>0 && code!==\"EUR\"){
      const sym = CURRENCY_SYMBOL[code] || code;
      localHtml = `<span class=\"price-local\">${sym}\\u00A0${fmtNumber(val)}</span>`;
    }
  }
  if(!eur && !localHtml) return \'<span class=\"dash\">—</span>\';
  return `<span class=\"price-main\">${eur ?? \"\"}</span>${localHtml}`;
}
function tdPrice(eurVal, localPair, extraClass=\"\"){
  return `<td class=\"price ${extraClass}\">${priceCell(eurVal, localPair)}</td>`;
}

/* JSON veritabanını oku */
async function loadDB(){
  const res = await fetch(DATA_URL, {cache:\"no-store\"});
  if(!res.ok) throw new Error(\"Veritabanı okunamadı: \" + res.status);
  const db = await res.json();
  const list = Array.isArray(db.countries) ? db.countries : [];
  const byIso = {};
  for(const c of list){ const iso=(c.iso||\"\").toUpperCase(); if(iso) byIso[iso]=c; }
  const sorted = [...list].sort((a,b)=> (a.name||\"\").localeCompare(b.name||\"\", \"tr\", {sensitivity:\"base\"}));
  return { byIso, sorted };
}

/* Konumdan ülke ISO2 belirleme */
async function getUserIso(){
  let iso=null;
  try{
    const pos = await new Promise((res,rej)=>{
      if(!navigator.geolocation) return rej(new Error(\"Geo yok\"));
      navigator.geolocation.getCurrentPosition(res, rej, {enableHighAccuracy:true, timeout:6000, maximumAge:60000});
    });
    // reverse geocode için ip yedekleniyor
  }catch{}
  try{
    const r=await fetch(\"https://ipapi.co/json/\"); const j=await r.json();
    iso=(j.country_code||\"\").toUpperCase();
  }catch{}
  if(!iso) iso=\"NL\";
  return iso;
}

/* Bir satır HTML */
function rowHtml(country){
  const iso = (country.iso||\"\").toUpperCase();
  const name = country.name || iso;
  const f = country.fuels || {};
  const gas = f.gasoline || {};
  const dsl = f.diesel   || {};
  const lpg = f.lpg      || {};

  return `<tr>
    <td class=\"col-country\">
      <div class=\"country-cell\">
        <img class=\"flag\" src=\"${flagUrl(iso)}\" alt=\"\">
        <span class=\"country-name\">${name}</span>
      </div>
    </td>
    ${tdPrice(dsl.eur, dsl.local, \"col-diesel\")}
    ${tdPrice(gas.eur, gas.local, \"col-gasoline\")}
    ${tdPrice(lpg.eur, lpg.local, \"col-lpg\")}
  </tr>`;
}

/* === MAIN === */
(async function(){
  const tbody = document.getElementById(\"fuel-tbody\");

  try{
    const [{byIso,sorted}, userIso] = await Promise.all([loadDB(), getUserIso()]);
    const me = byIso[userIso];

    if(!me){
      tbody.innerHTML = `<tr><td colspan=\"4\" style=\"text-align:center;color:var(--muted);padding:16px\">
        Bu ülke için veri bulunamadı.
      </td></tr>`;
      return;
    }

    const firstRow = rowHtml(me);
    const rotation = sorted.filter(c => (c.iso||\"\").toUpperCase() !== userIso);
    let i = 0;

    function render(){
      const current = rotation.length ? rotation[i % rotation.length] : null;
      const secondRow = current ? rowHtml(current)
                                : `<tr><td colspan=\"4\" class=\"dash\" style=\"text-align:center\">Gösterilecek başka ülke yok</td></tr>`;
      tbody.innerHTML = firstRow + secondRow;
      i++;
    }

    render();
    setInterval(render, ROTATE_MS);

  }catch(err){
    console.error(err);
    tbody.innerHTML = `<tr><td colspan=\"4\" style=\"text-align:center;color:var(--muted);padding:16px\">Bir hata oluştu.</td></tr>`;
  }
})();
</script>
</body>
</html>
', '2025-09-06 23:18:16'),
('fuel_card_image_padding', '', '2025-09-06 23:18:16'),
('fuel_card_link_content_id', '124', '2025-09-06 23:18:16'),
('fuel_card_padding', '0', '2025-09-06 23:18:16'),
('fuel_card_radius', '', '2025-09-06 23:18:16'),
('fuel_card_shadow', '', '2025-09-06 23:18:16'),
('fuel_card_shadow_blur', '6', '2025-09-06 23:18:16'),
('fuel_card_shadow_color', '#000000', '2025-09-06 23:18:16'),
('fuel_card_shadow_enabled', '0', '2025-09-06 23:18:16'),
('fullscreen_card_bg_color', '#ffffff', '2025-09-06 23:18:16'),
('fullscreen_card_bg_opacity', '0', '2025-09-06 23:18:16'),
('fullscreen_card_border_color', '#ff0000', '2025-09-06 23:18:16'),
('fullscreen_card_border_enabled', '0', '2025-09-06 23:18:16'),
('fullscreen_card_border_width', '13.2', '2025-09-06 23:18:16'),
('fullscreen_card_corner_radius', '0', '2025-09-06 23:18:16'),
('fullscreen_card_image_padding', '0', '2025-09-06 23:18:16'),
('fullscreen_card_padding', '0', '2025-09-06 23:18:16'),
('fullscreen_card_shadow_blur', '8', '2025-09-06 23:18:16'),
('fullscreen_card_shadow_color', '#000000', '2025-09-06 23:18:16'),
('fullscreen_card_shadow_enabled', '0', '2025-09-06 23:18:16'),
('grid_gap', '9', '2025-09-06 23:18:16'),
('home_icon_border_color', '#000000', '2025-09-06 23:18:16'),
('home_icon_border_enabled', '1', '2025-09-06 23:18:16'),
('home_icon_border_width', '0.1', '2025-09-06 23:18:16'),
('home_icon_padding', '10', '2025-09-06 23:18:16'),
('inactive_menu_opacity', '0.4', '2025-09-06 23:18:16'),
('leaderboard_card_bg_color', '#ffffff', '2025-09-06 23:18:16'),
('leaderboard_card_bg_opacity', '1', '2025-09-06 23:18:16'),
('leaderboard_card_border_color', '#dddddd', '2025-09-06 23:18:16'),
('leaderboard_card_border_enabled', '0', '2025-09-06 23:18:16'),
('leaderboard_card_border_width', '0', '2025-09-06 23:18:16'),
('leaderboard_card_corner_radius', '9', '2025-09-06 23:18:16'),
('leaderboard_card_image_padding', '0', '2025-09-06 23:18:16'),
('leaderboard_card_padding', '0', '2025-09-06 23:18:16'),
('leaderboard_card_shadow_blur', '8', '2025-09-06 23:18:16'),
('leaderboard_card_shadow_color', '#000000', '2025-09-06 23:18:16'),
('leaderboard_card_shadow_enabled', '0', '2025-09-06 23:18:16'),
('natively_bottom_bar_hidden', '1', '2025-09-06 23:18:16'),
('natively_header_name', '', '2025-09-06 23:18:16'),
('natively_header_value', '', '2025-09-06 23:18:16'),
('radius_big_img', '5', '2025-08-27 14:06:39'),
('radius_icon', '5', '2025-08-27 14:06:39'),
('radius_small_img', '5', '2025-08-27 14:06:39'),
('radius_sponsor', '5', '2025-08-27 14:06:39'),
('sponsor_card_bg_color', '#ffffff', '2025-09-06 23:18:16'),
('sponsor_card_bg_opacity', '0', '2025-09-06 23:18:16'),
('sponsor_card_border_color', '#000000', '2025-09-06 23:18:16'),
('sponsor_card_border_enabled', '0', '2025-09-06 23:18:16'),
('sponsor_card_border_width', '', '2025-09-06 23:18:16'),
('sponsor_card_corner_radius', '', '2025-09-06 23:18:16'),
('sponsor_card_image_padding', '', '2025-09-06 23:18:16'),
('sponsor_card_padding', '', '2025-09-06 23:18:16'),
('sponsor_card_shadow_blur', '', '2025-09-06 23:18:16'),
('sponsor_card_shadow_color', '#000000', '2025-09-06 23:18:16'),
('sponsor_card_shadow_enabled', '0', '2025-09-06 23:18:16'),
('top_bar_height', '90', '2025-09-06 23:18:16'),
('top_bar_offset_y', '20', '2025-09-06 23:18:16'),
('topbar_icon_color', '#000000', '2025-09-06 23:18:16'),
('ui_card_padding', '6', '2025-09-06 23:18:16'),
('ui_corner_radius', '9', '2025-09-06 23:18:16'),
('ui_image_padding', '3', '2025-09-06 23:18:16'),
('ui_image_radius', '9', '2025-09-06 23:18:16'),
('ui_text_padding', '2', '2025-09-06 23:18:16');

-- Tablo yapısı: st_admin_prefs
DROP TABLE IF EXISTS `st_admin_prefs`;
CREATE TABLE `st_admin_prefs` (
  `user_id` int(10) unsigned NOT NULL,
  `show_location` tinyint(1) NOT NULL DEFAULT 1,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`user_id`),
  CONSTRAINT `fk_stap_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_turkish_ci;

-- Tablo verileri: st_admin_prefs
INSERT INTO `st_admin_prefs` (`user_id`, `show_location`, `updated_at`) VALUES
('2', '1', '2025-08-22 13:22:17'),
('4', '1', '2025-09-06 11:33:32');

-- Tablo yapısı: st_banned_ips
DROP TABLE IF EXISTS `st_banned_ips`;
CREATE TABLE `st_banned_ips` (
  `ip_address` varchar(64) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`ip_address`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_turkish_ci;

-- Tablo yapısı: st_locations
DROP TABLE IF EXISTS `st_locations`;
CREATE TABLE `st_locations` (
  `user_id` int(10) unsigned NOT NULL,
  `lat` double NOT NULL,
  `lng` double NOT NULL,
  `timestamp` int(10) unsigned NOT NULL,
  PRIMARY KEY (`user_id`),
  KEY `idx_time` (`timestamp`),
  CONSTRAINT `fk_stloc_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_turkish_ci;

-- Tablo verileri: st_locations
INSERT INTO `st_locations` (`user_id`, `lat`, `lng`, `timestamp`) VALUES
('2', '51.690779756436', '4.6565086408755', '1757278880'),
('4', '51.80546329064', '4.7143781900974', '1757338271'),
('11', '51.8812475', '5.5978352', '1757069487'),
('13', '51.80546329064', '4.7143781900974', '1757406386');

-- Tablo yapısı: st_mentions
DROP TABLE IF EXISTS `st_mentions`;
CREATE TABLE `st_mentions` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `mentioned_user_id` int(10) unsigned NOT NULL,
  `from_user_id` int(10) unsigned NOT NULL,
  `from_username` varchar(100) DEFAULT NULL,
  `message` text NOT NULL,
  `msg_id` varchar(60) NOT NULL,
  `is_read` tinyint(1) NOT NULL DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `idx_mentioned` (`mentioned_user_id`),
  KEY `fk_stm_user2` (`from_user_id`),
  KEY `idx_is_read` (`is_read`),
  CONSTRAINT `fk_stm_user1` FOREIGN KEY (`mentioned_user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `fk_stm_user2` FOREIGN KEY (`from_user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_turkish_ci;

-- Tablo verileri: st_mentions
INSERT INTO `st_mentions` (`id`, `mentioned_user_id`, `from_user_id`, `from_username`, `message`, `msg_id`, `is_read`, `created_at`) VALUES
('1', '2', '4', 'Kullanıcı adı', '@sysadmin', 'msg_1755606234_3226', '1', '2025-08-19 14:23:54'),
('2', '2', '4', 'Ford', '@sysadmin merhaba', 'msg_1755677826_9142', '1', '2025-08-20 10:17:06'),
('3', '2', '4', 'Ford', '@sysadmin test', 'msg_1755678156_2272', '1', '2025-08-20 10:22:36'),
('4', '4', '2', 'SYSadmin', '@ford merhaba', 'msg_1755678188_6280', '1', '2025-08-20 10:23:08'),
('5', '4', '2', 'SYSadmin', '@ford nasilsiniz', 'msg_1755678229_5958', '1', '2025-08-20 10:23:49'),
('6', '4', '2', 'SYSadmin', '@ford bugun cikacakmisiniz', 'msg_1755678248_9214', '1', '2025-08-20 10:24:08'),
('7', '2', '4', 'Ford', '@sysadmin evet', 'msg_1755678280_9021', '1', '2025-08-20 10:24:40'),
('8', '2', '4', 'Ford', '@sysadmin mergaba', 'msg_1755678323_5649', '1', '2025-08-20 10:25:23'),
('9', '4', '2', 'SYSadmin', '@ford nereden', 'msg_1755678342_4349', '1', '2025-08-20 10:25:42'),
('10', '4', '2', 'SYSadmin', '@ford merhaba', 'msg_1755678520_5117', '1', '2025-08-20 10:28:40'),
('11', '4', '2', 'SYSadmin', '@ford merhaba', 'msg_1755678599_6068', '1', '2025-08-20 10:29:59'),
('12', '4', '2', 'SYSadmin', '@ford merhaba', 'msg_1755678619_8108', '1', '2025-08-20 10:30:19'),
('13', '4', '2', 'SYSadmin', '@ford merhabamerhaba', 'msg_1755678823_1268', '1', '2025-08-20 10:33:43'),
('14', '2', '4', 'Ford', '@sysadmin mergaba', 'msg_1755678848_4667', '1', '2025-08-20 10:34:08'),
('20', '2', '4', 'Ford', '@sysadmin ggggg', 'msg_1755680017_1866', '1', '2025-08-20 10:53:37'),
('24', '2', '4', 'Ford', '@sysadmin test', 'msg_1755680450_7084', '1', '2025-08-20 11:00:50'),
('25', '2', '4', 'Ford', '@sysadmin ggggg', 'msg_1755681146_4037', '1', '2025-08-20 11:12:26'),
('26', '2', '4', 'Ford', '@sysadmin kkkkkk', 'msg_1755681173_7542', '1', '2025-08-20 11:12:53'),
('27', '2', '4', 'Ford', '@sysadmin', 'msg_1755685664_7429', '1', '2025-08-20 12:27:44');

-- Tablo yapısı: st_messages
DROP TABLE IF EXISTS `st_messages`;
CREATE TABLE `st_messages` (
  `msg_id` varchar(60) NOT NULL,
  `user_id` int(10) unsigned NOT NULL,
  `message` text NOT NULL,
  `caption` text DEFAULT NULL,
  `type` varchar(20) DEFAULT 'text',
  `timestamp` int(10) unsigned NOT NULL,
  `is_deleted` tinyint(1) NOT NULL DEFAULT 0,
  `deleted` tinyint(1) DEFAULT 0,
  `deleted_at` int(11) DEFAULT NULL,
  `deleted_by` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`msg_id`),
  KEY `idx_user_time` (`user_id`,`timestamp`),
  KEY `fk_deleted_by` (`deleted_by`),
  CONSTRAINT `fk_deleted_by` FOREIGN KEY (`deleted_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `fk_stmsg_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_turkish_ci;

-- Tablo verileri: st_messages
INSERT INTO `st_messages` (`msg_id`, `user_id`, `message`, `caption`, `type`, `timestamp`, `is_deleted`, `deleted`, `deleted_at`, `deleted_by`) VALUES
('msg_1757001406_4672', '4', 'Selam', '', 'text', '1757001406', '0', '0', NULL, NULL),
('msg_1757001413_3175', '4', 'Test mesaj', '', 'text', '1757001413', '0', '0', NULL, NULL),
('msg_1757001427_3165', '4', 'https://www.silayolusevenler.nl/appnew/silatakip/uploads/img_1757001426_1414.png', '', 'image', '1757001427', '0', '0', NULL, NULL),
('msg_1757069475_1432', '11', 'Mesajlaşma için yolda olan var mi', '', 'text', '1757069475', '0', '0', NULL, NULL),
('msg_1757069482_6470', '11', 'Tüneller niye parali', '', 'text', '1757069482', '0', '0', NULL, NULL),
('msg_1757082924_6150', '4', 'https://www.silayolusevenler.nl/appnew/silatakip/uploads/img_1757082924_5377.png', '', 'image', '1757082924', '0', '0', NULL, NULL),
('msg_1757107317_1577', '4', 'Test', '', 'text', '1757107317', '0', '0', NULL, NULL),
('msg_1757148780_8221', '4', 'https://www.silayolusevenler.nl/appnew/silatakip/uploads/img_1757148779_4380.png', '', 'image', '1757148780', '0', '0', NULL, NULL);

-- Tablo yapısı: st_typing_status
DROP TABLE IF EXISTS `st_typing_status`;
CREATE TABLE `st_typing_status` (
  `user_id` int(10) unsigned NOT NULL,
  `is_typing` tinyint(1) NOT NULL DEFAULT 0,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`user_id`),
  CONSTRAINT `fk_sttype_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_turkish_ci;

-- Tablo verileri: st_typing_status
INSERT INTO `st_typing_status` (`user_id`, `is_typing`, `updated_at`) VALUES
('2', '0', '2025-08-22 13:34:45'),
('4', '0', '2025-09-05 23:21:59'),
('11', '0', '2025-09-05 12:51:24');

-- Tablo yapısı: user_settings
DROP TABLE IF EXISTS `user_settings`;
CREATE TABLE `user_settings` (
  `user_id` int(10) unsigned NOT NULL,
  `show_fuel_card` tinyint(1) NOT NULL DEFAULT 0,
  `show_safak_on_home` tinyint(1) NOT NULL DEFAULT 0,
  `safak_beep` tinyint(1) NOT NULL DEFAULT 0,
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`user_id`),
  CONSTRAINT `fk_user_settings_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_turkish_ci;

-- Tablo verileri: user_settings
INSERT INTO `user_settings` (`user_id`, `show_fuel_card`, `show_safak_on_home`, `safak_beep`, `updated_at`) VALUES
('2', '1', '1', '0', '2025-09-02 11:50:02'),
('4', '1', '1', '1', '2025-09-06 17:31:42'),
('10', '1', '1', '0', '2025-09-04 16:21:10'),
('11', '1', '1', '0', '2025-09-05 12:48:49'),
('13', '1', '1', '0', '2025-09-07 19:31:24'),
('14', '1', '1', '0', '2025-09-12 20:05:47');

-- Tablo yapısı: users
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(100) DEFAULT NULL,
  `email` varchar(190) NOT NULL,
  `password_hash` varchar(255) NOT NULL,
  `first_name` varchar(100) DEFAULT NULL,
  `last_name` varchar(100) DEFAULT NULL,
  `phone` varchar(50) DEFAULT NULL,
  `country` varchar(100) DEFAULT NULL,
  `profile_image_path` varchar(500) DEFAULT NULL,
  `hometown` varchar(100) DEFAULT NULL,
  `vehicle_brand` varchar(100) DEFAULT NULL,
  `show_location` tinyint(1) NOT NULL DEFAULT 0,
  `is_admin` tinyint(1) NOT NULL DEFAULT 0,
  `is_superadmin` tinyint(1) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `theme_mode` tinyint(1) NOT NULL DEFAULT 0,
  `last_login_at` datetime DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`),
  UNIQUE KEY `uniq_users_username` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_turkish_ci;

-- Tablo verileri: users
INSERT INTO `users` (`id`, `username`, `email`, `password_hash`, `first_name`, `last_name`, `phone`, `country`, `profile_image_path`, `hometown`, `vehicle_brand`, `show_location`, `is_admin`, `is_superadmin`, `is_active`, `theme_mode`, `last_login_at`, `created_at`, `updated_at`) VALUES
('1', 'superadmin', 'admin@example.com', '$2y$10$Y2B8HREeWEgXqDCV0la.x..MSOzy7Twm8dFp09hrn4DTVtlN8unNS', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', '1', '1', '1', '1', '2025-08-12 15:58:55', '2025-08-10 14:12:59', '2025-08-12 15:58:55'),
('2', 'SYSadmin', 'silayolusevenler@gmail.com', '$2y$10$Te7BPCYf57h0qPBXHjrAzeGfhqhcdS4fzBu49Nu74Qwk3bpoFMGgG', 'Sila Yolu', 'Sevenler', '+905325324343', 'Hollanda', 'profile_uploads/c495af5639c83fd1.png', 'Muğla', 'Mercedes-Benz', '1', '1', '1', '1', '1', NULL, '2025-08-11 10:02:34', '2025-09-04 15:58:28'),
('4', 'Ford', 'ford@ford.com', '$2y$10$HtiBmpAJD84DBTgSLFbAo.KVIzhYGl9U4U5fCEA2JvEedYB6jXzci', 'Önder', 'Yok yav', '', '', 'profile_uploads/88583ad9f3f8d08b.jpg', 'Nevşehir', 'Volvo', '1', '1', '0', '1', '0', NULL, '2025-08-19 00:18:05', '2025-09-06 11:33:32'),
('10', 'Maccan-50', 'oozbek@msn.com', '$2y$10$RjQQFfesGUKguYBGg/pUWeJnetf9Kp6Rq4BB7SEenIK/m4z3VvmDK', 'Önder', 'Özbek', '', 'Hollanda', 'profile_uploads/1442f42a062cb4f3.jpg', 'Nevşehir', 'Mercedes-Benz', '0', '0', '0', '1', '0', NULL, '2025-09-04 16:20:55', '2025-09-04 16:20:55'),
('11', 'Systest', 'test@test.nl', '$2y$10$LpGO4NUViHwGZ.wJZMxfWuUbjIAOFr3EpzqvDkBjIT5IamvpE7AGK', 'Sivas', 'Delisi', '', 'HollandA', 'profile_uploads/f9457eb0ff366a06.jpg', 'Sivas', 'Skoda', '0', '0', '0', '1', '0', NULL, '2025-09-05 12:48:28', '2025-09-05 20:31:57'),
('12', 'Theturk', 'bmw@bmv.com', '$2y$10$rZVh8877NpQitsOYuq0NAufrD00r2P9g0CYdN1PskHwi2.K2yG4EG', 'The Turk', 'Turk', '', '', 'profile_uploads/cea93b3d56b6b74c.jpg', 'Ankara', 'BMW', '0', '0', '0', '1', '0', NULL, '2025-09-07 17:23:01', '2025-09-07 17:23:01'),
('13', 'rr@rr.com', 'rr@rr.com', '$2y$10$k1dyYdBhmxnrYAWBLl1GQ.TTI7l745R.y9RkP091MEqUs1ne9cqLy', 'Ahmet Asıf', 'Soy', '', 'Hollanda', 'profile_uploads/c05c13d6a21b21cb.jpg', 'Ankara', 'Kia', '0', '0', '0', '1', '0', NULL, '2025-09-07 19:30:21', '2025-09-07 19:30:21'),
('14', 'Test user', 'testuser@test.com', '$2y$10$ZHqweJnMoME8mXIB8o.EL.FvQvrb1XuxsVc3a.7TPAmP6c1ZWlFeK', 'Test user user', 'User', '', '', '', 'Nevşehir', 'Mercedes-Benz', '0', '0', '0', '1', '0', NULL, '2025-09-12 20:04:50', '2025-09-12 20:07:56');

SET FOREIGN_KEY_CHECKS = 1;
