Jump to content

ramiwahdan

Members
  • Posts

    114
  • Joined

  • Last visited

Everything posted by ramiwahdan

  1. Hi, I have 2 db fields with timestamp datatype (ClockingInDate and ClockingOutDate) and i am trying to get the difference between them then update the new db called duration with float datatype field. PHP: if (isset($_POST["clockout"])){ $result3=mysqli_query($con, "select * from attendance_records where OracleID='$session_id'")or die('Error In Session'); $row3=mysqli_fetch_array($result3); $end_date = $row3['ClockingOutDate']; $startdate = $row3['ClockingInDate']; $diff = strtotime($end_date) - strtotime($startdate); $fullDays = floor($diff/(60*60*24)); $fullHours = floor(($diff-($fullDays*60*60*24))/(60*60)); $fullMinutes = floor(($diff-($fullDays*60*60*24)-($fullHours*60*60))/60); $duration = $fullMinutes; $query3=mysqli_query($con, "update attendance_records set Duration = '$duration' where OracleID='$session_id' and isdone='$isdone'")or die('Error In Session'); header('location:index.php'); } * come to think of that again, i always get zero, is it because it never reaches days in my program! I am using this for attendance system so only hours and minutes are used. Please help.
  2. Hi, I have created buttons from php and html and have css for styling. the buttons come below each other as expected but they are not aligned to the same size. css: body { color: #fff; font: 87.5%/1.5em 'Open Sans', sans-serif; background:url(img/bg.jpg)no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover;} .buttonstyle { background-color: #4CAF50; /* Green */ border: none; color: white; padding: 15px 80px; text-align: center; text-decoration: none; display: inline-block; font-size: 14px; margin: 5; } .form-wrapper { width:350px; height:280px; position: absolute; top: 50%; left: 50%; margin: -184px 0px 0px -155px; background: rgba(0,0,0,0.27); padding: 25px 25px; border-radius: 5px; box-shadow: 0px 1px 0px rgba(0,0,0,0.6),inset 0px 1px 0px rgba(255,255,255,0.04); } .form-item { width:100%; } h3{ font-size: 25px; font-weight: 640; margin-bottom: 10px; color: #e7e7e7; padding:6px; font-family:'sans-serif','helvetica'; } .form-item input{ border: none; background:transparent; color: #fff; margin-top:11px; font-family: 'Open Sans', sans-serif; font-size: 1.2em; height: 49px; padding: 0 16px; width: 100%; padding-left: 55px; } input[type='password']{ background: transparent url("img/pass.jpg") no-repeat; background-position: 10px 50%; } input[type='text']{ background: transparent url("img/user.jpg") no-repeat; background-position: 10px 50%; } .form-item input:focus { outline: none; border:1.4px solid #cfecf0; } .button-panel { margin-bottom: 20px; padding-top: 10px; width: 100%; } .button-panel .button { background: #00b6df; border: none; color: #fff; cursor: pointer; height: 50px; font-family: 'helvetica','Open Sans', sans-serif; font-size: 1.2em; text-align: center; text-transform: uppercase; transition: background 0.6s linear; width: 100%; margin-top:10px; } .button:hover { background: #6eb7cb; } .form-item input, .button-panel .button { border-radius: 2px } .reminder { text-align: center; } .reminder a { color: #fff; text-decoration: none; transition: color 0.3s; } .reminder a:hover { color: #cab6bf; } php: <?php include('dbcon.php'); include('session.php'); $result=mysqli_query($con, "select * from admin_login where username='$session_id'")or die('Error In Session'); $row=mysqli_fetch_array($result); ?> <html> <head> <link rel="stylesheet" type="text/css" href="style2.css"> </head> <body> <form action="test2.php" method="post"> <div class="form-wrapper"> <center><h3>Welcome: <?php echo $row['Name']; ?> </h3></center> <button type="submit" name = "adminmanagement" class="buttonstyle">Manage Admin Info</button> <button type="submit" name = "staffmanagement" class="buttonstyle">Manage Staff Info</button> <button type="submit" name = "reportsmanagement" class="buttonstyle">Manage Reports</button> <div class="reminder"> <p><a href="logout.php">Log out</a></p> </div> </div> </form> </body> </html> attached output, the buttons are not of same size... Thanks
  3. I tried a better one but i am getting the default value of 1970: $testDate= date('Y-m-d',$row2['ClockingInDate']); $curdate = date("Y-m-d"); testDate is getting the default value of 1970...why is that?
  4. I tried this but it is not getting the date from the timestamp: $testDate = date($row2['ClockingInDate']); $curdate = date("Y-m-d"); I am still getting the full date and time for the first variable!
  5. Hi, I have a table field that has the full timestamp (date and time), I want to select records from DB but after checking the date part only from the timestamp. Example: 2020-3-10 10:15:00 ---- i want to check if current date is equal to the date part which in this case it is the same. Thanks.
  6. I solved it. the problem was not with time, something else. Now i have a question, when the timestamp got saved, it shows time -3. my time is 9PM for example, it shows in the DB 6PM. Is it saved that way in the server? if i retrieve the time from server and display it, what will it show? 6PM or my time 9PM? I need to show my zone time, how possible?
  7. I did make the change but still not inserting! code: <?php include('dbcon.php'); include('session.php'); if (isset($_POST["clockin"])){ $query1=mysqli_query($con, "update staff set ClockedIn = -1, indate = CURDATE() where OracleID='$session_id'")or die('Error In Session'); $result=mysqli_query($con, "select * from staff where OracleID='$session_id'")or die('Error In Session'); $row=mysqli_fetch_array($result); $oracleid = $row['OracleID']; $Name = $row['StaffName']; $Des = $row['Des']; $sDate = date("Y-m-d H:i:s"); $sql = mysqli_query($con,"INSERT INTO attendance_records (OracleID,Name,Des,ClockingInDate) VALUES ('$oracleid','$Name','$Des','$sDate')"); header('location:index.php'); } ?> Still don't see any new records added
  8. Hi, how to set current time to variable then use it to add new record to DB? $loginDate = date("Y-m-d"); $loginTime = ??? Thanks
  9. Hi, I have database stored a field of date. I want to check if the date in the DB field is the same as the current date, how to do it? Code: $oracle = mysqli_real_escape_string($con, $_POST['oracle']); $query = mysqli_query($con, "SELECT indate FROM staff WHERE OracleID ='$oracle'"); $row = mysqli_fetch_array($query); $num_row = mysqli_num_rows($query); if ($num_row > 0) { $curdate = date(); if ($row['indate'] !== $curdate) { $query1=mysqli_query($con, "update staff set ClockedIn = 0, ClockedOut = 0 where OracleID='$session_id'")or die('Error In Session'); header('location:home.php'); } }
  10. I do have button with name "inside", it is there.
  11. Dear All, I am trying to check which button is clicked inside the same php file and from there i will do some coding, I tried to echo some text but not working. PHP: <?php include('dbcon.php'); include('session.php'); $result=mysqli_query($con, "select * from staff where OracleID='$session_id'")or die('Error In Session'); $row=mysqli_fetch_array($result); if (isset($_POST["inside"])){ echo 'inside'; } else{ echo 'outside'; } ?> HTML: <html> <head> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div class="form-wrapper"> <center> <form action="home.php" method="POST"> <h3>Welcome: <?php echo $row['StaffName']; ?> </h3> <?php if ($row['ClockedIn'] == True and $row['ClockedOut'] == False) {echo "You already clockedIn today, please clockOut"; echo '<button hidden> type="submit" class="buttonstyle" >Clock Time IN!</button>'; echo '<button type="submit" name = "out" class="buttonstyle">Clock Time OUT!</button>';} ?> <?php if ($row['ClockedOut'] == False and $row['ClockedIn'] == False) {echo '<button type="submit" name = "inside" class="buttonstyle" >Clock Time IN!</button>'; echo '<button type="submit" name = "out" class="buttonstyle" >Clock Time OUT!</button>';} ?> <?php if ($row['ClockedIn'] == True and $row['ClockedOut'] == True) {echo "You already clockedIn and ClockedOut today!"; echo '<button hidden> type="submit" class="buttonstyle" >Clock Time IN!</button>'; echo '<button hidden> type="submit" class="buttonstyle">Clock Time OUT!</button>';} ?> </form> </center> </div> </body> </html> Please help on this please.
  12. I have buttons for clocking in and clocking out at my school. When pressed they will get into DB and record current date and time. how to achieve the on click event in php? <?php include('dbcon.php'); include('session.php'); $result=mysqli_query($con, "select * from staff where OracleID='$session_id'")or die('Error In Session'); $row=mysqli_fetch_array($result); echo("\n"); ?> <html> <head> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div class="form-wrapper"> <center> <h3>Welcome: <?php echo $row['StaffName']; ?> </h3> <?php if ($row['ClockedIn'] == True and $row['ClockedOut'] == False) {echo "You already clockedIn today, please clockOut"; echo '<button hidden> type="button" class="buttonstyle" >Clock Time IN!</button>'; echo '<button type="button" class="buttonstyle">Clock Time OUT!</button>';} ?> <?php if ($row['ClockedOut'] == False and $row['ClockedIn'] == False) {echo '<button type="button" class="buttonstyle" >Clock Time IN!</button>'; echo '<button type="button" class="buttonstyle" >Clock Time OUT!</button>';} ?> <?php if ($row['ClockedIn'] == True and $row['ClockedOut'] == True) {echo "You already clockedIn and ClockedOut today!"; echo '<button hidden> type="button" class="buttonstyle" >Clock Time IN!</button>'; echo '<button hidden> type="button" class="buttonstyle">Clock Time OUT!</button>';} ?> </center> </div> </body> </html>
  13. OK, i was not clear, this is done for school admin, both client computer and server computer are handled by Admin. the admin will place the client computer in the main reception area where students will login when they come to school. the Admin know the student pictures in their own system (HR forms), so they want to know who is logging in to who (sheeting the system). example if student 555440 logged in and picture taken, the HR will verify if that photo is really the same for the student id 555440. hope its clear...
  14. Hi, I am making login page with database and php. I need to be able when the person clicks theogin button to take photo of the person and add it to that same database based on the info entered. I am doing this to know if that person that logged in is the person in reality. Is it possible
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.