dcsimg
www.webdeveloper.com
Results 1 to 6 of 6

Thread: 4 digit login for timeclock

  1. #1
    Join Date
    Mar 2013
    Posts
    6

    4 digit login for timeclock

    Good Morning,

    I work in the I.T. department for a small business in Auburn Hills, MI. Most of what we do here are C# based projects, and none of us particularly talented with PHP. The warehouse manager wants us to change the login process for the warehouse people from a scrolldown, where they select their names and punch in that way, to a 4 digit login. The login for the warehouse is a php based application.

    Any thoughts? Please Help. Thx!

    -paul

  2. #2
    Join Date
    Mar 2013
    Posts
    6
    "timeclock.php"

    <?php
    session_start();

    include 'config.inc.php';
    include 'header.php';

    if (!isset($_GET['printer_friendly'])) {

    if (isset($_SESSION['valid_user'])) {
    $set_logout = "1";
    }

    include 'topmain.php';
    include 'leftmain.php';
    }

    echo "<title>$title</title>\n";
    $current_page = "timeclock.php";

    if (!isset($_GET['printer_friendly'])) {
    echo " <td align=left class=right_main scope=col>\n";
    echo " <table width=100% height=100% border=0 cellpadding=5 cellspacing=1>\n";
    echo " <tr class=right_main_text>\n";
    echo " <td valign=top>\n";
    }

    // code to allow sorting by Name, In/Out, Date, Notes //

    if ($show_display_name == "yes") {
    if (!isset($_GET['sortcolumn'])) {
    $sortcolumn = "displayname";
    } else {
    $sortcolumn = $_GET['sortcolumn'];
    }

    } else {

    if (!isset($_GET['sortcolumn'])) {
    $sortcolumn = "fullname";
    } else {
    $sortcolumn = $_GET['sortcolumn'];
    }

    }

    if (!isset($_GET['sortdirection'])) {
    $sortdirection = "asc";
    } else {
    $sortdirection = $_GET['sortdirection'];
    }

    if ($sortdirection == "asc") {
    $sortnewdirection = "desc";
    } else {
    $sortnewdirection = "asc";
    }

    // determine what users, office, and/or group will be displayed on main page //

    if (($display_current_users == "yes") && ($display_office == "all") && ($display_group == "all")) {
    $current_users_date = strtotime(date($datefmt));
    $calc = 86400;
    $a = $current_users_date + $calc - @$tzo;
    $b = $current_users_date - @$tzo;

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
    from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
    where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
    and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ((".$db_prefix."info.timestamp < '".$a."') and
    (".$db_prefix."info.timestamp >= '".$b."')) and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin'
    order by `$sortcolumn` $sortdirection";
    $result = mysql_query($query);
    }

    elseif (($display_current_users == "yes") && ($display_office != "all") && ($display_group == "all")) {

    $current_users_date = strtotime(date($datefmt));
    $calc = 86400;
    $a = $current_users_date + $calc - @$tzo;
    $b = $current_users_date - @$tzo;

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
    from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
    where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
    and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."'
    and ((".$db_prefix."info.timestamp < '".$a."') and (".$db_prefix."info.timestamp >= '".$b."'))
    and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin'
    order by `$sortcolumn` $sortdirection";
    $result = mysql_query($query);
    }

    elseif (($display_current_users == "yes") && ($display_office == "all") && ($display_group != "all")) {

    $current_users_date = strtotime(date($datefmt));
    $calc = 86400;
    $a = $current_users_date + $calc - @$tzo;
    $b = $current_users_date - @$tzo;

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
    from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
    where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
    and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.groups = '".$display_group."'
    and ((".$db_prefix."info.timestamp < '".$a."') and (".$db_prefix."info.timestamp >= '".$b."'))
    and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin'
    order by `$sortcolumn` $sortdirection";
    $result = mysql_query($query);
    }

    elseif (($display_current_users == "yes") && ($display_office != "all") && ($display_group != "all")) {

    $current_users_date = strtotime(date($datefmt));
    $calc = 86400;
    $a = $current_users_date + $calc - @$tzo;
    $b = $current_users_date - @$tzo;

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
    from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
    where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
    and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."'
    and ".$db_prefix."employees.groups = '".$display_group."' and ((".$db_prefix."info.timestamp < '".$a."')
    and (".$db_prefix."info.timestamp >= '".$b."')) and ".$db_prefix."employees.disabled <> '1'
    and ".$db_prefix."employees.empfullname <> 'admin'
    order by `$sortcolumn` $sortdirection";
    $result = mysql_query($query);
    }

    elseif (($display_current_users == "no") && ($display_office == "all") && ($display_group == "all")) {

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
    from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
    where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
    and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.disabled <> '1'
    and ".$db_prefix."employees.empfullname <> 'admin'
    order by `$sortcolumn` $sortdirection";
    $result = mysql_query($query);
    }

    elseif (($display_current_users == "no") && ($display_office != "all") && ($display_group == "all")) {

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
    from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
    where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
    and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."'
    and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin'
    order by `$sortcolumn` $sortdirection";
    $result = mysql_query($query);
    }

    elseif (($display_current_users == "no") && ($display_office == "all") && ($display_group != "all")) {

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
    from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
    where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
    and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.groups = '".$display_group."'
    and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin'
    order by `$sortcolumn` $sortdirection";
    $result = mysql_query($query);
    }

    elseif (($display_current_users == "no") && ($display_office != "all") && ($display_group != "all")) {

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
    from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
    where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
    and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."'
    and ".$db_prefix."employees.groups = '".$display_group."' and ".$db_prefix."employees.disabled <> '1'
    and ".$db_prefix."employees.empfullname <> 'admin'
    order by `$sortcolumn` $sortdirection";
    $result = mysql_query($query);
    }

    $time = time();
    $tclock_hour = gmdate('H',$time);
    $tclock_min = gmdate('i',$time);
    $tclock_sec = gmdate('s',$time);
    $tclock_month = gmdate('m',$time);
    $tclock_day = gmdate('d',$time);
    $tclock_year = gmdate('Y',$time);
    $tclock_stamp = mktime ($tclock_hour, $tclock_min, $tclock_sec, $tclock_month, $tclock_day, $tclock_year);

    $tclock_stamp = $tclock_stamp + @$tzo;
    $tclock_time = date($timefmt, $tclock_stamp);
    $tclock_date = date($datefmt, $tclock_stamp);
    $report_name="Current Status Report";

    echo " <table width=100% align=center class=misc_items border=0 cellpadding=3 cellspacing=0>\n";

    if (!isset($_GET['printer_friendly'])) {
    echo " <tr class=display_hide>\n";
    } else {
    echo " <tr>\n";
    }

    echo " <td nowrap style='font-size:9px;color:#000000;padding-left:10px;'>$report_name&nbsp;&nbsp;---->&nbsp;&nbsp;As of: $tclock_time,
    $tclock_date</td></tr>\n";
    echo " </table>\n";
    include 'display.php';

    if (!isset($_GET['printer_friendly'])) {
    include 'footer.php';
    }

    ?>

  3. #3
    Join Date
    Mar 2013
    Posts
    6

    "usercreate.php" part 1

    <?php
    session_start();

    $self = $_SERVER['PHP_SELF'];
    $request = $_SERVER['REQUEST_METHOD'];

    include '../config.inc.php';
    if ($request !== 'POST') {include 'header_get.php';include 'topmain.php';}
    echo "<title>$title - Create User</title>\n";

    if (!isset($_SESSION['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') {

    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' />&nbsp;&nbsp;
    <a class=admin_headings href='useradmin.php'>User Summary</a></td></tr>\n";
    echo " <tr><td class=current_left_rows height=18 align=left valign=middle><img src='../images/icons/user_add.png' alt='Create New User' />
    &nbsp;&nbsp;<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' />&nbsp;&nbsp;
    <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' />&nbsp;&nbsp;
    <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' />&nbsp;&nbsp;
    <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' />&nbsp;&nbsp;
    <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' />&nbsp;&nbsp;
    <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' />
    &nbsp;&nbsp;<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' />&nbsp;&nbsp;
    <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' />
    &nbsp;&nbsp;<a class=admin_headings href='timeadmin.php'>Add/Edit/Delete Time</a></td></tr>\n";
    echo " <tr><td class=left_rows height=18 align=left valign=middle><img src='../images/icons/application_edit.png' alt='Edit System Settings' />
    &nbsp;&nbsp;<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' />&nbsp;&nbsp;&nbsp;<a class=admin_headings href='dbupgrade.php'>Upgrade Database</a></td></tr>\n";
    echo " </table></td>\n";
    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'>\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/user_add.png' />&nbsp;&nbsp;&nbsp;Create User
    </th></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 colspan=2 width=80%
    style='color:red;font-family:Tahoma;font-size:10px;padding-left:20px;'>
    <input type='text' size='25' maxlength='50' name='post_username'>&nbsp;*</td></tr>\n";
    echo " <tr><td class=table_rows height=25 width=20% style='padding-left:32px;' nowrap>Display Name:</td><td colspan=2 width=80%
    style='color:red;font-family:Tahoma;font-size:10px;padding-left:20px;'>
    <input type='text' size='25' maxlength='50' name='display_name'>&nbsp;*</td></tr>\n";
    echo " <tr><td class=table_rows height=25 width=20% style='padding-left:32px;' nowrap>Password:</td><td colspan=2 width=80%
    style='padding-left:20px;'><input type='password' size='25' maxlength='25' name='password'></td></tr>\n";
    echo " <tr><td class=table_rows height=25 width=20% style='padding-left:32px;' nowrap>Confirm Password:</td><td colspan=2 width=80%
    style='padding-left:20px;'>
    <input type='password' size='25' maxlength='25' name='confirm_password'></td></tr>\n";
    echo " <tr><td class=table_rows height=25 width=20% style='padding-left:32px;' nowrap>Email Address:</td><td colspan=2 width=80%
    style='color:red;font-family:Tahoma;font-size:10px;padding-left:20px;'>
    <input type='text' size='25' maxlength='75' name='email_addy'>&nbsp;*</td></tr>\n";
    echo " <tr><td class=table_rows height=25 width=20% style='padding-left:32px;' nowrap>Office:</td><td colspan=2 width=80%
    style='color:red;font-family:Tahoma;font-size:10px;padding-left:20px;'>
    <select name='office_name' onchange='group_names();'>\n";
    echo " </select>&nbsp;*</td></tr>\n";
    echo " <tr><td class=table_rows height=25 width=20% style='padding-left:32px;' nowrap>Group:</td><td colspan=2 width=80%
    style='color:red;font-family:Tahoma;font-size:10px;padding-left:20px;'>
    <select name='group_name'>\n";
    echo " </select>&nbsp;*</td></tr>\n";
    echo " <tr><td class=table_rows height=25 width=20% style='padding-left:32px;' nowrap>Sys Admin User?</td>\n";
    echo " <td class=table_rows align=left width=80% style='padding-left:20px;'><input type='radio' name='admin_perms' value='1'>&nbsp;Yes
    <input type='radio' name='admin_perms' value='0' checked>&nbsp;No</td></tr>\n";
    echo " <tr><td class=table_rows height=25 width=20% style='padding-left:32px;' nowrap>Time Admin User?</td>\n";

  4. #4
    Join Date
    Mar 2013
    Posts
    6
    "usercreate.php" part 2

    echo " <td class=table_rows align=left width=80% style='padding-left:20px;'><input type='radio' name='time_admin_perms' value='1'>&nbsp;Yes
    <input type='radio' name='time_admin_perms' value='0' checked>&nbsp;No</td></tr>\n";
    echo " <tr><td class=table_rows height=25 width=20% style='padding-left:32px;' nowrap>Reports User?</td>\n";
    echo " <td class=table_rows align=left width=80% style='padding-left:20px;'><input type='radio' name='reports_perms' value='1'>&nbsp;Yes
    <input type='radio' name='reports_perms' value='0' checked>&nbsp;No</td></tr>\n";
    echo " <tr><td class=table_rows height=25 width=20% style='padding-left:32px;' nowrap>User Account Disabled?</td>\n";
    echo " <td class=table_rows align=left width=80% style='padding-left:20px;'><input type='radio' name='disabled' value='1'>&nbsp;Yes
    <input type='radio' name='disabled' value='0' checked>&nbsp;No</td></tr>\n";
    echo " <tr><td class=table_rows align=right colspan=3 style='color:red;font-family:Tahoma;font-size:10px;'>*&nbsp;required&nbsp;</td></tr>\n";
    echo " </table>\n";
    echo " <table align=center width=60% border=0 cellpadding=0 cellspacing=3>\n";
    echo " <tr><td height=40>&nbsp;</td></tr>\n";
    echo " <tr><td width=30><input type='image' name='submit' value='Create User' align='middle'
    src='../images/buttons/next_button.png'></td><td><a href='useradmin.php'><img src='../images/buttons/cancel_button.png'
    border='0'></td></tr></table></form></td></tr>\n";include '../footer.php';
    }

    elseif ($request == 'POST') {

    include 'header_post.php'; include 'topmain.php';

    $post_username = stripslashes($_POST['post_username']);
    $display_name = stripslashes($_POST['display_name']);
    $password = $_POST['password'];
    $confirm_password = $_POST['confirm_password'];
    $email_addy = $_POST['email_addy'];
    $office_name = $_POST['office_name'];
    @$group_name = $_POST['group_name'];
    $admin_perms = $_POST['admin_perms'];
    $reports_perms = $_POST['reports_perms'];
    $time_admin_perms = $_POST['time_admin_perms'];
    $post_disabled = $_POST['disabled'];

    $post_username = addslashes($post_username);
    $display_name = addslashes($display_name);

    $query5 = "select empfullname from ".$db_prefix."employees where empfullname = '".$post_username."' order by empfullname";
    $result5 = mysql_query($query5);

    while ($row=mysql_fetch_array($result5)) {
    $tmp_username = "".$row['empfullname']."";
    }
    mysql_free_result($result5);

    $post_username = stripslashes($post_username);
    $display_name = stripslashes($display_name);

    $string = strstr($post_username, "\"");
    $string2 = strstr($display_name, "\"");

    if ((@$tmp_username == $post_username) || ($password !== $confirm_password) ||
    (!preg_match("~^([[:alnum:]]| |-|'|,)+$~", $post_username)) || (!preg_match("~^([[:alnum:]]| |-|'|,)+$~", $display_name)) || (empty($post_username)) ||
    (empty($display_name)) || (empty($email_addy)) || (empty($office_name)) || (empty($group_name)) ||
    //(!preg_match("~^([[:alnum:]]|~|\!|@|#|\$|%|\^|&|\*|\(|\)|-|\+|`|_|\=|\{|\}|\[|\]|\||\:|\<|\>|\.|,|\?)+$~", $password)) ||
    //(!preg_match("#^([[:alnum:]]|~|\!|@|#|\$|%|\^|&|\*|\(|\)|-|\+|`|_|\=|[{]|[}]|\[|\]|\||\:|\<|\>|\.|,|\?)+$#i", $password)) ||
    (!preg_match("~^([[:alnum:]]|_|\.|-)+@([[:alnum:]]|\.|-)+(\.)([a-z]{2,4})$~", $email_addy)) || (($admin_perms != '1') && (!empty($admin_perms))) ||
    (($reports_perms != '1') && (!empty($reports_perms))) || (($time_admin_perms != '1') && (!empty($time_admin_perms))) ||
    (($post_disabled != '1') && (!empty($post_disabled))) || (!empty($string))|| (!empty($string2))) {

    if (@tmp_username == $post_username) {$tmp_username = stripslashes($tmp_username);}

    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' />&nbsp;&nbsp;
    <a class=admin_headings href='useradmin.php'>User Summary</a></td></tr>\n";
    echo " <tr><td class=current_left_rows height=18 align=left valign=middle><img src='../images/icons/user_add.png' alt='Create New User' />
    &nbsp;&nbsp;<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' />&nbsp;&nbsp;
    <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' />&nbsp;&nbsp;
    <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' />&nbsp;&nbsp;
    <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' />&nbsp;&nbsp;
    <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' />&nbsp;&nbsp;
    <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' />
    &nbsp;&nbsp;<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' />&nbsp;&nbsp;
    <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' />
    &nbsp;&nbsp;<a class=admin_headings href='timeadmin.php'>Add/Edit/Delete Time</a></td></tr>\n";
    echo " <tr><td class=left_rows height=18 align=left valign=middle><img src='../images/icons/application_edit.png' alt='Edit System Settings' />
    &nbsp;&nbsp;<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' />&nbsp;&nbsp;&nbsp;<a class=admin_headings href='dbupgrade.php'>Upgrade Database</a></td></tr>\n";
    echo " </table></td>\n";

  5. #5
    Join Date
    Mar 2013
    Posts
    6
    "usercreate.php" part 3

    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";

    // begin post validation //

    if (empty($post_username)) {
    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>
    A Username is required.</td></tr>\n";
    echo " </table>\n";
    }
    elseif (empty($display_name)) {
    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>
    A Display Name is required.</td></tr>\n";
    echo " </table>\n";
    }
    elseif (!empty($string)) {
    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>
    Double Quotes are not allowed when creating an Username.</td></tr>\n";
    echo " </table>\n";
    }
    elseif (!empty($string2)) {
    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>
    Double Quotes are not allowed when creating an Display Name.</td></tr>\n";
    echo " </table>\n";
    }
    elseif (empty($email_addy)) {
    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>
    An Email Address is required.</td></tr>\n";
    echo " </table>\n";
    }
    elseif (empty($office_name)) {
    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>
    An Office is required.</td></tr>\n";
    echo " </table>\n";
    }
    elseif (empty($group_name)) {
    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>
    A Group is required.</td></tr>\n";
    echo " </table>\n";
    }
    elseif (@$tmp_username == $post_username) {
    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>
    User already exists. Create another username.</td></tr>\n";
    echo " </table>\n";
    }
    elseif (!preg_match("~^([[:alnum:]]| |-|'|,)+$~", $post_username)) {
    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>
    Alphanumeric characters, hyphens, apostrophes, commas, and spaces are allowed when creating a Username.</td></tr>\n";
    echo " </table>\n";
    }
    elseif (!preg_match("~^([[:alnum:]]| |-|'|,)+$~", $display_name)) {
    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>
    Alphanumeric characters, hyphens, apostrophes, commas, and spaces are allowed when creating a Display Name.</td></tr>\n";
    echo " </table>\n";
    }
    //elseif (!eregi ("^([[:alnum:]]|~|\!|@|#|\$|%|\^|&|\*|\(|\)|-|\+|`|_|\=|\{|\}|\[|\]|\||\:|\<|\>|\.|,|\?)+$", $password)) {
    /*elseif (!preg_match("~^([[:alnum:]]|~|\!|@|#|\$|%|\^|&|\*|\(|\)|-|\+|`|_|\=|[{]|[}]|\[|\]|\||\:|\<|\>|\.|,|\?)+$~", $password)) {
    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>
    Single and double quotes, backward and forward slashes, semicolons, and spaces are not allowed when creating a
    Password.</td></tr>\n";
    echo " </table>\n";
    }
    */
    elseif ($password != $confirm_password) {
    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>
    Passwords do not match.</td></tr>\n";
    echo " </table>\n";
    }
    elseif (!preg_match("~^([[:alnum:]]|_|\.|-)+@([[:alnum:]]|\.|-)+(\.)([a-z]{2,4})$~", $email_addy)) {
    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>
    Alphanumeric characters, underscores, periods, and hyphens are allowed when creating an Email Address.</td></tr>\n";
    echo " </table>\n";

  6. #6
    Join Date
    Mar 2013
    Posts
    6
    "timeclock.php"

    <?php
    session_start();

    include 'config.inc.php';
    include 'header.php';

    if (!isset($_GET['printer_friendly'])) {

    if (isset($_SESSION['valid_user'])) {
    $set_logout = "1";
    }

    include 'topmain.php';
    include 'leftmain.php';
    }

    echo "<title>$title</title>\n";
    $current_page = "timeclock.php";

    if (!isset($_GET['printer_friendly'])) {
    echo " <td align=left class=right_main scope=col>\n";
    echo " <table width=100% height=100% border=0 cellpadding=5 cellspacing=1>\n";
    echo " <tr class=right_main_text>\n";
    echo " <td valign=top>\n";
    }

    // code to allow sorting by Name, In/Out, Date, Notes //

    if ($show_display_name == "yes") {
    if (!isset($_GET['sortcolumn'])) {
    $sortcolumn = "displayname";
    } else {
    $sortcolumn = $_GET['sortcolumn'];
    }

    } else {

    if (!isset($_GET['sortcolumn'])) {
    $sortcolumn = "fullname";
    } else {
    $sortcolumn = $_GET['sortcolumn'];
    }

    }

    if (!isset($_GET['sortdirection'])) {
    $sortdirection = "asc";
    } else {
    $sortdirection = $_GET['sortdirection'];
    }

    if ($sortdirection == "asc") {
    $sortnewdirection = "desc";
    } else {
    $sortnewdirection = "asc";
    }

    // determine what users, office, and/or group will be displayed on main page //

    if (($display_current_users == "yes") && ($display_office == "all") && ($display_group == "all")) {
    $current_users_date = strtotime(date($datefmt));
    $calc = 86400;
    $a = $current_users_date + $calc - @$tzo;
    $b = $current_users_date - @$tzo;

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
    from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
    where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
    and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ((".$db_prefix."info.timestamp < '".$a."') and
    (".$db_prefix."info.timestamp >= '".$b."')) and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin'
    order by `$sortcolumn` $sortdirection";
    $result = mysql_query($query);
    }

    elseif (($display_current_users == "yes") && ($display_office != "all") && ($display_group == "all")) {

    $current_users_date = strtotime(date($datefmt));
    $calc = 86400;
    $a = $current_users_date + $calc - @$tzo;
    $b = $current_users_date - @$tzo;

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
    from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
    where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
    and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."'
    and ((".$db_prefix."info.timestamp < '".$a."') and (".$db_prefix."info.timestamp >= '".$b."'))
    and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin'
    order by `$sortcolumn` $sortdirection";
    $result = mysql_query($query);
    }

    elseif (($display_current_users == "yes") && ($display_office == "all") && ($display_group != "all")) {

    $current_users_date = strtotime(date($datefmt));
    $calc = 86400;
    $a = $current_users_date + $calc - @$tzo;
    $b = $current_users_date - @$tzo;

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
    from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
    where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
    and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.groups = '".$display_group."'
    and ((".$db_prefix."info.timestamp < '".$a."') and (".$db_prefix."info.timestamp >= '".$b."'))
    and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin'
    order by `$sortcolumn` $sortdirection";
    $result = mysql_query($query);
    }

    elseif (($display_current_users == "yes") && ($display_office != "all") && ($display_group != "all")) {

    $current_users_date = strtotime(date($datefmt));
    $calc = 86400;
    $a = $current_users_date + $calc - @$tzo;
    $b = $current_users_date - @$tzo;

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
    from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
    where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
    and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."'
    and ".$db_prefix."employees.groups = '".$display_group."' and ((".$db_prefix."info.timestamp < '".$a."')
    and (".$db_prefix."info.timestamp >= '".$b."')) and ".$db_prefix."employees.disabled <> '1'
    and ".$db_prefix."employees.empfullname <> 'admin'
    order by `$sortcolumn` $sortdirection";
    $result = mysql_query($query);
    }

    elseif (($display_current_users == "no") && ($display_office == "all") && ($display_group == "all")) {

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
    from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
    where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
    and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.disabled <> '1'
    and ".$db_prefix."employees.empfullname <> 'admin'
    order by `$sortcolumn` $sortdirection";
    $result = mysql_query($query);
    }

    elseif (($display_current_users == "no") && ($display_office != "all") && ($display_group == "all")) {

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
    from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
    where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
    and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."'
    and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin'
    order by `$sortcolumn` $sortdirection";
    $result = mysql_query($query);
    }

    elseif (($display_current_users == "no") && ($display_office == "all") && ($display_group != "all")) {

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
    from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
    where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
    and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.groups = '".$display_group."'
    and ".$db_prefix."employees.disabled <> '1' and ".$db_prefix."employees.empfullname <> 'admin'
    order by `$sortcolumn` $sortdirection";
    $result = mysql_query($query);
    }

    elseif (($display_current_users == "no") && ($display_office != "all") && ($display_group != "all")) {

    $query = "select ".$db_prefix."info.*, ".$db_prefix."employees.*, ".$db_prefix."punchlist.*
    from ".$db_prefix."info, ".$db_prefix."employees, ".$db_prefix."punchlist
    where ".$db_prefix."info.timestamp = ".$db_prefix."employees.tstamp and ".$db_prefix."info.fullname = ".$db_prefix."employees.empfullname
    and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.office = '".$display_office."'
    and ".$db_prefix."employees.groups = '".$display_group."' and ".$db_prefix."employees.disabled <> '1'
    and ".$db_prefix."employees.empfullname <> 'admin'
    order by `$sortcolumn` $sortdirection";
    $result = mysql_query($query);
    }

    $time = time();
    $tclock_hour = gmdate('H',$time);
    $tclock_min = gmdate('i',$time);
    $tclock_sec = gmdate('s',$time);
    $tclock_month = gmdate('m',$time);
    $tclock_day = gmdate('d',$time);
    $tclock_year = gmdate('Y',$time);
    $tclock_stamp = mktime ($tclock_hour, $tclock_min, $tclock_sec, $tclock_month, $tclock_day, $tclock_year);

    $tclock_stamp = $tclock_stamp + @$tzo;
    $tclock_time = date($timefmt, $tclock_stamp);
    $tclock_date = date($datefmt, $tclock_stamp);
    $report_name="Current Status Report";

    echo " <table width=100% align=center class=misc_items border=0 cellpadding=3 cellspacing=0>\n";

    if (!isset($_GET['printer_friendly'])) {
    echo " <tr class=display_hide>\n";
    } else {
    echo " <tr>\n";
    }

    echo " <td nowrap style='font-size:9px;color:#000000;padding-left:10px;'>$report_name&nbsp;&nbsp;---->&nbsp;&nbsp;As of: $tclock_time,
    $tclock_date</td></tr>\n";
    echo " </table>\n";
    include 'display.php';

    if (!isset($_GET['printer_friendly'])) {
    include 'footer.php';
    }

    ?>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles