| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/(Del)pathways.org.hk/MIS20140127/old20140414/Event/ |
Upload File : |
<?php
require_once '../include/DBConnect.php';
if (!isset($_POST['event_id']) && !isset($_POST['activity_id'])) {
SaveActivity($_POST, SaveEvent($_POST));
} else {
DeleteRecord($_POST);
SaveActivity($_POST, SaveEvent($_POST));
}
?>
<script>
alert("Insert data successful!!");
window.location.href = "Event_List.php";
</script>
<?php
function SaveEvent($POST) {
global $dbh;
$sth = $dbh->prepare("INSERT INTO `event`(`createby`, `createdate`, `lastupby`, `lastupdate`, `actived`, `deleted`,
`event_code`, `program_id`, `subject_id`, `class_size`, `programme_fee_type`,
`primary_individual_price`, `primary_group_price`, `primary_package_price`,
`secondary_individual_price`, `secondary_group_price`, `secondary_package_price`,
`is_free`, `school_id`) VALUES(1,now(),1,now(),1,0,?,?,?,?,5,0,0,0,0,0,0,1,?) ");
$sth->bindParam(1, $POST['code']);
$sth->bindParam(2, $POST['programme']);
$sth->bindParam(3, $POST['subject']);
$sth->bindParam(4, $POST['classsize']);
$sth->bindParam(5, $POST['schoolid']);
$sth->execute();
return $event_id = $dbh->lastInsertId();
}
function SaveActivity($POST, $event_id) {
global $dbh;
$sth = $dbh->prepare("INSERT INTO `activity`(`createby`, `createdate`, `lastupby`, `lastupdate`, `actived`, `deleted`,
`event_id`, `title`, `date`, `start_time`, `end_time`, `payment`, `number_attend`)
VALUES (1,now(),1,now(),1,0,?,?,?,?,?,?,?)");
$sth->bindParam(1, $event_id);
$sth->bindParam(2, $POST['title']);
$sth->bindParam(3, $POST['date']);
$sth->bindParam(4, $POST['starttime']);
$sth->bindParam(5, $POST['endtime']);
$sth->bindParam(6, $POST['payment']);
$sth->bindParam(7, $POST['numberofattend']);
$sth->execute();
}
function DeleteRecord($POST) {
global $dbh;
$dbh->query("Update event set deleted = 1 where event_id = " . $POST['event_id']);
$dbh->query("Update activity set deleted = 1 where activity_id = " . $POST['activity_id']);
}
?>