-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconverter
91 lines (81 loc) · 3.46 KB
/
converter
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!DOCTYPE html>
<html dir='rtl' lang="en">
<head >
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<title>Date Converter</title>
<style>
.footer {
background-color: #ffffff;
padding: 20px ;
text-align: center;
}
</style>
</head>
<body>
<br>
<br>
<br>
<div class="container">
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$year = $_POST['year'];
$month = $_POST['month'];
$day = $_POST['day'];
$type = $_POST['type'];
if ($type == 'shamsi') {
$url = "https://one-api.ir/time/?token=363364:63ded9b65b688&action=convert&date=".$year."/".$month."/".$day."&source=miladi&timezone=Asia/Tehran";
$result = file_get_contents($url);
$json = json_decode($result);
echo '<div class="mt-4">';
echo '<table class="table ">';
echo '<tbody>';
echo '<tr class="table-warning"><th>تاریخ شمسی</th><td>'.$json->result->date->jalali.'</td></tr>';
echo '<tr ><th>تاریخ قمری</th><td>'.$json->result->date->ghamari.'</td></tr>';
echo '<tr class="table-warning"><th>روز هفته</th><td>'.$json->result->day->name_week.'</td></tr>';
echo '<tr ><th>رویداد</th><td>'.$json->result->occasion->jalali.'</td></tr>';
echo '<tr class="table-warning"><th>سمبل</th><td>'.$json->result->year->name_past.'</td></tr>';
echo '</tbody>';
echo '</table>';
echo '</div>';
} else {
$url = "https://one-api.ir/time/?token=363364:63ded9b65b688&action=convert&date=".$year."/".$month."/".$day."&source=jalali&timezone=Asia/Tehran";
$result = file_get_contents($url);
$json = json_decode($result);
echo '<div class="mt-4">';
echo '<table class="table">';
echo '<tbody>';
echo '<tr class="table-warning"><th>تاریخ میلادی</th><td>'.$json->result->date->miladi.'</td></tr>';
echo '<tr><th>تاریخ قمری</th><td>'.$json->result->date->ghamari.'</td></tr>';
echo '</tbody>';
echo '</table>';
echo '</div>';
}
}
?>
<br>
<br>
<br>
<br>
<br>
<br>
<form action="index.html" method="post"><center><button type="submit" class="btn btn-primary">بازگشت به صحفه اصلی</button>
</center></form>
</div>
<br>
<br>
<br>
<br>
<br>
<br>
<footer class="footer">
<div class="container">
<p>Designed by <b>Sepas Setayesh</b></p>
<p>© 2023 تمامی حقوق محفوظ است.</p>
</div>
</footer>
</body>
</html>