-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfinissInsertData.php
52 lines (38 loc) · 1.55 KB
/
finissInsertData.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
include_once("data.inc.php");
include_once("function.inc.php");
//Pieslēdzamies MySQL
mysql_connect($host, $user, $pass);
mysql_select_db($dbName);
//Pieslēdzamies MySQL BEIGAS
$data['numurs'] = $_POST['numurs'];
$data['laiksH'] = $_POST['laiksH'];
$data['laiksM'] = $_POST['laiksM'];
$data['laiksS'] = $_POST['laiksS'];
$dataOk = dataCheckFiniss($data);
if (isset($dataOk)) {
registretFinisu($data);
}
function registretFinisu($dataReg) {
// FUNKCIJA DATU PIEVIENOŠANAI MYSQL UN MS ACCESS
global $hour;
global $day;
global $month;
global $year;
//APRĒĶINA LAIKU PRIEKŠ MYSQL UN ODBC
$laiks = mktime($dataReg['laiksH'] + $hour, $dataReg['laiksM'], $dataReg['laiksS'], $month, $day, $year);
$laiksSec = $laiks - mktime($hour, 0, 0, $month, $day, $year);
$laiksOdbc = $dataReg['laiksH'] . ":" . $dataReg['laiksM'] . ":" . $dataReg['laiksS'];
//IEVIETO DATUS MYSQL
$query = "UPDATE `sistema`.`registracija` SET Finiss = '$laiksSec', ipFiniss = '".$_SERVER['REMOTE_ADDR']."' WHERE Numurs = '".$dataReg['numurs']."'";
mysql_query($query);
$resultStarts = mysql_query("SELECT Starts FROM registracija WHERE Numurs = '".$dataReg['numurs']."'");
$rowStarts = mysql_fetch_row($resultStarts);
//if ($rowStarts[0] != 0) {
// $rezultats = $laiksSec - $rowStarts[0];
// $query = "UPDATE `sistema`.`registracija` SET Rezultats = '$rezultats', ipFiniss = '".$_SERVER['REMOTE_ADDR']."' WHERE Numurs = '".$dataReg['numurs']."'";
// //mysql_query($query);
//}
mysql_close();
header('Location: finissForm.php');
}