Skip to content

Instantly share code, notes, and snippets.

View thinkphp's full-sized avatar

Adrian Statescu thinkphp

View GitHub Profile
<!DOCTYPE html>
<html lang="ro">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Newsletter Admin - Abonați</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
<?php
// Enable error reporting for debugging (disable in production)
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
// Set JSON header first
header('Content-Type: application/json; charset=utf-8');
header('Access-Control-Allow-Origin: *');
class SimpleNewsletter extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
// Get attributes or set defaults
this.title = this.getAttribute('title') || 'Newsletter';
this.description = this.getAttribute('description') || 'Abonează-te pentru noutăți!';
this.apiUrl = this.getAttribute('api-url') || 'newsletter.php';
this.variant = this.getAttribute('variant') || 'default'; // default, compact, footer
<!DOCTYPE html>
<html lang="ro">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Newsletter Web Component Demo</title>
<style>
body {
margin: 0;
padding: 20px;
@thinkphp
thinkphp / fab-insta.js
Created July 27, 2025 15:28
fab web component
class ContactFab extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
this.isOpen = false;
// Get attributes or set defaults
this.whatsappNumber = this.getAttribute('whatsapp') || '+1234567890';
this.emailAddress = this.getAttribute('email') || '[email protected]';
this.phoneNumber = this.getAttribute('phone') || '+1234567890';
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require 'PHPMailer/src/Exception.php';
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';
@thinkphp
thinkphp / fab-web-component.html
Last active July 25, 2025 19:46
fab web component
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Contact FAB Web Component Demo</title>
<style>
body {
margin: 0;
padding: 20px;
<?php
// Set sendmail_from address explicitly to ensure the correct "From" address
ini_set('sendmail_from', '[email protected]');
// 1. Define recipient email, subject, and "From" address
$to = "[email protected]"; // Replace with the recipient's email address
$subject = "New Contact Form Submission";
$from = "[email protected]"; // Specify the "From" email address
// 2. Collect form data
<!DOCTYPE html>
<html>
<head>
<title>Contact Form</title>
</head>
<body>
<form action="contact.php" method="POST">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required><br><br>
<?php
$to = '[email protected]';
$subject = 'Test mail';
$message = 'Aceasta este o scrisoare de test.';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
if (mail($to, $subject, $message, $headers)) {
echo "Email trimis cu succes!";