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