📄 timeadd.php
字号:
echo " <input type='hidden' name='timefmt_24hr_text' value=\"$timefmt_24hr_text\">\n";echo " <input type='hidden' name='timefmt_size' value=\"$timefmt_size\">\n";// query to populate dropdown with statuses //$query2 = "select * from ".$db_prefix."punchlist order by punchitems asc";$result2 = mysql_query($query2);echo " <tr><td class=table_rows height=25 width=20% style='padding-left:32px;' nowrap>Status:</td><td colspan=2 width=80% style='color:red;font-family:Tahoma;font-size:10px;padding-left:20px;'> <select name='post_statusname'>\n";echo " <option value ='1'>Choose One</option>\n";while ($row2=mysql_fetch_array($result2)) { if ($post_statusname == "".$row2['punchitems']."") { echo " <option selected>".$row2['punchitems']."</option>\n"; } else { echo " <option>".$row2['punchitems']."</option>\n";}}echo " </select> *</td></tr>\n";mysql_free_result($result2);echo " <tr><td class=table_rows height=25 width=20% style='padding-left:32px;' nowrap>Notes:</td><td align=left colspan=2 width=80% style='padding-left:20px;'><input type='text' size='17' maxlength='250' name='post_notes' value='$post_notes'></td></tr>\n";echo " <tr><td class=table_rows align=right colspan=3 style='color:red;font-family:Tahoma;font-size:10px;'>* required </td></tr>\n";echo " </table>\n";echo " <div style=\"position:absolute;visibility:hidden;background-color:#ffffff;layer-background-color:#ffffff;\" id=\"mydiv\" height=200> </div>\n";echo " <table align=center width=60% border=0 cellpadding=0 cellspacing=3>\n";echo " <tr><td height=40> </td></tr>\n";echo " <tr><td width=30><input type='image' name='submit' value='Add Time' align='middle' src='../images/buttons/next_button.png'></td><td><a href='timeadmin.php'><img src='../images/buttons/cancel_button.png' border='0'></td></tr></table></form></td></tr>\n";include '../footer.php';exit;} else {$post_username = addslashes($post_username);$post_displayname = addslashes($post_displayname);// configure timestamp to insert/updateif ($calendar_style == "euro") {// $post_date = "$day/$month/$year"; $post_date = "$month/$day/$year";}elseif ($calendar_style == "amer") { $post_date = "$month/$day/$year";}$timestamp = strtotime($post_date . " " . $post_time) - $tzo;// check for duplicate time for $post_username$query = "select * from ".$db_prefix."info where fullname = '".$post_username."'";$result = mysql_query($query);$post_username = stripslashes($post_username);$post_displayname = stripslashes($post_displayname);while ($row=mysql_fetch_array($result)) {$info_table_timestamp = "".$row['timestamp']."";if ($timestamp == $info_table_timestamp) {echo " <table align=center class=table_border width=60% border=0 cellpadding=0 cellspacing=3>\n";echo " <tr>\n";echo " <td class=table_rows width=20 align=center><img src='../images/icons/cancel.png' /></td><td class=table_rows_red> Duplicate time exists for this user on this date. Time not added..</td></tr>\n";echo " </table>\n";echo " <br />\n";echo " <form name='form' action='$self' method='post' onsubmit=\"return isDate()\">\n";echo " <table align=center class=table_border width=60% border=0 cellpadding=3 cellspacing=0>\n";echo " <tr>\n";echo " <th class=rightside_heading nowrap halign=left colspan=3><img src='../images/icons/clock_add.png' /> Add Time </th>\n";echo " </tr>\n";echo " <tr><td height=15></td></tr>\n";echo " <input type='hidden' name='date_format' value='$js_datefmt'>\n";echo " <tr><td class=table_rows height=25 width=20% style='padding-left:32px;' nowrap>Username:</td><td align=left class=table_rows colspan=2 width=80% style='padding-left:20px;'> <input type='hidden' name='post_username' value=\"$post_username\">$post_username</td></tr>\n";echo " <tr><td class=table_rows height=25 width=20% style='padding-left:32px;' nowrap>Display Name:</td><td align=left class=table_rows colspan=2 width=80% style='padding-left:20px;'> <input type='hidden' name='post_displayname' value=\"$post_displayname\">$post_displayname</td></tr>\n";echo " <tr><td class=table_rows height=25 width=20% style='padding-left:32px;' nowrap>Date:</td><td colspan=2 width=80% style='color:red;font-family:Tahoma;font-size:10px;padding-left:20px;'><input type='text' size='10' maxlength='10' name='post_date' value='$post_date'> * <a href=\"#\" onclick=\"cal.select(document.forms['form'].post_date,'post_date_anchor','$js_datefmt'); return false;\" name=\"post_date_anchor\" id=\"post_date_anchor\" style='font-size:11px;color:#27408b;'>Pick Date</a></td><tr>\n";echo " <tr><td class=table_rows height=25 width=20% style='padding-left:32px;' nowrap>Time:</td><td colspan=2 width=80% style='color:red;font-family:Tahoma;font-size:10px;padding-left:20px;'> <input type='text' size='10' maxlength='$timefmt_size' name='post_time' value='$post_time'> * <a style='text-decoration:none;font-size:11px;color:#27408b;'>($timefmt_24hr_text)</a></td></tr>\n";echo " <input type='hidden' name='get_user' value=\"$get_user\">\n";echo " <input type='hidden' name='timefmt_24hr' value=\"$timefmt_24hr\">\n";echo " <input type='hidden' name='timefmt_24hr_text' value=\"$timefmt_24hr_text\">\n";echo " <input type='hidden' name='timefmt_size' value=\"$timefmt_size\">\n";// query to populate dropdown with statuses //$query2 = "select * from ".$db_prefix."punchlist order by punchitems asc";$result2 = mysql_query($query2);echo " <tr><td class=table_rows height=25 width=20% style='padding-left:32px;' nowrap>Status:</td><td colspan=2 width=80% style='color:red;font-family:Tahoma;font-size:10px;padding-left:20px;'> <select name='post_statusname'>\n";echo " <option value ='1'>Choose One</option>\n";while ($row2=mysql_fetch_array($result2)) { if ($post_statusname == "".$row2['punchitems']."") { echo " <option selected>".$row2['punchitems']."</option>\n"; } else { echo " <option>".$row2['punchitems']."</option>\n";}}echo " </select> *</td></tr>\n";mysql_free_result($result2);echo " <tr><td class=table_rows height=25 width=20% style='padding-left:32px;' nowrap>Notes:</td><td align=left colspan=2 width=80% style='padding-left:20px;'><input type='text' size='17' maxlength='250' name='post_notes' value='$post_notes'></td></tr>\n";echo " <tr><td class=table_rows align=right colspan=3 style='color:red;font-family:Tahoma;font-size:10px;'>* required </td></tr>\n";echo " </table>\n";echo " <div style=\"position:absolute;visibility:hidden;background-color:#ffffff;layer-background-color:#ffffff;\" id=\"mydiv\" height=200> </div>\n";echo " <table align=center width=60% border=0 cellpadding=0 cellspacing=3>\n";echo " <tr><td height=40> </td></tr>\n";echo " <tr><td width=30><input type='image' name='submit' value='Add Time' align='middle' src='../images/buttons/next_button.png'></td><td><a href='timeadmin.php'><img src='../images/buttons/cancel_button.png' border='0'></td></tr></table></form></td></tr>\n";include '../footer.php';exit; }}mysql_free_result($result);// check to see if this would be the most recent time for $post_username. if so, run the update query for the employees table.$post_username = addslashes($post_username);$post_displayname = addslashes($post_displayname);$query = "select * from ".$db_prefix."employees where empfullname = '".$post_username."'";$result = mysql_query($query);while ($row=mysql_fetch_array($result)) { $employees_table_timestamp = "".$row['tstamp']."";}mysql_free_result($result);if ($timestamp > $employees_table_timestamp) {$update_query = "update ".$db_prefix."employees set tstamp = '".$timestamp."' where empfullname = '".$post_username."'";$update_result = mysql_query($update_query);}// determine who the authenticated user is for audit logif (isset($_SESSION['valid_user'])) {$user = $_SESSION['valid_user'];}elseif (isset($_SESSION['time_admin_valid_user'])) {$user = $_SESSION['time_admin_valid_user'];} else {$user = "";}// configure current time to insert for audit log$time_hour = gmdate('H');$time_min = gmdate('i');$time_sec = gmdate('s');$time_month = gmdate('m');$time_day = gmdate('d');$time_year = gmdate('Y');$time_tz_stamp = mktime ($time_hour, $time_min, $time_sec, $time_month, $time_day, $time_year);// this needs to be changed later$post_why = "";// add the time to the info table for $post_username$query = "insert into ".$db_prefix."info (fullname, `inout`, timestamp, notes) values ('".$post_username."', '".$post_statusname."', '".$timestamp."', '".$post_notes."')";$result = mysql_query($query);// add the results to the audit table if (strtolower($ip_logging) == "yes") {$query2 = "insert into ".$db_prefix."audit (modified_by_ip, modified_by_user, modified_when, modified_from, modified_to, modified_why, user_modified) values ('".$connecting_ip."', '".$user."', '".$time_tz_stamp."', '0', '".$timestamp."', '".$post_why."', '".$post_username."')";$result2 = mysql_query($query2);} else {$query2 = "insert into ".$db_prefix."audit (modified_by_user, modified_when, modified_from, modified_to, modified_why, user_modified) values ('".$user."', '".$time_tz_stamp."', '0', '".$timestamp."', '".$post_why."', '".$post_username."')";$result2 = mysql_query($query2);}$post_username = stripslashes($post_username);$post_displayname = stripslashes($post_displayname);$post_date = date($datefmt, $timestamp + $tzo);echo " <table align=center class=table_border width=60% border=0 cellpadding=0 cellspacing=3>\n";echo " <tr>\n";echo " <td class=table_rows width=20 align=center><img src='../images/icons/accept.png' /></td><td class=table_rows_green> Time added successfully.</td></tr>\n";echo " </table>\n";echo " <br />\n";echo " <form name='form' action='$self' method='post' onsubmit=\"return isDate();\">\n";echo " <table align=center class=table_border width=60% border=0 cellpadding=3 cellspacing=0>\n";echo " <tr>\n";echo " <th class=rightside_heading nowrap halign=left colspan=3><img src='../images/icons/clock_add.png' /> Add Time </th>\n";echo " </tr>\n";echo " <tr><td height=15></td></tr>\n";echo " <tr><td class=table_rows height=25 width=20% style='padding-left:32px;' nowrap>Username:</td><td align=left class=table_rows colspan=2 width=80% style='padding-left:20px;'>$post_username</td></tr>\n";echo " <tr><td class=table_rows height=25 width=20% style='padding-left:32px;' nowrap>Display Name:</td><td align=left class=table_rows colspan=2 width=80% style='padding-left:20px;'>$post_displayname</td></tr>\n";echo " <tr><td class=table_rows height=25 width=20% style='padding-left:32px;' nowrap>Date:</td><td align=left class=table_rows colspan=2 width=80% style='padding-left:20px;'>$post_date</td></tr>\n";echo " <tr><td class=table_rows height=25 width=20% style='padding-left:32px;' nowrap>Time:</td><td align=left class=table_rows colspan=2 width=80% style='padding-left:20px;'>$post_time</td></tr>\n";echo " <tr><td class=table_rows height=25 width=20% style='padding-left:32px;' nowrap>Status:</td><td align=left class=table_rows colspan=2 width=80% style='color:$color;padding-left:20px;'>$post_statusname</td></tr>\n";echo " <tr><td class=table_rows height=25 width=20% style='padding-left:32px;' nowrap>Notes:</td><td align=left class=table_rows colspan=2 width=80% style='padding-left:20px;'>$post_notes</td></tr>\n";echo " <tr><td height=15></td></tr>\n";echo " </table>\n";echo " <table align=center width=60% border=0 cellpadding=0 cellspacing=3>\n";echo " <tr><td height=20 align=left> </td></tr>\n";echo " <tr><td><a href='timeadmin.php'><img src='../images/buttons/done_button.png' border='0'></td></tr></table></td></tr>\n";include '../footer.php';exit;}}?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -