You are not logged in!!!"; } else { $userid = $_SESSION['user_id']; $result = $sql->prepare("SELECT punches.id as punchid, users.id as user, punchtypes.id as typeid, punchtypes.punchname as type, punches.time as time, punches.notes as notes, punches.modified as modified FROM punches INNER JOIN users ON punches.userid = users.id INNER JOIN punchtypes ON punches.punchtypeid = punchtypes.id WHERE users.id = $userid ORDER BY punches.id DESC LIMIT 1"); $result->execute(); $last = $result->fetchObject(); echo "

Current Status

"; echo "

You have been Punched $last->type since $last->time.

"; echo "

Quick Punch

"; echo "

Clicking the button below will immediately enter a new punch for you depending on your current status. Any notes you enter will be attached to the punch for your administrator to review.

"; echo "
"; echo "
"; echo ""; echo "
"; if ($last->typeid=="00000000001") { //$result = $sql->prepare("INSERT INTO punches (userid, punchtypeid, time) VALUES ($userid, "00000000002", NOW())"); //$result->execute(); //$punch = $result->fetchObject(); echo ""; } else { echo ""; } echo "
"; echo "
"; echo "
"; } //********** END CONTENT **********// require_once($yaptc_inc . "footer.inc.php"); ?>