forked from Luis-J-Ianez/cubecomps.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
seteventfld.php
53 lines (50 loc) · 1.21 KB
/
seteventfld.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
53
<?
include "lib_ref_admin.php";
function timelimitNum00($t)
{
if (!$t) return 0;
$t = substr("000:00.00",0,9-strlen($t)).$t;
// $hh = 0; // !
$hh = (int)substr($t,7,2);
$sec = (int)substr($t,4,2);
$min = (int)substr($t,0,3);
$hh = (($min*60)+$sec)*100+$hh;
return $hh;
}
function formatTimelimit00($t)
{
if (preg_match("/^[0-9]{1,2}\072[0-5][0-9]$/",$t)) $t .= ".00";
while(strlen($t)>4 && ((($ch=substr($t,0,1))=="0") || $ch==":")) $t = substr($t,1);
$l = strlen($t);
if ($l>4) $t = substr($t,0,$l-2)."00";
return $t;
}
if ($_GET["id"] && $_GET["fld"] && isset($_GET["value"]))
{
include "db.php";
//
$value = $_GET["value"];
if ($_GET["fld"]=="timelimit")
{
if ($value && !preg_match("/^([0-9]{1,2}\072[0-5][0-9]\056[0-9]{2}|[0-5]?[0-9]\056[0-9]{2}|[0-9]{1,2}\072[0-5][0-9])$/",$value))
$value = "";
if ($value)
{
$value = formatTimelimit00($value);
if (!timelimitNum00($value)) $value = "";
}
}
//
$result = strict_mysql_query("UPDATE $eventstable SET " . $_GET["fld"] . "='$value' WHERE id=" . $_GET["id"]);
//
if ($_GET["fld"]=="timelimit")
if ($value)
$value = "cutoff $value";
else
$value = "no cutoff";
echo $value;
//
mysql_close();
//$_SESSION["hl"] = $_GET["hl"];
}
?>