Skip to content

Instantly share code, notes, and snippets.

View thinkphp's full-sized avatar

Adrian Statescu thinkphp

View GitHub Profile
<?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!";
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Coffee Shop Cart</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height: 1.6;
@thinkphp
thinkphp / gist:549242512617a1389643891d7087887b
Created July 19, 2025 12:45
Slideshow Next Prev Buttons
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {font-family: Arial, Helvetica, sans-serif;}
.img-thumbnail {
border-radius: 5px;
cursor: pointer;
@thinkphp
thinkphp / contact-form.php
Created July 13, 2025 18:14
Contact Form PHP
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Contact Us</title>
<style>
* {
margin: 0;
padding: 0;
i = 1;
while(i < n) {
  j = 0;
  while(j < n) {
    cnt = cnt + 1;
    j = j + i;
  }
  i = 2 * i;
}
+-------------------------------+
| Start |
+-------------------------------+
|
v
+-------------------------------+
| For each transaction in |
| TRANSACTIONS |
+-------------------------------+
|
@thinkphp
thinkphp / probleme-solutii.R
Last active June 22, 2025 09:28
probleme-solutii.R
# PROBLEMA 1: Analiza stocurilor din magazine
# Calculează valoarea totală a stocului pentru fiecare produs din inventar (inclusiv produsele fără stoc),
# sortează descrescător și creează grafic barplot.
library(dplyr)
library(ggplot2)
# Unele produse din inventar nu au stoc înregistrat
stock_records <- data.frame(
product_id = c(101, 103, 105, 107, 101, 103),
# =============================================================================
# PART 2: RENEWABLE ENERGY TRANSITION (25 points)
# =============================================================================
# Load required libraries
library(readxl)
library(dplyr)
library(ggplot2)
library(gridExtra)