Напиши код html сайта в котором будет отправка смс в определённом количестве Также напиши коды css js и php файлов
HTML код:
<!DOCTYPE html>
<html>
<head>
<title>Отправка SMS</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Отправка SMS</h1>
<form action="send.php" method="post">
<label for="phone">Номер телефона:</label>
<input type="tel" id="phone" name="phone" required>
<label for="message">Сообщение:</label>
<textarea id="message" name="message" required></textarea>
<label for="count">Количество:</label>
<input type="number" id="count" name="count" min="1" max="10" required>
<button type="submit">Отправить</button>
</form>
<script src="script.js"></script>
</body>
</html>
CSS код (файл style.css):
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
h1 {
text-align: center;
margin-top: 20px;
}
form {
margin: 20px auto;
max-width: 600px;
padding: 20px;
background-color: #f7f7f7;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}
label {
display: block;
margin-top: 10px;
}
input, textarea {
display: block;
width: 100%;
padding: 10px;
border: none;
border-radius: 5px;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
font-size: 16px;
}
input[type="tel"] {
max-width: 400px;
}
button {
display: block;
margin-top: 20px;
padding: 10px 20px;
background-color: #007bff;
color: #fff;
border: none;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
}
button:hover {
background-color: #0062cc;
}
.error {
color: #dc3545;
font-size: 14px;
margin-top: 5px;
}
JavaScript код (файл script.js):
document.querySelector('form').addEventListener('submit', function(event) {
event.preventDefault();
var phone = document.querySelector('#phone').value;
var message = document.querySelector('#message').value;
var count = document.querySelector('#count').value;
var error = document.querySelector('.error');
if (phone.trim() === '' || message.trim() === '' || count.trim() === '') {
error.textContent = 'Заполните все поля';
} else if (!/^\+7\d{10}$/.test(phone)) {
error.textContent = 'Некорректный номер телефона';
} else {
error.textContent = '';
for (var i = 0; i < count; i++) {
sendSMS(phone, message);
}
alert('Сообщения отправлены');
}
});
function sendSMS(phone, message) {
// код отправки SMS
}
PHP код (файл send.php):
<?php
$phone = $_POST['phone'];
$message = $_POST['message'];
$count = $_POST['count'];
// код отправки SMS
echo 'Сообщения отправлены';
?>
原文地址: https://www.cveoy.top/t/topic/bGWc 著作权归作者所有。请勿转载和采集!