Source code of Tongda OA fingerprint Attendance Machine Interface

Source: Internet
Author: User

Similar articles have been updated. Please send and view them:

Tongda OA
Synchronous Central Control attendance machine enhanced edition http://blog.csdn.net/tao2581/article/details/7393967

Tongda oa2011 already supports fingerprint attendance machines, but only limited to the iclock660 model of 2000 oceans.

Through the interface developed in this article, you can integrate with any fingerprint machine, and the fingerprint machine management software can save data in real time.

I am using the central control u160 fingerprint attendance machine. This machine supports WiFi and can transmit attendance data in real time,

It is particularly pointed out that the u160wifi configuration of the central control of this machine is prone to errors because the IP segment connected to the network is set to 192.168.3.x.

The IP address range of the Wi-Fi network is 192.168.1.x. In this way, the success can be ensured. Most of them are incorrect here.

 

The attendance machine management software will generate an Access database to store information, or other databases. Similarly, our purpose is to use

PHP connects to this database and synchronizes the information to the OA attendance records. This interface is applicable to Tongda OA, Tongda OA 2010, and earlier versions of Tongda Oa are not tested.

 

In the code, add two types and update_time fields to the attend_duty table of Tongda OA,

Synchronization code:

<? Include_once ("INC/td_core.php"); include_once ("INC/Conn. PHP "); include_once (" INC/utility. PHP "); include_once (" INC/utility_all.php "); $ access_path =" D: \ Program Files \ att2008 \ att2000.mdb "; $ cur_date = date ("Y-m-d", time (); $ conn = new COM ("ADODB. connection "); $ connstr =" driver = {Microsoft Access Driver (*. MDB)}; DBQ = ". realpath ("{$ access_path}"); $ Conn-> open ($ connstr); $ rs = new COM ("ADODB. re Cordset "); $ query =" select checkinout. userid as userid, checkinout. checktime as checktime, userinfo. name as name from checkinout, userinfo where checkinout. userid = userinfo. userid "; $ RS-> open ($ query, $ Conn, 1, 1); $ I = 0; while (! $ RS-> EOF) {$ query1 = "select user_id from user where user_name = '". $ RS-> fields ("name "). "'"; $ cursor1 = exequery ($ connection, $ query1); if ($ row1 = mysql_fetch_array ($ cursor1 )) {$ user_id = $ row1 ['user _ id']; // $ cur_date = date ("Y-m-d", time ()); $ cur_time = $ RS-> fields ("checktime"); $ cur_time = str_replace ("Morning", "", $ cur_time); $ cur_time = str_replace ("12 PM ", "12", $ cur_time); If (strpos ($ cur_time, "Afternoon")>-1 )) {// Delete the processing time format plus 12 hours in the morning and afternoon $ cur_time = str_replace ("Afternoon", "", $ cur_time); $ cur_time = strtotime ($ cur_time) + 43200; $ cur_time = date ("Y-m-d h: I: s", $ cur_time + 12);} $ update_time = date ("Y-m-d h: I: s ", time (); $ register_type =" 2 "; $ T = $ _ request ['tcode']; $ query = "select * From attend_duty where user_id = '". $ user_id. "'and to_days (register_time) = to_days (' {$ cur_time} ') order by id desc limit 1"; $ cursor = exequery ($ connection, $ Query); If (! ($ ROW = mysql_fetch_array ($ cursor) {$ register_type = 1; $ query = "insert into attend_duty (user_id, register_type, register_time, register_ip, type, update_time) values ('". $ user_id. "',' {$ register_type} ',' {$ cur_time} ', 'zk fingerprint attendance machine', '0', '{$ update_time }')"; exequery ($ connection, $ query); $ I ++;} else {$ register_type = 2; if ($ row ['register _ type'] = 1) {If (strtotime ($ cur_time)> strtotime ($ row ['register _ time']) $ q Uery = "insert into attend_duty (user_id, register_type, register_time, register_ip, type, update_time) values ('". $ user_id. "',' {$ register_type} ',' {$ cur_time} ', 'zk fingerprint attendance machine', '0', '{$ update_time }')";} else $ query = "Update attend_duty set type = '0', register_time = '". $ cur_time. "', register_ip = 'zk fingerprint attendance machine', update_time = '". $ update_time. "'where user_id = '". $ user_id. "'and register_type =' {$ register_type} 'and to_days (Regis Ter_time) = to_days ('{$ cur_time}') "; exequery ($ connection, $ query); $ I ++ ;}}$ RS-> movenext ();} echo "updated successfully ". ($ I ). "record! ";?>

The following is the scheduled code execution of Tongda OA.
The synchronization program can be executed every 1 minute before nine o'clock A.M., and every 5 minutes from.
The specific content is not explained in detail by yourself.
 
Webroot \ ispirit \ status_bar.php.

<? PHP/********************* // * version: 5.1.0 * // * Author: RM * // * Comment: 071223 * // *** // ***********************/include_once ("INC/auth. PHP "); include_once (" INC/utility_all.php "); include_once (" INC/td_core.php "); $ query =" select * from user where user_id = '". $ login_user_id. "'"; $ cursor = exequery ($ connection, $ query); if ($ ROW = mysql_fetch_array ($ cursor )) {$ sms_on = $ row ['sms _ on']; $ Cal Rochelle sound = $ row ['call _ sound']; $ Pwd = $ row ['Password']; $ Pwd = substr (MD5 (keyed_str ($ PWD, "blvy"), 0, 16) ;}$ check_sms = 0; If (find_id ($ user_func_id_str, "42") {$ check_sms = 1 ;} else {$ query = "select * From sms2_priv"; $ cursor = exequery ($ connection, $ query); if ($ ROW = mysql_fetch_array ($ cursor )) {$ sms2_remind_priv = $ row ['sms2 _ remind_priv '];} If (find_id ($ sms2_remind_priv, $ login_user _ ID) {$ check_sms = 1 ;}$ new_sms_html = "<a href = '# 'onclick = 'javascript: show_sms (); 'title = 'click to view SMS'>  SMS </a> "; if ($ call_sound! = "0") {$ new_sms_sound_html = "<Object ID = 'sms _ sound' classid = 'clsid: D27CDB6E-AE6D-11cf-96B8-444553540000 'codebase = '/INC/swflash. cab 'width = '0' Height = '0'> <Param name = 'movie 'value ='/WAV /". $ call_sound. ". SWF '> <Param name = Quality value = high> <embed id = 'sms _ sound' src ='/WAV/audio $call_sound#.swf 'width = '0' Height = '0' Quality = 'autohigh' wmode = 'opaque' type = 'application/X-Shockwave-flash' plugspace = 'HTTP: // Www.macromedia.com/shockwave/download/index.cgi? P1_prod_version = shockwaveflash '> </embed> </Object> ";}else {$ new_sms_sound_html = "";} echo "\ r \ n <HTML> \ r \ n 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.