Synchronization between Tongda OA and central control attendance machine for the optimal HTTP solution with source code

Source: Internet
Author: User

The central control attendance machine software can download the attendance machine records to the local database in real time. What is annoying is that the attendance machine software is often disconnected from the device and will not be automatically reconnected after the disconnection, which is too bad before the test, there are no other solutions available. After painstaking efforts, I thought of using the attendance machine IP address to access a Web page. So with the above Code. Cross the attendance machine software.

As long as your attendance machine is a central control series and you can use the IP address of the attendance machine to open the web interface, you can use the following method to ensure stability and efficiency. We strongly recommend that you use this method!

Usage:

1. Replace 192.168.1.202 with your attendance Server IP address.

2. Back up the original file and overwrite the following content: myoa \ webroot \ task \ sync_duty_machine.php

3. Choose System Management> scheduled task management> enable data synchronization on the attendance machine. OK!

<? $ Start = microtime (true); $ con = mysql_connect (127.0.0.1: 3336 "," root "," myoa888 "); If (! $ Con) echo "unable to connect to MySQL"; mysql_select_db ("td_oa"); mysql_query ("set names gb2312 "); // get OA user data $ rs = mysql_query ("select user_id, user_name from user"); While ($ ROW = mysql_fetch_array ($ RS) $ duty_user [] = $ row; $ rs = mysql_query ("select register_time from attend_duty order by register_time DESC limit 1"); $ ROW = mysql_fetch_array ($ RS); $ startdate = $ row [0]; // obtain all user IDs and names on the attendance machine $ websource = file_get_contents ("H Ttp: // 192.168.1.202/CSL/query "); preg_match_all ("/uid value = (\ D {1,})>/", $ websource, $ user ); foreach ($ user [1] as $ U) $ userstr. = $ U. ","; // obtain the attendance record ****.................. // update the attendance record $ CNT = 0 ;/*...... hidden part of business cooperation q | 343828881 */$ end = microtime (true); $ time = $ end-$ start; if ($ CNT) {$ open = @ fopen ("log.txt", "A"); $ add = "updated {$ CNT} data records, time consumed :". number_format ($ time, 2 ,'. ',""). "seconds ". date ("Y-m-d h: I: s "). "\ r \ n"; @ fwrite ($ open, $ Dd); fclose ($ open) ;}?>

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.