diff --git a/api/pexels.php b/api/pexels.php new file mode 100644 index 0000000..068a4a5 --- /dev/null +++ b/api/pexels.php @@ -0,0 +1,32 @@ + 'assets/images/pexels/'.$p['id'].'.jpg', + 'photographer' => $p['photographer'] ?? 'Unknown', + 'photographer_url' => $p['photographer_url'] ?? '', + 'alt' => $p['alt'] ?? 'Image related to ' . trim($q) + ]; + } else { + // Fallback: Picsum + $out[] = [ + 'src' => 'https://picsum.photos/seed/'.urlencode(trim($q)).'/800/600', + 'photographer' => 'Random Picsum', + 'photographer_url' => 'https://picsum.photos/', + 'alt' => 'Placeholder image for ' . trim($q) + ]; + } +} +echo json_encode($out); diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..189065f --- /dev/null +++ b/assets/css/custom.css @@ -0,0 +1,77 @@ + +body { + font-family: 'Poppins', sans-serif; + color: #212529; + background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab); + background-size: 400% 400%; + animation: gradient-animation 15s ease infinite; +} + +@keyframes gradient-animation { + 0% { + background-position: 0% 50%; + } + 50% { + background-position: 100% 50%; + } + 100% { + background-position: 0% 50%; + } +} + +.header-gradient { + background: linear-gradient(90deg, #6C63FF, #4CC9F0); + color: white; + padding: 4rem 0; + margin-bottom: 3rem; +} + +.calculator-card { + background-color: rgba(255, 255, 255, 0.8); + backdrop-filter: blur(10px); + border-radius: 0.5rem; + box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); + padding: 2rem; + border: 1px solid rgba(255, 255, 255, 0.2); +} + +.form-control, .form-select { + border-radius: 0.5rem; +} + +.btn-primary { + background-color: #6C63FF; + border-color: #6C63FF; + border-radius: 0.5rem; + padding: 0.75rem 1.5rem; +} + +.btn-primary:hover { + background-color: #574fd8; + border-color: #574fd8; +} + +.result { + background-color: #e9ecef; + padding: 1.5rem; + border-radius: 0.5rem; + text-align: center; +} + +.result h3 { + margin-bottom: 0.5rem; + font-weight: 600; +} + +.result p { + font-size: 1.5rem; + font-weight: 700; + color: #6C63FF; + margin-bottom: 0; +} + +footer { + padding: 2rem 0; + margin-top: 3rem; + background-color: #FFFFFF; +} diff --git a/assets/images/pexels/1602726.jpg b/assets/images/pexels/1602726.jpg new file mode 100644 index 0000000..4b40d6c Binary files /dev/null and b/assets/images/pexels/1602726.jpg differ diff --git a/assets/images/pexels/534216.jpg b/assets/images/pexels/534216.jpg new file mode 100644 index 0000000..bf5ec8e Binary files /dev/null and b/assets/images/pexels/534216.jpg differ diff --git a/assets/images/pexels/60504.jpg b/assets/images/pexels/60504.jpg new file mode 100644 index 0000000..d99440c Binary files /dev/null and b/assets/images/pexels/60504.jpg differ diff --git a/assets/images/pexels/6958539.jpg b/assets/images/pexels/6958539.jpg new file mode 100644 index 0000000..c6e4806 Binary files /dev/null and b/assets/images/pexels/6958539.jpg differ diff --git a/assets/js/main.js b/assets/js/main.js new file mode 100644 index 0000000..21456b0 --- /dev/null +++ b/assets/js/main.js @@ -0,0 +1,39 @@ + +document.addEventListener('DOMContentLoaded', function () { + const loanAmountInput = document.getElementById('loanAmount'); + const interestRateInput = document.getElementById('interestRate'); + const loanTermInput = document.getElementById('loanTerm'); + + const monthlyPaymentDisplay = document.getElementById('monthlyPayment'); + const totalInterestDisplay = document.getElementById('totalInterest'); + + function calculateLoan() { + const principal = parseFloat(loanAmountInput.value) || 0; + const annualInterestRate = parseFloat(interestRateInput.value) || 0; + const years = parseInt(loanTermInput.value) || 0; + + if (principal > 0 && annualInterestRate > 0 && years > 0) { + const monthlyInterestRate = annualInterestRate / 100 / 12; + const numberOfPayments = years * 12; + + const numerator = monthlyInterestRate * Math.pow(1 + monthlyInterestRate, numberOfPayments); + const denominator = Math.pow(1 + monthlyInterestRate, numberOfPayments) - 1; + const monthlyPayment = principal * (numerator / denominator); + + const totalPaid = monthlyPayment * numberOfPayments; + const totalInterest = totalPaid - principal; + + monthlyPaymentDisplay.textContent = `$${monthlyPayment.toFixed(2)}`; + totalInterestDisplay.textContent = `$${totalInterest.toFixed(2)}`; + } else { + monthlyPaymentDisplay.textContent = '$0.00'; + totalInterestDisplay.textContent = '$0.00'; + } + } + + [loanAmountInput, interestRateInput, loanTermInput].forEach(input => { + input.addEventListener('input', calculateLoan); + }); + + calculateLoan(); // Initial calculation +}); diff --git a/includes/pexels.php b/includes/pexels.php new file mode 100644 index 0000000..b16e87b --- /dev/null +++ b/includes/pexels.php @@ -0,0 +1,27 @@ + 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) { + if (!is_dir(dirname($destPath))) { + mkdir(dirname($destPath), 0775, true); + } + $data = file_get_contents($srcUrl); + if ($data === false) return false; + return file_put_contents($destPath, $data) !== false; +} diff --git a/index.php b/index.php index 6f7ffab..387ee36 100644 --- a/index.php +++ b/index.php @@ -1,131 +1,75 @@ - - + - - - New Style - - - - + + + Interactive Loan Calculator + + + + + -
-
-

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

-
-
- + +
+
+

Loan Calculator

+

Instantly calculate your monthly loan payments.

+
+
+ +
+
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+
+

Monthly Payment

+

$0.00

+
+
+
+
+

Total Interest Paid

+

$0.00

+
+
+
+
+
+
+
+ A person using a laptop and calculator for financial planning. +
+
+ + +
+ + + + + - + \ No newline at end of file