-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnewkeka.php
71 lines (60 loc) · 2.44 KB
/
newkeka.php
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
<!DOCTYPE html>
<html 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">
<title>KEKA</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
</head>
<body>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="POST" class="container col-4 bg-dark text-light p-5">
<div class="mb-3">
Enter your Effective hours:
<input type="number" class="form-control" name="hrs">
</div>
<div class="mb-3"> Enter your Effective minutes:
<input type="number" class="form-control" name="min">
</div>
<div class="mb-3">
Enter your Last Clock-in hours:
<input type="number" class="form-control" name="c_hrs">
</div>
<div class="mb-3">
Enter your Last Clock-in minutes:
<input type="number" class="form-control" name="c_min">
</div>
<input type="submit" name="submit" value="Calculate">
</body>
<?php
date_default_timezone_set("Asia/Calcutta"); //India time (GMT+5:30)
if (isset($_POST["submit"])) {
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$hours = $_POST["hrs"];
$minutes = $_POST["min"];
$c_hours = $_POST["c_hrs"];
$c_minutes = $_POST["c_min"];
$xHr = date('h') - $c_hours;
$xMin = date('i') - $c_minutes;
//Total hr 8
$remainHrs = 7 - $hours;
$remainMin = 60 - $minutes;
//Leaving time
$lHr = $remainHrs + date('h');
$lMin = $remainMin + date('i');
if ($lMin > 60) {
$leavingHr = $lHr + 1;
$leavingMin = $lMin - 60;
} else {
$leavingHr = $lHr;
$leavingMin = $lMin;
}
echo "<h3><br><br><b> You can go after: </b><br><h3>";
echo "<b>" . $leavingHr - $xHr . ": </b> ";
echo "<b>" . $leavingMin - $xMin . "</b>";
echo "<h1><br> The min might be differ, please go after 2-3 min </h1>";
}
}
?>
</html>