forked from che0/greybox
-
Notifications
You must be signed in to change notification settings - Fork 3
/
liga.edit.exec.inc
47 lines (38 loc) · 1.28 KB
/
liga.edit.exec.inc
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
<?php
/*
* greybox
* $Id: liga.edit.exec.inc,v 1.3 2005/04/15 09:08:15 che0 Exp $
*/
if ($GLOBALS["cps_souteze"] < 2) {
pg_achtung($lang["access denied"]);
return;
}
$liga_id = $_REQUEST["liga_id"];
$nazev = $_REQUEST["nazev"];
$rocnik = $_REQUEST["rocnik"];
$komentar = filter_comment($_REQUEST["komentar"]);
if ($nazev == "" && !isset($_REQUEST["delete"])) {
pg_achtung($lang["a league has to have a name"]);
return;
}
if (isset($_REQUEST["add"])) {
// add new
if (cpdb_exec("insert into liga (nazev, rocnik, komentar) values (:nazev, :rocnik, :komentar)", array(":nazev"=>$nazev, ":rocnik"=>$rocnik, ":komentar"=>$komentar))) {
pg_achtung($lang["league insert ok"]);
$_REQUEST["liga_id"] = cpdb_insert_id();
include("liga.inc");
}
} elseif (isset($_REQUEST["save"])) {
// update
if (cpdb_exec("update liga set nazev = :nazev, rocnik = :rocnik, komentar = :komentar where liga_ID = :liga_id", array(":liga_id"=>$liga_id, ":nazev"=>$nazev, ":rocnik"=>$rocnik, ":komentar"=>$komentar))) {
pg_achtung($lang["league update ok"]);
include("liga.inc");
}
} elseif (isset($_REQUEST["delete"])) {
// delete
if (cpdb_exec("delete from liga where liga_ID = :liga_id", array(":liga_id"=>$liga_id))) {
pg_achtung($lang["league delete ok"]);
include("souteze.inc");
}
}
?>