بابهت: پرسیار لهسهر كاتژمێر و ماوهی كاركردن
سڵاوی خوای گهورهتان لێبێت بهڕێزان
شتێكم دروستكردووه و وتوومه له چهند ڕۆژێكی ههفته و چهند كاتژمێرێك بتوانرێت زانیارییهكان تۆماربكرێن بهڵام كاتێك كه كات و بهرواری كۆمپیوتهرهكه دهستكاری ئهكهم ، ئهتوانم پێش ئهو كاتهی له كۆدهكان ناساندوومه زانیارییهكان تۆماربكهم ، ئهمهوێت ئێستا وای لێبكهم پشت نهبهستێت به كات و بهرواری كۆمپیوتهرهكه بهڵكو پهبوهست بێت به كات و بهرواری Asia/Baghdad ههرچهنده ئهوهشم كردووه بهڵام كات و بهروار دهستكاری بكهم ئهتوانرێت زانیارییهكان تۆماربكرێت ، چۆن چارهسهری ئهو كێشهیه بكهم ئهگهر كات و بهرواری كۆمپیوتهریش پێش و پاش خرا تا نهگاته ئهو ڕۆژ و كاتژمێره نهتوانرێت زانیارییهكان تۆماربكرێن، ئهمانهش پهڕگهكانن:
<!DOCTYPE html>
<html>
<head>
<title>Insert Data</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<form action="insert.php" method="post">
<label for="data">First Name: <input type="text" id="fname" name="fname"> Last Name:<input type="text" id="lname" name="lname"></label>
<label for="data">Mobile No.: <input type="text" id="mob" name="mob"> Card Natio: <input type="text" id="cardid" name="cardid"></label>
<label for="data">Address....: <input type="text" id="address" name="address"> </label>
<br>
<button type="submit">Add Info</button>
</form>
</div>
</body>
</html>لێرهش كات و ماوهی تۆماركردنم نوسیوه
<?php
// Check if the form is submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Get the data from the form
$fname = $_POST["fname"];
$lname = $_POST["lname"];
$mob = $_POST["mob"];
// Check if it is Thursday
if (date('l') === 'Thursday') {
// Get the current time
date_default_timezone_set("Asia/Baghdad"); // Replace "Your_Timezone" with the desired timezone
$current_time = time();
// Define the start and end time for the allowed range (7:00 PM to 12:00 AM)
$start_time = strtotime('7:00 PM');
$end_time = strtotime('12:00 AM') + 24 * 3600; // Add one day to handle times after midnight
// Check if the current time is within the allowed range
if ($current_time > $start_time || $current_time == $end_time) {
// Insert the data into the MySQL table
include('config.php');
$data = mysqli_real_escape_string($conn, $data); // Prevent SQL injection
/*if ($fname > 1) {
echo "<script>alert('ببوره ئهمرۆ ناتوانیت زانیاری تر تۆماربكهیت ، سیستهم قفڵ بووه')</script>";
echo"<script>window.open('index.html','_self')</script>";
} else {*/
$sql = "INSERT INTO test (fname,lname,mob) VALUES ('$fname','$lname','$mob')";
if (mysqli_query($conn, $sql)) {
echo "<script>alert('زانیارییهكانت بهسهركهوتوویی تۆماركران')</script>";
// echo"<script>window.open('index.html','_self')</script>";
if (mysqli_query($conn, $sql)) {
$inserted_id = mysqli_insert_id($conn); // Get the ID of the inserted row
// Close the database connection
mysqli_close($conn);
// Redirect to display.php with the inserted ID
header("Location: display.php?id=" . $inserted_id);
exit();
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
} else {
echo "<script>alert('ببوره تهنها ڕۆژانی 5 شهممه له كاتژمێر 7 ی ئێواره بۆ 12 ی شهو ئهتوانیت زانیاری تۆماربكهیت')</script>";
echo"<script>window.open('index.html','_self')</script>";
}
} }else {
echo "<script>alert('ببوره تهنها ڕۆژانی 5 شهممه ئهتوانیت زانیاری تۆماربكهیت')</script>";
echo"<script>window.open('index.html','_self')</script>";
}
}
?>