escape_string($str_member_ID); $_q = $dbs->query("SELECT member_id,member_name,member_image,inst_name, IF(TO_DAYS('".date('Y-m-d')."')>TO_DAYS(expire_date), 1, 0) AS is_expire FROM member WHERE member_id='$str_member_ID'"); // if member is already registered if ($_q->num_rows > 0) { $_d = $_q->fetch_assoc(); if ($_d['is_expire'] == 1) { $expire = 1; } $member_id = $_d['member_id']; $member_name = $_d['member_name']; $member_name = preg_replace("/'/", "\'", $member_name); $photo = trim($_d['member_image'])?trim($_d['member_image']):'person.png'; $_institution = trim($_d['inst_name'])?"'".$_d['inst_name']."'":'NULL'; $_institution = preg_replace("/'/", "\'", $_institution); $_checkin_date = date('Y-m-d H:i:s'); $_i = $dbs->query("INSERT INTO visitor_count (member_id, member_name, institution, checkin_date) VALUES ('$member_id', '$member_name', $_institution, '$_checkin_date')"); } else { // non member $_d = $_q->fetch_assoc(); $member_name = $dbs->escape_string(trim($_POST['memberID'])); $_institution = $dbs->escape_string(trim($_POST['institution'])); $_checkin_date = date('Y-m-d H:i:s'); if (!$_institution) { return INSTITUTION_EMPTY; } else { $_i = $dbs->query("INSERT INTO visitor_count (member_name, institution, checkin_date) VALUES ('$member_name', '$_institution', '$_checkin_date')"); } } return true; } $memberID = trim($_POST['memberID']); $counter = setCounter($memberID); if ($counter === true) { echo __($member_name.', thank you for inserting your data to our visitor log').''; if ($expire) { echo '