📄 timeadd.php
字号:
<?phpsession_start();include '../config.inc.php';include 'header_date.php';include 'topmain.php';echo "<title>$title - Add Time</title>\n";$self = $_SERVER['PHP_SELF'];$request = $_SERVER['REQUEST_METHOD'];if (($timefmt == "G:i") || ($timefmt == "H:i")) { $timefmt_24hr = '1'; $timefmt_24hr_text = '24 hr format'; $timefmt_size = '5';} else { $timefmt_24hr = '0'; $timefmt_24hr_text = '12 hr format'; $timefmt_size = '8';}if ((!isset($_SESSION['valid_user'])) && (!isset($_SESSION['time_admin_valid_user']))) {echo "<table width=100% border=0 cellpadding=7 cellspacing=1>\n";echo " <tr class=right_main_text><td height=10 align=center valign=top scope=row class=title_underline>PHP Timeclock Administration</td></tr>\n";echo " <tr class=right_main_text>\n";echo " <td align=center valign=top scope=row>\n";echo " <table width=200 border=0 cellpadding=5 cellspacing=0>\n";echo " <tr class=right_main_text><td align=center>You are not presently logged in, or do not have permission to view this page.</td></tr>\n";echo " <tr class=right_main_text><td align=center>Click <a class=admin_headings href='../login.php'><u>here</u></a> to login.</td></tr>\n";echo " </table><br /></td></tr></table>\n"; exit;}if ($request == 'GET') {if (!isset($_GET['username'])) {echo "<table width=100% border=0 cellpadding=7 cellspacing=1>\n";echo " <tr class=right_main_text><td height=10 align=center valign=top scope=row class=title_underline>PHP Timeclock Error!</td></tr>\n";echo " <tr class=right_main_text>\n";echo " <td align=center valign=top scope=row>\n";echo " <table width=300 border=0 cellpadding=5 cellspacing=0>\n";echo " <tr class=right_main_text><td align=center>How did you get here?</td></tr>\n";echo " <tr class=right_main_text><td align=center>Go back to the <a class=admin_headings href='timeadmin.php'>Add/Edit/Delete Time</a> page to add a time.</td></tr>\n";echo " </table><br /></td></tr></table>\n"; exit;}$get_user = stripslashes($_GET['username']);disabled_acct($get_user);echo "<table width=100% height=89% border=0 cellpadding=0 cellspacing=1>\n";echo " <tr valign=top>\n";echo " <td class=left_main width=180 align=left scope=col>\n";echo " <table class=hide width=100% border=0 cellpadding=1 cellspacing=0>\n";echo " <tr><td class=left_rows height=11></td></tr>\n";echo " <tr><td class=left_rows_headings height=18 valign=middle>Users</td></tr>\n";echo " <tr><td class=left_rows height=18 align=left valign=middle><img src='../images/icons/user.png' alt='User Summary' /> <a class=admin_headings href='useradmin.php'>User Summary</a></td></tr>\n";echo " <tr><td class=left_rows height=18 align=left valign=middle><img src='../images/icons/user_add.png' alt='Create New User' /> <a class=admin_headings href='usercreate.php'>Create New User</a></td></tr>\n";echo " <tr><td class=left_rows height=18 align=left valign=middle><img src='../images/icons/magnifier.png' alt='User Search' /> <a class=admin_headings href='usersearch.php'>User Search</a></td></tr>\n";echo " <tr><td class=left_rows height=33></td></tr>\n";echo " <tr><td class=left_rows_headings height=18 valign=middle>Offices</td></tr>\n";echo " <tr><td class=left_rows height=18 align=left valign=middle><img src='../images/icons/brick.png' alt='Office Summary' /> <a class=admin_headings href='officeadmin.php'>Office Summary</a></td></tr>\n";echo " <tr><td class=left_rows height=18 align=left valign=middle><img src='../images/icons/brick_add.png' alt='Create New Office' /> <a class=admin_headings href='officecreate.php'>Create New Office</a></td></tr>\n";echo " <tr><td class=left_rows height=33></td></tr>\n";echo " <tr><td class=left_rows_headings height=18 valign=middle>Groups</td></tr>\n";echo " <tr><td class=left_rows height=18 align=left valign=middle><img src='../images/icons/group.png' alt='Group Summary' /> <a class=admin_headings href='groupadmin.php'>Group Summary</a></td></tr>\n";echo " <tr><td class=left_rows height=18 align=left valign=middle><img src='../images/icons/group_add.png' alt='Create New Group' /> <a class=admin_headings href='groupcreate.php'>Create New Group</a></td></tr>\n";echo " <tr><td class=left_rows height=33></td></tr>\n";echo " <tr><td class=left_rows_headings height=18 valign=middle colspan=2>In/Out Status</td></tr>\n";echo " <tr><td class=left_rows height=18 align=left valign=middle><img src='../images/icons/application.png' alt='Status Summary' /> <a class=admin_headings href='statusadmin.php'>Status Summary</a></td></tr>\n";echo " <tr><td class=left_rows height=18 align=left valign=middle><img src='../images/icons/application_add.png' alt='Create Status' /> <a class=admin_headings href='statuscreate.php'>Create Status</a></td></tr>\n";echo " <tr><td class=left_rows height=33></td></tr>\n";echo " <tr><td class=left_rows_headings height=18 valign=middle colspan=2>Miscellaneous</td></tr>\n";echo " <tr><td class=left_rows height=18 align=left valign=middle><img src='../images/icons/clock.png' alt='Add/Edit/Delete Time' /> <a class=admin_headings href='timeadmin.php'>Add/Edit/Delete Time</a></td></tr>\n";echo " <tr><td class=current_left_rows_indent height=18 align=left valign=middle><img src='../images/icons/arrow_right.png' alt='Add Time' /> <a class=admin_headings href=\"timeadd.php?username=$get_user\">Add Time</a></td></tr>\n";echo " <tr><td class=left_rows_indent height=18 align=left valign=middle><img src='../images/icons/arrow_right.png' alt='Edit Time' /> <a class=admin_headings href=\"timeedit.php?username=$get_user\">Edit Time</a></td></tr>\n";echo " <tr><td class=left_rows_indent height=18 align=left valign=middle><img src='../images/icons/arrow_right.png' alt='Delete Time' /> <a class=admin_headings href=\"timedelete.php?username=$get_user\">Delete Time</a></td></tr>\n";echo " <tr><td class=left_rows_border_top height=18 align=left valign=middle><img src='../images/icons/application_edit.png' alt='Edit System Settings' /> <a class=admin_headings href='sysedit.php'>Edit System Settings</a></td></tr>\n";echo " <tr><td class=left_rows height=18 align=left valign=middle><img src='../images/icons/database_go.png' alt='Upgrade Database' /> <a class=admin_headings href='dbupgrade.php'>Upgrade Database</a></td></tr>\n";echo " </table></td>\n";$get_user = addslashes($get_user);$query = "select * from ".$db_prefix."employees where empfullname = '".$get_user."' order by empfullname";$result = mysql_query($query);while ($row=mysql_fetch_array($result)) {$username = stripslashes("".$row['empfullname']."");$displayname = stripslashes("".$row['displayname']."");}mysql_free_result($result);$get_user = stripslashes($_GET['username']);echo " <td align=left class=right_main scope=col>\n";echo " <table width=100% height=100% border=0 cellpadding=10 cellspacing=1>\n";echo " <tr class=right_main_text>\n";echo " <td valign=top>\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=\"$username\">$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=\"$displayname\">$displayname</td></tr>\n";echo " <tr><td class=table_rows height=25 width=20% style='padding-left:32px;' nowrap>Date: ($tmp_datefmt)</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'> * <a href=\"#\" onclick=\"form.post_date.value='';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'> * <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)) { 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'></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;}elseif ($request == 'POST') {$get_user = stripslashes($_POST['get_user']);$post_username = stripslashes($_POST['post_username']);$post_displayname = stripslashes($_POST['post_displayname']);$post_date = $_POST['post_date'];$post_time = $_POST['post_time'];$post_statusname = $_POST['post_statusname'];$post_notes = $_POST['post_notes'];$timefmt_24hr = $_POST['timefmt_24hr'];$timefmt_24hr_text = $_POST['timefmt_24hr_text'];$timefmt_size = $_POST['timefmt_size'];$date_format = $_POST['date_format'];$get_user = addslashes($get_user);$post_username = addslashes($post_username);$post_displayname = addslashes($post_displayname);// begin post validation //if (!empty($get_user)) {$query = "select * from ".$db_prefix."employees where empfullname = '".$get_user."'";$result = mysql_query($query);while ($row=mysql_fetch_array($result)) {$tmp_get_user = "".$row['empfullname']."";}if (!isset($tmp_get_user)) {echo "Something is fishy here.\n"; exit;}}if (!empty($post_username)) {$query = "select * from ".$db_prefix."employees where empfullname = '".$post_username."'";$result = mysql_query($query);while ($row=mysql_fetch_array($result)) {$tmp_username = "".$row['empfullname']."";}if (!isset($tmp_username)) {echo "Something is fishy here.\n"; exit;}}if (!empty($post_displayname)) {$query = "select * from ".$db_prefix."employees where empfullname = '".$post_username."' and displayname = '".$post_displayname."'";$result = mysql_query($query);while ($row=mysql_fetch_array($result)) {$tmp_post_displayname = "".$row['displayname']."";}if (!isset($tmp_post_displayname)) {echo "Something is fishy here.\n"; exit;}}if (!empty($post_statusname)) { if ($post_statusname != '1') { $query = "select * from ".$db_prefix."punchlist where punchitems = '".$post_statusname."'"; $result = mysql_query($query); while ($row=mysql_fetch_array($result)) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -