⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.235
Server IP:
162.0.217.164
Server:
Linux premium256.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
Server Software:
LiteSpeed
PHP Version:
8.0.30
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
niyknzcu
/
techechi.shop
/
View File Name :
contact.js
const contactForm = document.getElementById("contactForm"); const contactName = document.getElementById("contactName"); const contactEmail = document.getElementById("contactEmail"); const contactPhone = document.getElementById("contactPhone"); const contactMessage = document.getElementById("contactMessage"); const contactStatus = document.getElementById("contactStatus"); const nameRegex = /^[A-Za-z][A-Za-z\s'-]{1,39}$/; const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/; const phoneRegex = /^\+?[0-9\s-]{10,18}$/; function fieldErrorEl(el) { return el.nextElementSibling; } function setError(el, msg) { el.style.borderColor = "#ff8b96"; const small = fieldErrorEl(el); if (small) small.textContent = msg; } function clearError(el) { el.style.borderColor = "#304254"; const small = fieldErrorEl(el); if (small) small.textContent = ""; } function saveFormEntry(plan, formName, data) { const safePlan = (plan || "general").toLowerCase(); const dataKey = "techechi_plan_data"; const textKey = "techechi_text_file"; const grouped = JSON.parse(localStorage.getItem(dataKey) || "{}"); if (!grouped[safePlan]) grouped[safePlan] = []; const entry = { form: formName, plan: safePlan, submittedAt: new Date().toISOString(), ...data }; grouped[safePlan].push(entry); localStorage.setItem(dataKey, JSON.stringify(grouped)); const existingText = localStorage.getItem(textKey) || ""; const line = [ `Plan: ${safePlan}`, `Form: ${formName}`, `Time: ${entry.submittedAt}`, `Data: ${JSON.stringify(data)}`, "-----" ].join("\n"); localStorage.setItem(textKey, existingText ? `${existingText}\n${line}` : line); } [contactName, contactEmail, contactPhone, contactMessage].forEach((el) => { el.addEventListener("input", () => clearError(el)); }); contactForm.addEventListener("submit", (event) => { event.preventDefault(); contactStatus.textContent = ""; let ok = true; if (!nameRegex.test(contactName.value.trim())) { setError(contactName, "Enter a valid name."); ok = false; } if (!emailRegex.test(contactEmail.value.trim())) { setError(contactEmail, "Enter a valid email."); ok = false; } if (!phoneRegex.test(contactPhone.value.trim())) { setError(contactPhone, "Enter a valid phone number."); ok = false; } if (contactMessage.value.trim().length < 8) { setError(contactMessage, "Enter a meaningful message."); ok = false; } if (!ok) { contactStatus.textContent = "Please correct highlighted fields."; return; } saveFormEntry(localStorage.getItem("selected_plan") || "general", "contact_page", { name: contactName.value.trim(), email: contactEmail.value.trim(), mobile: contactPhone.value.trim(), message: contactMessage.value.trim() }); contactStatus.textContent = "Thanks. We will contact you shortly."; contactForm.reset(); });