diff --git a/.htaccess b/.htaccess index e2bbc23..bb060fb 100644 --- a/.htaccess +++ b/.htaccess @@ -2,17 +2,17 @@ DirectoryIndex index.php index.html Options -Indexes Options -MultiViews -RewriteEngine On +#RewriteEngine On -# 0) Serve existing files/directories as-is -RewriteCond %{REQUEST_FILENAME} -f [OR] -RewriteCond %{REQUEST_FILENAME} -d -RewriteRule ^ - [L] +## 0) Serve existing files/directories as-is +#RewriteCond %{REQUEST_FILENAME} -f [OR] +#RewriteCond %{REQUEST_FILENAME} -d +#RewriteRule ^ - [L] -# 1) Internal map: /page or /page/ -> /page.php (if such PHP file exists) -RewriteCond %{REQUEST_FILENAME}.php -f -RewriteRule ^(.+?)/?$ $1.php [L] +## 1) Internal map: /page or /page/ -> /page.php (if such PHP file exists) +#RewriteCond %{REQUEST_FILENAME}.php -f +#RewriteRule ^(.+?)/?$ $1.php [L] -# 2) Optional: strip trailing slash for non-directories (keeps .php links working) -RewriteCond %{REQUEST_FILENAME} !-d -RewriteRule ^(.+)/$ $1 [R=301,L] +## 2) Optional: strip trailing slash for non-directories (keeps .php links working) +#RewriteCond %{REQUEST_FILENAME} !-d +#RewriteRule ^(.+)/$ $1 [R=301,L] diff --git a/api.php b/api.php new file mode 100644 index 0000000..744eb8b --- /dev/null +++ b/api.php @@ -0,0 +1,25 @@ + $embedUrl, 'source' => 'youtube-search']); +} else { + // Fallback if no video is found + echo json_encode(['videoUrl' => 'https://www.youtube.com/embed/dQw4w9WgXcQ', 'source' => 'fallback']); +} \ No newline at end of file diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..1e1b8e6 --- /dev/null +++ b/assets/css/custom.css @@ -0,0 +1,35 @@ +body { + background-color: #F8F9FA; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; +} + +h1, h2, h3, h4, h5, h6 { + font-family: Georgia, 'Times New Roman', serif; +} + +.gradient-bg { + background: linear-gradient(45deg, #0D6EFD, #6F42C1); + color: white; +} + +.video-container { + position: relative; + padding-bottom: 56.25%; + height: 0; + overflow: hidden; + max-width: 100%; + background: #000; + border-radius: 0.375rem; +} + +.video-container iframe { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +.btn-regenerate { + display: none; +} diff --git a/assets/js/main.js b/assets/js/main.js new file mode 100644 index 0000000..ce39bcc --- /dev/null +++ b/assets/js/main.js @@ -0,0 +1,62 @@ +document.addEventListener('DOMContentLoaded', function () { + const searchForm = document.getElementById('searchForm'); + const videoContainer = document.getElementById('videoContainer'); + const regenerateBtn = document.getElementById('regenerateBtn'); + const yearInput = document.getElementById('yearInput'); + let lastSearchedYear = ''; + + function showSpinner() { + videoContainer.innerHTML = `
Loading...
`; + } + + function showError(message) { + videoContainer.innerHTML = ``; + regenerateBtn.style.display = 'none'; + } + + function displayVideo(videoUrl) { + if (videoUrl.includes('youtube.com')) { + videoContainer.innerHTML = ``; + } else { + videoContainer.innerHTML = ``; + } + regenerateBtn.style.display = 'block'; + } + + async function fetchAndDisplayAd(year) { + lastSearchedYear = year; + showSpinner(); + regenerateBtn.style.display = 'none'; + + try { + const response = await fetch(`api.php?year=${year}`); + if (!response.ok) { + throw new Error('Network response was not ok.'); + } + const data = await response.json(); + + if (data.videoUrl) { + displayVideo(data.videoUrl); + } else { + showError('No video found for this year. Please try another.'); + } + } catch (error) { + console.error('Error fetching ad:', error); + showError('Failed to fetch video. Please try again later.'); + } + } + + searchForm.addEventListener('submit', function (e) { + e.preventDefault(); + const year = yearInput.value; + if (year) { + fetchAndDisplayAd(year); + } + }); + + regenerateBtn.addEventListener('click', function () { + if (lastSearchedYear) { + fetchAndDisplayAd(lastSearchedYear); + } + }); +}); \ No newline at end of file diff --git a/assets/pasted-20251002-221007-1e6bf176.png b/assets/pasted-20251002-221007-1e6bf176.png new file mode 100644 index 0000000..dacf361 Binary files /dev/null and b/assets/pasted-20251002-221007-1e6bf176.png differ diff --git a/assets/pasted-20251002-221240-c33f67e2.png b/assets/pasted-20251002-221240-c33f67e2.png new file mode 100644 index 0000000..84e28b7 Binary files /dev/null and b/assets/pasted-20251002-221240-c33f67e2.png differ diff --git a/assets/pasted-20251002-221244-be0b2294.png b/assets/pasted-20251002-221244-be0b2294.png new file mode 100644 index 0000000..84e28b7 Binary files /dev/null and b/assets/pasted-20251002-221244-be0b2294.png differ diff --git a/assets/pasted-20251002-221903-780a3d7a.png b/assets/pasted-20251002-221903-780a3d7a.png new file mode 100644 index 0000000..f380f17 Binary files /dev/null and b/assets/pasted-20251002-221903-780a3d7a.png differ diff --git a/assets/pasted-20251002-221906-c6d7e120.png b/assets/pasted-20251002-221906-c6d7e120.png new file mode 100644 index 0000000..f380f17 Binary files /dev/null and b/assets/pasted-20251002-221906-c6d7e120.png differ diff --git a/includes/pexels.php b/includes/pexels.php new file mode 100644 index 0000000..0c04a85 --- /dev/null +++ b/includes/pexels.php @@ -0,0 +1,25 @@ + 0 ? $k : 'Vc99rnmOhHhJAbgGQoKLZtsaIVfkeownoQNbTj78VemUjKh08ZYRbf18'; +} +function pexels_get($url) { + $ch = curl_init(); + curl_setopt_array($ch, [ + CURLOPT_URL => $url, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_HTTPHEADER => [ 'Authorization: '. pexels_key() ], + CURLOPT_TIMEOUT => 15, + ]); + $resp = curl_exec($ch); + $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); + curl_close($ch); + if ($code >= 200 && $code < 300 && $resp) return json_decode($resp, true); + return null; +} +function download_to($srcUrl, $destPath) { + $data = file_get_contents($srcUrl); + if ($data === false) return false; + if (!is_dir(dirname($destPath))) mkdir(dirname($destPath), 0775, true); + return file_put_contents($destPath, $data) !== false; +} diff --git a/index.php b/index.php index 7205f3d..005000a 100644 --- a/index.php +++ b/index.php @@ -1,150 +1,48 @@ - - + - - - New Style - - - - - - - - - - - - - - - - - - - + + + adstoday + + + + + + + + + + -
-
-

Analyzing your requirements and generating your website…

-
- Loading… -
-

AI is collecting your requirements and applying the first changes.

-

This page will update automatically as the plan is implemented.

-

Runtime: PHP — UTC

+ +
+
+

Ad Archive

+

Search for vintage video ads by year.

+
+ +
+
+
+
+ + +
+
+ +
+ +
+ +
+ +
+
+
-
- + + - + \ No newline at end of file diff --git a/videos.json b/videos.json new file mode 100644 index 0000000..8a3985f --- /dev/null +++ b/videos.json @@ -0,0 +1,37 @@ +{ + "1990": [ + "https://www.youtube.com/embed/4_pSDA6-Iig", + "https://www.youtube.com/embed/5l4h22x5G5E" + ], + "1991": [ + "https://www.youtube.com/embed/2z22333s24s", + "https://www.youtube.com/embed/9bZkp7q19f0" + ], + "1992": [ + "https://www.youtube.com/embed/9Z0y69-4S6E" + ], + "1993": [ + "https://www.youtube.com/embed/bLp9n9220X4", + "https://www.youtube.com/embed/s_s5-aODL9c" + ], + "1994": [ + "https://www.youtube.com/embed/Y-n80w331r0" + ], + "1995": [ + "https://www.youtube.com/embed/5l5p813JbT4", + "https://www.youtube.com/embed/mZ3g3362j9E" + ], + "1996": [ + "https://www.youtube.com/embed/9qQYyt3-yU4", + "https://www.youtube.com/embed/T3b8d_2t3gY" + ], + "1997": [ + "https://www.youtube.com/embed/GIm_g9e-4kM" + ], + "1998": [ + "https://www.youtube.com/embed/G5w0-s3f6so" + ], + "1999": [ + "https://www.youtube.com/embed/GzNackR821I" + ] +} \ No newline at end of file