", ""); $moId = getSingleTagContent($messageReq, "", ""); $cmpComp = getSingleTagContent($messageReq, "", ""); $userName = getSingleTagContent($messageReq, "", ""); $userFirstname = getSingleTagContent($messageReq, "", ""); $userEmail = getSingleTagContent($messageReq, "", ""); $userMobile = getSingleTagContent($messageReq, "", ""); $userAccount = getSingleTagContent($messageReq, "", ""); $userPassword = getSingleTagContent($messageReq, "", ""); $userSession = getSingleTagContent($messageReq, "", ""); $appKey = getSingleTagContent($messageReq, "", ""); $appId = getSingleTagContent($messageReq, "", ""); $usrId = getSingleTagContent($messageReq, "", ""); $hq_id = getSingleTagContent($messageReq, "", ""); // --------------------------------------------- // Proprietärer Kram !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $ttEvent = getSingleTagContent($messageReq, "", ""); $ttTimestamp = getSingleTagContent($messageReq, "", ""); $gpsLong = getSingleTagContent($messageReq, "", ""); $gpsLat = getSingleTagContent($messageReq, "", ""); // --------------------------------------------- // Decode $search = mcDecode($search); $userName = mcDecode($userName); $userPassword = mcDecode($userPassword); $appKey = mcDecode($appKey); /* $functionName = "appRegister"; $appKey = "AAAAAAAAAA"; $appId = "1"; */ /* $functionName = "login"; $moId = "6"; $usrId = "18086"; $appKey = "AAAAAAAAAA"; $appId = "1"; */ /* $functionName = "setTimekeepingEvent"; $userSession = "495f2fdc997fe9da827107e64218434d"; $moId = "6"; $usrId = "18086"; $ttEvent = "1"; $ttTimestamp = "2014-01-01 10:00:00"; $gpsLong = "53.000001"; $gpsLat = "9.000001"; */ // --------------------------------------------- // ***************** // * TIME TRACKING * // ***************** function setTimetrackingEvent ($moId, $usrId, $ttEvent, $ttTimestamp, $gpsLong, $gpsLat, $description) { global $dbname, $dblogin, $dbpassword; // Get operational IP and port from $moId if ($moId != "" && $usrId != "" && $ttEvent != "") : // Get operational database instance via metaobject $moValue = getOperationalDatabase($moId); if ($moValue != "") : if ($ttTimestamp == "") : $ttTimestamp = getDateTime("0"); endif; // Set operational database and insert event $db_op_conn = getDbConnectionSpecial($moValue, $dbname, $dblogin, $dbpassword); $sqlStmt = "INSERT INTO phoenix_group.timetracking (tt_datetime,tt_id,usr_id,tt_gps_long,tt_gps_lat,tt_description)" . " VALUES ('" . $ttTimestamp . "','" . $ttEvent . "','" . $usrId . "','" . $gpsLong . "','" . $gpsLat . "','" . $description . "')"; $res = $db_op_conn->query($sqlStmt); if (DB::isError($res)) : die ("$PHP_SELF: " . $res->getMessage()); endif; $retArray = array("0"); else: $retArray = array("802","802\n","" . getLngt("Operational database cannot be connected!") . "\n"); endif; else: $retArray = array("801","801\n","" . getLngt("Request has emty items!") . "\n"); endif; return $retArray; } // For compatibility only function setTimekeepingEvent ($moId, $usrId, $ttEvent, $ttTimestamp, $gpsLong, $gpsLat, $description) { return setTimetrackingEvent ($moId, $usrId, $ttEvent, $ttTimestamp, $gpsLong, $gpsLat, $description); } function getLastTimetrackingEvent ($moId, $usrId) { global $dbname, $dblogin, $dbpassword; // Get operational IP and port from $moId if ($moId != "" && $usrId != "") : // Get operational database instance via metaobject $moValue = getOperationalDatabase($moId); if ($moValue != "") : // Set operational database and insert event $db_op_conn = getDbConnectionSpecial($moValue, $dbname, $dblogin, $dbpassword); $tmpSqlQuery = "SELECT tt_datetime, tt_id, tt_gps_long, tt_gps_lat, tt_description FROM phoenix_group.timetracking WHERE usr_id = '" . $usrId . "' ORDER BY tt_datetime DESC LIMIT 0,1"; $result = $db_op_conn->query($tmpSqlQuery); while ($row = $result->fetch_assoc()): $retArray = array("0", $row["tt_datetime"], $row["tt_id"], $row["tt_gps_long"], $row["tt_gps_lat"], $row["tt_description"]); endwhile; $result->free(); else: $retArray = array("802","802\n","" . getLngt("Operational database cannot be connected!") . "\n"); endif; else: $retArray = array("801","801\n","" . getLngt("Request has emty items!") . "\n"); endif; return $retArray; } // --------------------------------------------- // ------------------------------------------------------------------------------------------------------ // ************** // * XML Output * // ************** $retVal = ""; $xmlOut = ""; $xmlNoErrOut .= "0\nOK\n"; $xmlErrOut .= "100\nCurrently not implemented.\n"; if ($functionName == "appRegister" || $functionName == "webRegister" || $functionName == "login" || checkAccess($userSession, $moId, $usrId)) : if ($transactionHandle != "") : // $xmlOut .= "" . $transaction_no . "\n"; endif; $xmlOut .= "\n"; if ($functionName != "") : if (function_exists($functionName)) : if ($functionName == "appRegister") : $retVal = call_user_func_array($functionName, array($appKey, $appId)); // Register APP and get mo_id, usr_id and hq_id for response if ($retVal[0] != "0") : $xmlOut .= $retVal[1] . $retVal[2]; else : $xmlOut .= $xmlNoErrOut; $xmlOut .= "" . $retVal[2] . "\n"; $xmlOut .= "" . $retVal[1] . "\n"; endif; elseif ($functionName == "webRegister") : $retVal = call_user_func_array($functionName, array($cmpComp, $userName, $userFirstname, $userEmail, $userMobile, $userAccount, $userPassword)); // Register WEB, generate mandator if ($retVal[0] != "0") : $xmlOut .= $retVal[1] . $retVal[2]; else : $xmlOut .= $xmlNoErrOut; $xmlOut .= "" . $retVal[2] . "\n"; $xmlOut .= "" . $retVal[1] . "\n"; endif; elseif ($functionName == "login") : $retVal = call_user_func_array($functionName, array($moId, $usrId, $appKey, $appId)); // Check requested user and APP data if ($retVal[0] != "0") : $xmlOut .= $retVal[1] . $retVal[2]; else : $xmlOut .= $xmlNoErrOut; $xmlOut .= "" . $retVal[4] . "\n"; $xmlOut .= "" . $retVal[3] . "\n"; $xmlOut .= "" . $retVal[2] . "\n"; $xmlOut .= "\n"; $xmlOut .= "" . $retVal[8] . "\n"; $xmlOut .= "" . $retVal[1] . "\n"; $xmlOut .= "\n"; $xmlOut .= "\n"; endif; // ------------------------------------------- // To be put in external script or so.... !!!! elseif ($functionName == "setTimekeepingEvent" || $functionName == "setTimetrackingEvent") : $retVal = call_user_func_array($functionName, array($moId, $usrId, $ttEvent, $ttTimestamp, $gpsLong, $gpsLat, "")); // Set timetracking event if ($retVal[0] != "0") : $xmlOut .= $retVal[1] . $retVal[2]; else : $xmlOut .= $xmlNoErrOut; // $xmlOut .= "" . $retVal[4] . "\n"; endif; elseif ($functionName == "getLastTimetrackingEvent") : $retVal = call_user_func_array($functionName, array($moId, $usrId)); // Get last timetracking event if ($retVal[0] != "0") : $xmlOut .= $retVal[1] . $retVal[2]; else : $xmlOut .= $xmlNoErrOut; $xmlOut .= "" . $retVal[1] . "\n"; $xmlOut .= "" . $retVal[2] . "\n"; $xmlOut .= "" . $retVal[3] . "\n"; $xmlOut .= "" . $retVal[4] . "\n"; $xmlOut .= "\n"; endif; else : // Call corresponding script according to the APP ID // .... // $xmlOut .= "103\n"; // $xmlOut .= "Function does not exist in API.\n"; endif; else : $xmlOut .= "102\n"; $xmlOut .= "Specified function does not exist.\n"; endif; else : $xmlOut .= "101\n"; $xmlOut .= "No function specified.\n"; endif; $xmlOut .= "\n"; else : $xmlOut .= $xmlErrOut; endif; echo $xmlOut; /* https://212.79.60.73/htm/mobile/accessMobileXML.php [A] Registrierung und Mandantenanlage über das WEB .... webRegister Firma Nachname Vorname Mailadresse Mobilnummer Nachname Passwort .... [B] Ablaufschritte für die Einzelregistrierung der APP: 1. Schritt: Die Registrierungsanfrage der "frischen" oder manuell deaktivierten APP sendet den eingegebenen Registrierungscode an den Server. Die APP-ID ist für die Zeiterfassungs-APP immer "1". Das XML-Rahmenformat ist dasselbe wie bei der Vertriebs-APP. Request-Bsp. .... appRegister Rc34rFghZ78tx // Registrierungscode 1 // ID der APP .... Response-Bsp. .... 0 // Verifikation Registrierungscode ok, wenn = "0" 6 // Interne Nummer der Datenbank-Instanz, auf die der Server zugreifen muss (z.B "8") 23 // Eindeutige ID des Benutzers der korrespondierenden DB-Instanz .... 2. Schritt: Nach der erfolgreichen Registrierung erfolgt ein sich anschließender Login-Prozess. Request-Bsp. .... login 6 // Instanz der DB, auf die zugegriffen werden muss 23 // Benutzer-ID Rc34rFghZ78tx // Registrierungscode (wird auch wieder mitgegeben zum Abgleich ob serverseitig zurückgesetzt) 1 // ID der APP (wird mitgeführt wg. Check des Registrierungscodes) .... Response-Bsp. .... 0 // Login ok, wenn = "0" ....hash.... 6 .... .... 23 .... 3. Schritt: Request für operative Daten. Senden des Events mit Koordinaten Request-Bsp. .... setTimekeepingEvent ....hash.... 6 23 1 // "1" = User fängt (wieder) zu arbeiten an | "2" = Pause oder Feierabend 9.9876 // Notation mit "." 53.123 // Notation mit "." .... Response-Bsp. .... 0 // Operation ok, wenn = "0" .... */ ?>