本文整理汇总了PHP中mysql_format_date函数的典型用法代码示例。如果您正苦于以下问题:PHP mysql_format_date函数的具体用法?PHP mysql_format_date怎么用?PHP mysql_format_date使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysql_format_date函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updt_ticket
function updt_ticket($id)
{
/* 1/25/09 */
global $addrs, $NOTIFY_TICKET;
$post_frm_meridiem_problemstart = empty($_POST) || !empty($_POST) && empty($_POST['frm_meridiem_problemstart']) ? "" : $_POST['frm_meridiem_problemstart'];
$post_frm_meridiem_booked_date = empty($_POST) || !empty($_POST) && empty($_POST['frm_meridiem_booked_date']) ? "" : $_POST['frm_meridiem_booked_date'];
//10/1/09
$post_frm_affected = empty($_POST) || !empty($_POST) && empty($_POST['frm_affected']) ? "" : $_POST['frm_affected'];
$_POST['frm_description'] = strip_html($_POST['frm_description']);
//clean up HTML tags
$post_frm_affected = strip_html($post_frm_affected);
$_POST['frm_scope'] = strip_html($_POST['frm_scope']);
if (!get_variable('military_time')) {
//put together date from the dropdown box and textbox values
if ($post_frm_meridiem_problemstart == 'pm') {
$post_frm_meridiem_problemstart = ($post_frm_meridiem_problemstart + 12) % 24;
}
}
if (!get_variable('military_time')) {
//put together date from the dropdown box and textbox values
if ($post_frm_meridiem_booked_date == 'pm') {
$post_frm_meridiem_booked_date = ($post_frm_meridiem_booked_date + 12) % 24;
}
}
if (empty($post_frm_owner)) {
$post_frm_owner = 0;
}
$frm_problemstart = "{$_POST['frm_year_problemstart']}-{$_POST['frm_month_problemstart']}-{$_POST['frm_day_problemstart']} {$_POST['frm_hour_problemstart']}:{$_POST['frm_minute_problemstart']}:00{$post_frm_meridiem_problemstart}";
if (intval($_POST['frm_status']) == 3) {
// 1/21/11
$frm_booked_date = "{$_POST['frm_year_booked_date']}-{$_POST['frm_month_booked_date']}-{$_POST['frm_day_booked_date']} {$_POST['frm_hour_booked_date']}:{$_POST['frm_minute_booked_date']}:00{$post_frm_meridiem_booked_date}";
} else {
// $frm_booked_date = "NULL";
$frm_booked_date = "";
// 6/20/10
}
if (!get_variable('military_time')) {
//put together date from the dropdown box and textbox values
if ($post_frm_meridiem_problemstart == 'pm') {
$_POST['frm_hour_problemstart'] = ($_POST['frm_hour_problemstart'] + 12) % 24;
}
if (isset($_POST['frm_meridiem_problemend'])) {
if ($_POST['frm_meridiem_problemend'] == 'pm') {
$_POST['frm_hour_problemend'] = ($_POST['frm_hour_problemend'] + 12) % 24;
}
}
if (isset($_POST['frm_meridiem_booked_date'])) {
//10/1/09
if ($_POST['frm_meridiem_booked_date'] == 'pm') {
$_POST['frm_hour_booked_date'] = ($_POST['frm_hour_booked_date'] + 12) % 24;
}
}
}
$frm_problemend = isset($_POST['frm_year_problemend']) ? quote_smart("{$_POST['frm_year_problemend']}-{$_POST['frm_month_problemend']}-{$_POST['frm_day_problemend']} {$_POST['frm_hour_problemend']}:{$_POST['frm_minute_problemend']}:00") : "NULL";
$now = mysql_format_date(time() - intval(get_variable('delta_mins') * 60));
// 6/20/10
if (empty($post_frm_owner)) {
$post_frm_owner = 0;
}
// $inc_num_ary = unserialize (get_variable('_inc_num')); // 11/13/10
$temp = get_variable('_inc_num');
// 3/2/11
$inc_num_ary = strpos($temp, "{") > 0 ? unserialize($temp) : unserialize(base64_decode($temp));
$name_rev = $_POST['frm_scope'];
if ($inc_num_ary[0] == 0) {
// no auto numbering scheme
switch (get_variable('serial_no_ap')) {
// incident name revise -1/22/09
case 0:
/* no serial no. */
$name_rev = $_POST['frm_scope'];
break;
case 1:
/* prepend */
$name_rev = $id . "/" . $_POST['frm_scope'];
break;
case 2:
/* append */
$name_rev = $_POST['frm_scope'] . "/" . $id;
break;
default:
/* error???? */
$name_rev = " error error error ";
}
// end switch
// 8/23/08, 9/20/08, 8/13/09
}
// end if()
$facility_id = empty($_POST['frm_facility_id']) ? 0 : trim($_POST['frm_facility_id']);
// 9/28/09
$rec_facility_id = empty($_POST['frm_rec_facility_id']) ? 0 : trim($_POST['frm_rec_facility_id']);
// 9/28/09
$groups = "," . implode(',', $_POST['frm_group']) . ",";
// 6/10/11
if ($facility_id > 0) {
// 9/22/09
$query_g = "SELECT * FROM {$GLOBALS['mysql_prefix']}facilities WHERE `id`= {$facility_id} LIMIT 1";
$result_g = mysql_query($query_g) or do_error($query_g, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
$row_g = stripslashes_deep(mysql_fetch_array($result_g));
$the_lat = $row_g['lat'];
//.........这里部分代码省略.........
示例2: ereg_replace
{
return ereg_replace("[^0-9]", "", $in_str);
}
//$cid_str = (empty($_GET))? "0000000000": $_GET['phone']; // bad
$cid_str = empty($_GET) ? "2125867000" : $_GET['phone'];
// Hilton
//$cid_str = (empty($_GET))? "4102242850": $_GET['phone']; // Giant pharmacy
//$cid_str = (empty($_GET))? "4103533986": $_GET['phone']; // cell
//$cid_str = (empty($_GET))? "4108498240": $_GET['phone'];
//$cid_str = (empty($_GET))? "4108498721": $_GET['phone'];
$lookup_str = cid_lookup(extr_digits($cid_str));
// given a phone no., returns data string
$query = "INSERT INTO `{$GLOBALS['mysql_prefix']}caller_id` (`call_str`, `lookup_vals`, `status`) \n\tVALUES ( " . quote_smart(trim($cid_str)) . ", " . quote_smart(addslashes(trim($lookup_str))) . ", 0);";
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
$retval = explode(";", $lookup_str);
$received = format_date_time(mysql_format_date(now()));
$sources = array("NA", "prior incidents", "Constituents data", "White pages");
$extra = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$url = "http://{$_SERVER['HTTP_HOST']}:{$_SERVER['SERVER_PORT']}{$extra}/";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<HEAD><TITLE>Tickets - Caller ID Module</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<META HTTP-EQUIV="Expires" CONTENT="0">
<META HTTP-EQUIV="Cache-Control" CONTENT="NO-CACHE">
<META HTTP-EQUIV="Pragma" CONTENT="NO-CACHE">
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
<META HTTP-EQUIV="Script-date" CONTENT="<?php
print date("n/j/y G:i", filemtime(basename(__FILE__)));
示例3: list_users
function list_users()
{
/* list users */
global $colors;
// 9/3/10
// $result = mysql_query("SELECT * FROM `$GLOBALS[mysql_prefix]user`") or do_error('list_users()::mysql_query()', 'mysql query failed', mysql_error(), __FILE__, __LINE__);
$query = "SELECT *,\n\t\t`u`.`id` AS `userid`,\n\t\t`r`.`name` AS `unitname`,\n\t\t`r`.`id` AS `unitid`\n\t\tFROM `{$GLOBALS['mysql_prefix']}user` `u`\n\t\tLEFT JOIN `{$GLOBALS['mysql_prefix']}responder`\t `r` ON (`u`.`responder_id` = `r`.`id`)\n\t\tWHERE `passwd` <> '55606758fdb765ed015f0612112a6ca7'\t\n\t\tORDER BY `u`.`user` ASC ";
// 5/25/09, 1/16/08
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
if (mysql_affected_rows() == 0) {
print '<B>[no users found]</B><BR />';
return;
}
// if (!check_for_rows("SELECT id FROM `$GLOBALS[mysql_prefix]user`")==0) { print '<B>[no users found]</B><BR />'; return; }
$now = mysql_format_date(time() - get_variable('delta_mins') * 60);
// 1/23/10
print "<TABLE BORDER='0' CELLPADDING=2>";
$caption = has_admin() ? " - click to edit" : "";
//
print "<TR CLASS='even'><TD COLSPAN='99' ALIGN='center'><B>Users" . $caption . " </B></TD></TR>";
print "<TR CLASS='odd'><TD><B>ID</B></TD>\n\t\t<TD><B> User</B></TD>\n\t\t<TD><B> Online</B></TD>\n\t\t<TD><B> Level</B></TD>\n\t\t<TD><B> Unit</B></TD>\n\t\t<TD><B> Call</B></TD>\n\t\t<TD><B> Description</B></TD>\n\t\t<TD><B> Log in</B></TD>\n\t\t<TD><B> From</B></TD>\n\t\t<TD><B> Browser</B></TD>\n\t\t</TR>";
$i = 1;
while ($row = stripslashes_deep(mysql_fetch_array($result))) {
// 10/8/08
$onclick = has_admin() ? " onClick = \"self.location.href = 'config.php?func=user&id={$row['userid']}' \"" : "";
$level = get_level_text($row['level']);
$login = format_date_time($row['login']);
$online = $row['expires'] > $now ? "<IMG SRC = './markers/checked.png' BORDER=0>" : "";
print "<TR CLASS='{$colors[$i % 2]}' {$onclick}>\n\t\t\t\t<TD>{$row['userid']}</TD>\n\t\t\t\t<TD> {$row['user']}</TD>\n\t\t\t\t<TD ALIGN = 'center'>{$online}</TD>\n\t\t\t\t<TD>{$level}</TD>\n\t\t\t\t<TD>{$row['unitname']}</TD> \n\t\t\t\t<TD>{$row['callsign']}</TD>\n\t\t\t\t<TD>{$row['info']}</TD>\n\t\t\t\t<TD>{$login}</TD>\n\t\t\t\t<TD>{$row['_from']}</TD>\n\t\t\t\t<TD>{$row['browser']}</TD>\n\t\t\t\t</TR>\n";
$i++;
}
print '</TABLE><BR />';
}
示例4: get_butts
<TR>
<TD ROWSPAN=2 ID = 'left col'>
<TABLE BORDER=0><TR><TD>
<?php
get_butts($ticket_id, $unit_id);
?>
</TD></TR></TABLE>
</TD>
<TD ID = 'ctr top' ALIGN='center'>
<TABLE BORDER=0 >
<TR><TD ALIGN='center'><input id="b1" type="button" value="Hide Menu" onclick="showhideFrame(this)"></TD></TR>
<TR CLASS='spacer'><TD class='spacer'> </TD></TR>
<TR><TD ALIGN='left'> <!-- 3/15/11 -->
<?php
$id_array = array();
$time_now = mysql_format_date(now());
// collect ticket id's into $id_array
$query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}action` WHERE `updated` > ('{$time_now}' - INTERVAL 5 MINUTE);";
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
while ($in_row = stripslashes_deep(mysql_fetch_assoc($result))) {
//
array_push($id_array, $in_row['ticket_id']);
}
$query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}patient` WHERE `updated` > ('{$time_now}' - INTERVAL 5 MINUTE);";
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
while ($in_row = stripslashes_deep(mysql_fetch_assoc($result))) {
//
array_push($id_array, $in_row['ticket_id']);
}
$colors = array("even", "odd");
echo "<TABLE BORDER=0 CLASS='calls'>\n";
示例5: list_tickets
//.........这里部分代码省略.........
side_bar_html_hdr +="<br /><br /></TD></TR>\n";
side_bar_html_hdr += "<TR class='odd'><TD align='left' width='5%'><B>ID</B></TD><TD align='left' width='15%'><B><?php
print $incident;
?>
</B></TD><TD align='left' width='15%'><B>Address</B></TD><TD align='left' width='15%'><B><?php
print $nature;
?>
</B></TD><TD align='left' width='15%'><B>Comments</B></TD><TD align='left' width='15%'><B>Description</B></TD><TD align='left' width='2%'><B>P</B></TD><TD align='left' width='2%'><B>A</B></TD><TD align='left' width='2%'><B>U</B></TD><TD align='center' width='14%'><B>As of</B></TD></TR>";
side_bar_html_hdr += "</TABLE>";
var rowIds = []; // 3/8/10
var which;
var i = 0; // sidebar/icon index
var side_bar_html = "<TABLE border=0 CLASS='sidebar' WIDTH = <?php
print max(320, intval($_SESSION['scr_width'] * 0.38));
?>
>\n";
<?php
$order_by = !empty($get_sortby) ? $get_sortby : $_SESSION['sortorder'];
// use default sort order?
//fix limits according to setting "ticket_per_page"
$limit = "";
if ($_SESSION['ticket_per_page'] && check_for_rows("SELECT id FROM `{$GLOBALS['mysql_prefix']}ticket`") > $_SESSION['ticket_per_page']) {
if ($_GET['offset']) {
$limit = "LIMIT {$_GET['offset']},{$_SESSION['ticket_per_page']}";
} else {
$limit = "LIMIT 0,{$_SESSION['ticket_per_page']}";
}
}
$restrict_ticket = "";
// $restrict_ticket = (get_variable('restrict_user_tickets') && !(is_administrator()))? " AND owner=$_SESSION[user_id]" : "";
$time_back = mysql_format_date(time() - get_variable('delta_mins') * 60 - $cwi * 3600);
if (isset($_SESSION['viewed_groups'])) {
// 5/4/11
$curr_viewed = explode(",", $_SESSION['viewed_groups']);
}
if (!isset($curr_viewed)) {
// 5/4/11
$x = 0;
$where2 = "AND (";
foreach ($al_groups as $grp) {
$where3 = count($al_groups) > $x + 1 ? " OR " : ")";
$where2 .= "`{$GLOBALS['mysql_prefix']}allocates`.`group` = '{$grp}'";
$where2 .= $where3;
$x++;
}
} else {
$x = 0;
$where2 = "AND (";
foreach ($curr_viewed as $grp) {
$where3 = count($curr_viewed) > $x + 1 ? " OR " : ")";
$where2 .= "`{$GLOBALS['mysql_prefix']}allocates`.`group` = '{$grp}'";
$where2 .= $where3;
$x++;
}
}
switch ($func) {
case 0:
$where = "WHERE (`{$GLOBALS['mysql_prefix']}ticket`.`status`='{$GLOBALS['STATUS_OPEN']}' OR (`{$GLOBALS['mysql_prefix']}ticket`.`status`='{$GLOBALS['STATUS_SCHEDULED']}' AND `{$GLOBALS['mysql_prefix']}ticket`.`booked_date` <= (NOW() + INTERVAL 2 DAY)) OR \n\t\t\t\t(`{$GLOBALS['mysql_prefix']}ticket`.`status`='{$GLOBALS['STATUS_CLOSED']}' AND `{$GLOBALS['mysql_prefix']}ticket`.`problemend` >= '{$time_back}')){$where2}";
// 11/29/10, 4/18/11, 4/18/11
break;
case 1:
case 2:
case 3:
示例6: do_my_instam
function do_my_instam($key)
{
// 3/17/09
// http://www.instamapper.com/api?action=getPositions&key=4899336036773934943
// $query = "SELECT * FROM `$GLOBALS[mysql_prefix]responder` WHERE `mobile` = 1 AND `instam`= 1 AND `callsign` <> ''"; // work each call/license
// $result = mysql_query($query) or do_error($query, 'mysql_query() failed', mysql_error(),basename( __FILE__), __LINE__);
// while ($row = @mysql_fetch_assoc($result)) { // for each responder/account
$data = "";
// $key_val = $row['callsign'];
$url = "http://www.instamapper.com/api?action=getPositions&key={$key}";
if (function_exists("curl_init")) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
print __LINE__;
} else {
// not CURL
print __LINE__;
if ($fp = @fopen($url, "r")) {
while (!feof($fp) && strlen($data) < 9000) {
$data .= fgets($fp, 128);
}
fclose($fp);
} else {
print "-error 1";
// @fopen fails
}
}
dump($data);
/*
$the_time = (gmdate("U") - date("Z") - (get_variable('delta_mins')*60));
$the_format = get_variable('date_format');
print "date('Z') = " . date("Z"). "<br />\n";
print "time1=" . date($the_format, time()). "<br />\n";
print "time2=" . date($the_format, time() - date("Z")). "<br />\n";
print "time3=" . date($the_format, $the_time). "<br />\n";
print "time4=" . date($the_format, $the_time). "<br />\n";
print "now=" . mysql_format_date($the_time) . "<br />\n";
InstaMapper API v1.00
1263013328977,bold,1236239763,34.07413,-118.34940,25.0,0.0,335
1088203381874,CABOLD,1236255869,34.07701,-118.35262,27.0,0.4,72
*/
// if (((strpos ($data, "Invalid")>0)) || ((strpos ($data, "Missing")>0))) {
// print "-error 0"; // wp return bad
// }
// else {} // wp return good
$ary_data = explode("\n", $data);
dump($ary_data);
if (count($ary_data) > 1) {
for ($i = 0; $i < count($ary_data); $i++) {
$str_pos = explode(",", $ary_data[$i]);
if (count($str_pos) == 8) {
/*
1. Device key
2. Device label
3. Position timestamp in UTC (number of seconds since January 1, 1970)
4. Latitude
5. Longitude
6. Altitude in meters
7. Speed in meters / second
8. Heading in degrees
*/
/*
$the_time = date("U", gmdate("U")) + date("Z");
$now = mysql_format_date(time() - (get_variable('delta_mins')*60));
*/
$the_time = $str_pos[2] - date("Z") - get_variable('delta_mins') * 60;
$the_format = get_variable('date_format');
print "date('Z') = " . date("Z") . "<br />\n";
print "time1=" . date($the_format, $str_pos[2]) . "<br />\n";
print "time2=" . date($the_format, $str_pos[2] + date("Z")) . "<br />\n";
print "time3=" . date($the_format, $the_time) . "<br />\n";
print "time4=" . date($the_format, $the_time) . "<br />\n";
print "now=" . mysql_format_date($the_time) . "<br />\n";
// --------------------------------------------------------------------
/*
// $query = sprintf("INSERT INTO `$GLOBALS[mysql_prefix]_snap_data` (`source`,`stuff`)
// VALUES(%s,%s)",
// quote_smart_deep(trim($source)),
// quote_smart_deep(trim($stuff)));
*/
//---------------------------------------------------------------------
$query = sprintf("INSERT INTO `{$GLOBALS['mysql_prefix']}tracks_hh` (`source`,`latitude`,`longitude`,`course`,`speed`,`altitude`,`updated`,`from`)\n\t\t\t\t\t\t\tVALUES (%s,%s,%s,%s,%s,%s,%s,%s)", quote_smart($str_pos[1]), quote_smart($str_pos[3]), quote_smart($str_pos[4]), quote_smart($str_pos[7]), quote_smart($str_pos[6]), quote_smart($str_pos[5]), quote_smart(mysql_format_date($str_pos[2])), quote_smart($str_pos[6]));
// dump($query);
$result = mysql_query($query) or do_error($query, 'mysql_query() failed', mysql_error(), basename(__FILE__), __LINE__);
/*
INSERT INTO `tracks_hh` (`source`,`latitude`,`longitude`,`course`,`speed`,`altitude`,`updated`,`from`),
VALUES ('AFbold',34.07655,-118.35032,304,0.1,52.0,'2009-03-19 07:51:10',0.1)
*/
//---------------------------------------------------------------------------------
// print "dvcid=" . $str_pos[0] . "<br />\n";
// print "dvkey=" . $str_pos[1] . "<br />\n";
// print "time=" . date($the_format, $the_time). "<br />\n";
// print "lat=" . $str_pos[3]. "<br />\n";
// print "lng=" .$str_pos[4]. "<br />\n";
// print "Alt=" .$str_pos[5]. "<br />\n";
//.........这里部分代码省略.........
示例7: set_u_updated
function set_u_updated($in_assign)
{
// given a disaptch record id, updates unit data - 9/1/10
$query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}assigns` WHERE `id` = {$in_assign} LIMIT 1";
$result = mysql_query($query) or do_error($query, "", mysql_error(), basename(__FILE__), __LINE__);
$row_temp = mysql_fetch_assoc($result);
//
$now = quote_smart(mysql_format_date(time() - intval(get_variable('delta_mins')) * 60));
// 9/1/10
$user = quote_smart(trim($_SESSION['user_id']));
$query = "UPDATE `{$GLOBALS['mysql_prefix']}responder` SET\n\t\t`updated`= \t\t\t{$now},\n\t\t`_on`= \t\t\t\t{$now},\n\t\t`user_id`= \t\t{$user},\n\t\t`_by`= \t\t\t{$user},\n\t\t`_from`= " . quote_smart(trim($_SERVER['REMOTE_ADDR'])) . "\n\t\tWHERE `id`=\t\t\t{$row_temp['responder_id']}";
$result = mysql_query($query) or do_error($query, 'mysql_query() failed', mysql_error(), basename(__FILE__), __LINE__);
unset($result);
return TRUE;
}
示例8: mysql_query
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
}
}
}
$caption = "<i>" . stripslashes_deep($_POST['frm_name']) . "</i><B>' data has been updated.</B><BR /><BR />";
}
}
// end else {}
if ($_getgoadd == 'true') {
$by = $_SESSION['user_id'];
// 4/14/11
$frm_lat = empty($_POST['frm_lat']) ? 'NULL' : quote_smart(trim($_POST['frm_lat']));
// 7/22/10
$frm_lng = empty($_POST['frm_lng']) ? 'NULL' : quote_smart(trim($_POST['frm_lng']));
// 7/15/10
$now = mysql_format_date(time() - get_variable('delta_mins') * 60);
$query = "INSERT INTO `{$GLOBALS['mysql_prefix']}facilities` (\n\t\t\t`name`, `street`, `city`, `state`, `handle`, `icon_str`, `boundary`, `description`, `capab`, `status_id`, `contact_name`, `contact_email`, `contact_phone`, `security_contact`, `security_email`, `security_phone`, `opening_hours`, `access_rules`, `security_reqs`, `pager_p`, `pager_s`, `lat`, `lng`, `type`, `user_id`, `updated` )\n\t\t\tVALUES (" . quote_smart(trim($_POST['frm_name'])) . "," . quote_smart(trim($_POST['frm_street'])) . "," . quote_smart(trim($_POST['frm_city'])) . "," . quote_smart(trim($_POST['frm_state'])) . "," . quote_smart(trim($_POST['frm_handle'])) . "," . quote_smart(trim($_POST['frm_icon_str'])) . "," . quote_smart(trim($_POST['frm_boundary'])) . "," . quote_smart(trim($_POST['frm_descr'])) . "," . quote_smart(trim($_POST['frm_capab'])) . "," . quote_smart(trim($_POST['frm_status_id'])) . "," . quote_smart(trim($_POST['frm_contact_name'])) . "," . quote_smart(trim($_POST['frm_contact_email'])) . "," . quote_smart(trim($_POST['frm_contact_phone'])) . "," . quote_smart(trim($_POST['frm_security_contact'])) . "," . quote_smart(trim($_POST['frm_security_email'])) . "," . quote_smart(trim($_POST['frm_security_phone'])) . "," . quote_smart(trim($_POST['frm_opening_hours'])) . "," . quote_smart(trim($_POST['frm_access_rules'])) . "," . quote_smart(trim($_POST['frm_security_reqs'])) . "," . quote_smart(trim($_POST['frm_pager_p'])) . "," . quote_smart(trim($_POST['frm_pager_s'])) . "," . $frm_lat . "," . $frm_lng . "," . quote_smart(trim($_POST['frm_type'])) . "," . quote_smart(trim($_SESSION['user_id'])) . "," . quote_smart(trim($now)) . ");";
$result = mysql_query($query) or do_error($query, 'mysql_query() failed', mysql_error(), __FILE__, __LINE__);
$new_id = mysql_insert_id();
$status_id = $_POST['frm_status_id'];
//4/14/11
foreach ($_POST['frm_group'] as $grp_val) {
// 6/10/11
if (test_allocates($new_id, $grp_val, 3)) {
$query_a = "INSERT INTO `{$GLOBALS['mysql_prefix']}allocates` (`group` , `type`, `al_as_of` , `al_status` , `resource_id` , `sys_comments` , `user_id`) VALUES \n\t\t\t\t\t({$grp_val}, 3, '{$now}', {$status_id}, {$new_id}, 'Allocated to Group' , {$by})";
$result_a = mysql_query($query_a) or do_error($query_a, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
}
}
do_log($GLOBALS['LOG_FACILITY_ADD'], 0, mysql_insert_id(), $_POST['frm_status_id']);
// 2/17/11
$caption = "<B>Facility <i>" . stripslashes_deep($_POST['frm_name']) . "</i> data has been updated.</B><BR /><BR />";
示例9: do_my_instam
function do_my_instam($key_val)
{
// 3/17/09
// http://www.instamapper.com/api?action=getPositions&key=4899336036773934943
// $from_utc = ($row_tr)? "&from_ts=" . $row_tr['utc_stamp']: ""; // 3/26/09
$from_utc = "";
// reconsider for tracking
$url = "http://www.instamapper.com/api?action=getPositions&key={$key_val}{$from_utc}";
$data = "";
if (function_exists("curl_init")) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
} else {
// not CURL
if ($fp = @fopen($url, "r")) {
while (!feof($fp) && strlen($data) < 9000) {
$data .= fgets($fp, 128);
}
fclose($fp);
} else {
print "";
// @fopen fails
}
}
/*
InstaMapper API v1.00
0142649733246,Robert Wing,1290605747,51.12893,-2.73858,0.0,0.0,0
3111130478040,Chris Perks,1290623627,51.23314,-2.99970,13.5,0.0,90
*/
$ary_data = explode("\n", $data);
if (count($ary_data) > 1) {
// any data?
for ($i = 1; $i < count($ary_data) - 1; $i++) {
// 11/25/10
$the_position = explode(",", $ary_data[$i]);
if (count($the_position) == 8) {
//
list($device, $user, $when, $lat, $lng, $course, $speed, $altitude) = $the_position;
// 0 1 2 3 4 5 6 7
$updated = mysql_format_date($when);
$query = "UPDATE `{$GLOBALS['mysql_prefix']}responder` SET \n\t\t\t\t\t`lat`= '{$lat}' ,\n\t\t\t\t\t`lng`= '{$lng}',\n\t\t\t\t\t`updated` = '{$updated}',\n\t\t\t\t\t`user_id` = 0\n\t\t\t\t\tWHERE (`instam` = 1 \n\t\t\t\t\tAND (`lat` != '{$lat}' OR `lng` != '{$lng}' ) \n\t\t\t\t\tAND `callsign` = '{$device}')";
// 7/25/09
$result = mysql_query($query) or do_error($query, 'mysql_query() failed', mysql_error(), basename(__FILE__), __LINE__);
if (mysql_affected_rows() > 0) {
// if any movement
// snap(__LINE__, mysql_affected_rows($result));
$query = "DELETE FROM `{$GLOBALS['mysql_prefix']}tracks_hh` WHERE `source`= " . quote_smart(trim($user));
// remove prior track this device 3/20/09
$result = mysql_query($query);
// 7/28/10
//
$query = sprintf("INSERT INTO `{$GLOBALS['mysql_prefix']}tracks_hh`(`source`,`utc_stamp`,`latitude`,`longitude`,`course`,`speed`,`altitude`,`updated`,`from`)\n\t\t\t\t\t\t\t\t\t\tVALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s)", quote_smart($user), quote_smart($when), quote_smart($lat), quote_smart($lng), quote_smart($altitude), round($speed), quote_smart($course), quote_smart(mysql_format_date($when)), quote_smart($speed));
$result = mysql_query($query) or do_error($query, 'mysql_query() failed', mysql_error(), basename(__FILE__), __LINE__);
unset($result);
}
// end if (mysql_affected_rows>0)
}
// end if (count())
}
// end for ()
}
// end if (count())
}
示例10: error_reporting
<?php
/*
3/15/11 Created from as_up_un_status.php to allow change of facility status through situation screen
*/
error_reporting(E_ALL);
// file as_up_fac_status.php
@session_start();
require_once $_SESSION['fip'];
//snap(basename(__FILE__), __LINE__);
extract($_GET);
$now = time() - get_variable('delta_mins') * 60;
@session_start();
$query = "UPDATE `{$GLOBALS['mysql_prefix']}facilities` SET `status_id`= ";
$query .= quote_smart($frm_status_id);
$query .= ", `updated` = " . quote_smart(mysql_format_date($now));
$query .= ", `user_id` = " . $_SESSION['user_id'];
$query .= " WHERE `id` = ";
$query .= quote_smart($frm_responder_id);
$query .= " LIMIT 1";
$result = mysql_query($query) or do_error($query, "", mysql_error(), basename(__FILE__), __LINE__);
// dump ($query);
do_log($GLOBALS['LOG_FACILITY_STATUS'], $frm_ticket_id, $frm_responder_id, $frm_status_id);
set_sess_exp();
// update session time
print date("H:i", $now);
//date("H:i", $row['as_of'])
示例11: sprintf
<?php
// include shared code
include '../lib/common.php';
include '../lib/db.php';
include '../lib/functions.php';
// this should not be available unless the user has logged in
include '401.php';
// insert a new blog entry
if ($_POST['post_id'] == 'new') {
$query = sprintf('INSERT INTO %sBLOG_POST SET POST_TITLE = "%s", ' . 'POST_DATE = "%s", POST_TEXT = "%s"', DB_TBL_PREFIX, mysql_real_escape_string($_POST['post_title'], $GLOBALS['DB']), mysql_format_date($_POST['post_date']), mysql_real_escape_string($_POST['post_text'], $GLOBALS['DB']));
mysql_query($query, $GLOBALS['DB']);
} else {
// delete entry
if (isset($_POST['delete'])) {
$query = sprintf('DELETE FROM %sBLOG_POST WHERE POST_ID = %d', DB_TBL_PREFIX, $_POST['post_id']);
mysql_query($query, $GLOBALS['DB']);
} else {
$query = sprintf('UPDATE %sBLOG_POST SET POST_TITLE = "%s", ' . 'POST_DATE = "%s", POST_TEXT = "%s" WHERE POST_ID = %d', DB_TBL_PREFIX, mysql_real_escape_string($_POST['post_title'], $GLOBALS['DB']), mysql_format_date($_POST['post_date']), mysql_real_escape_string($_POST['post_text'], $GLOBALS['DB']), $_POST['post_id']);
mysql_query($query, $GLOBALS['DB']);
}
}
mysql_close($GLOBALS['DB']);
header('Location: admin.php');
示例12: full_scr
//.........这里部分代码省略.........
}
?>
map.enableScrollWheelZoom();
do_landb(); // 7/3/11 - show lines
var baseIcon = new GIcon();
baseIcon.shadow = "./markers/sm_shadow.png"; // ./markers/sm_shadow.png
baseIcon.iconSize = new GSize(20, 34);
baseIcon.shadowSize = new GSize(37, 34);
baseIcon.iconAnchor = new GPoint(9, 34);
baseIcon.infoWindowAnchor = new GPoint(9, 2);
baseIcon.infoShadowAnchor = new GPoint(18, 25);
GEvent.addListener(map, "infowindowclose", function() { // re-center after move/zoom
map.setCenter(center,zoom);
map.addOverlay(gmarkers[which])
});
<?php
$order_by = !empty($get_sortby) ? $get_sortby : $_SESSION['sortorder'];
// use default sort order?
//fix limits according to setting "ticket_per_page"
$limit = "";
if ($_SESSION['ticket_per_page'] && check_for_rows("SELECT id FROM `{$GLOBALS['mysql_prefix']}ticket`") > $_SESSION['ticket_per_page']) {
if ($_GET['offset']) {
$limit = "LIMIT {$_GET['offset']},{$_SESSION['ticket_per_page']}";
} else {
$limit = "LIMIT 0,{$_SESSION['ticket_per_page']}";
}
}
$restrict_ticket = get_variable('restrict_user_tickets') == 1 && !is_administrator() ? " AND owner={$_SESSION['user_id']}" : "";
$time_back = mysql_format_date(time() - get_variable('delta_mins') * 60 - $cwi * 3600);
if (!isset($_POST['frm_group'])) {
$x = 0;
$where2 = "AND (";
foreach ($al_groups as $grp) {
$where3 = count($al_groups) > $x + 1 ? " OR " : ")";
$where2 .= "`{$GLOBALS['mysql_prefix']}allocates`.`group` = '{$grp}'";
$where2 .= $where3;
$x++;
}
} else {
$x = 0;
$where2 = "AND (";
foreach ($_POST['frm_group'] as $grp) {
$where3 = count($_POST['frm_group']) > $x + 1 ? " OR " : ")";
$where2 .= "`{$GLOBALS['mysql_prefix']}allocates`.`group` = '{$grp}'";
$where2 .= $where3;
$x++;
}
}
switch ($func) {
//9/29/09 Added capability for Special Incidents 10/27/09 changed to bring scheduled incidents to front when due.
case 0:
$where = "WHERE (`status`='{$GLOBALS['STATUS_OPEN']}' OR (`status`='{$GLOBALS['STATUS_SCHEDULED']}' AND `booked_date` <= (NOW() + INTERVAL 2 DAY)) OR \n\t\t\t\t\t(`status`='{$GLOBALS['STATUS_CLOSED']}' AND `problemend` >= '{$time_back}')){$where2}";
// 11/29/10, 6/10/11, 6/10/11
break;
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
示例13: do_login
function do_login($requested_page, $outinfo = FALSE, $hh = FALSE)
{
// do login/ses sion code - returns array - 2/12/09, 3/8/09
global $hide_dispatched, $hide_status_groups;
@session_start();
global $expiry, $istest;
$now = mysql_format_date(time() - intval(get_variable('delta_mins')) * 60);
$the_sid = isset($_SESSION['id']) ? $_SESSION['id'] : null;
// 7/3/11
$warn = array_key_exists('expires', $_SESSION) && $now > $_SESSION['expires'] ? "Log-in has expired due to inactivity. Please log in again." : "";
$internet = get_variable("internet");
// 8/22/10
$temp = implode(";", $_SESSION);
if (array_key_exists('user_id', $_SESSION) && is_expired($_SESSION['user_id'])) {
$the_date = mysql_format_date($expiry);
$sess_key = session_id();
// not expired
$query = "UPDATE `{$GLOBALS['mysql_prefix']}user` SET `expires`= '{$the_date}' WHERE `sid` = '{$sess_key}' LIMIT 1";
$result = mysql_query($query) or do_error("", 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
$_SESSION['expires'] = $expiry;
$warn = "";
if ($internet == 3) {
set_filenames($internet);
}
// possible change to filenames based on connect status - 8/31/10
} else {
// not logged in; now either get form data or db check form entries
if (array_key_exists('frm_passwd', $_POST)) {
// first, db check
// 6/25/10
$categories = array();
// 3/15/11
$query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}assigns` WHERE `clear` <> 'NULL'";
// 3/15/11
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
$num_disp = mysql_num_rows($result);
//
if ($num_disp > 0 && $hide_dispatched == 1) {
$category_butts[0] = "Deployed";
$i = 1;
} else {
$i = 0;
}
if ($hide_status_groups == 1) {
// 3/15/11
$query = "SELECT DISTINCT `group` FROM `{$GLOBALS['mysql_prefix']}un_status` ORDER BY `group` ASC";
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
$categories[$i] = $row['group'];
$i++;
}
unset($result);
} else {
$categories[$i] = "Available";
$i++;
$categories[$i] = "Not Available";
}
$fac_categories = array();
$i = 0;
$query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}fac_types` ORDER BY `name` ASC";
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
$fac_categories[$i] = $row['name'];
$i++;
}
unset($result);
$query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}user` \n\t\t\t\tWHERE `user`=" . quote_smart($_POST['frm_user']) . " \t \n\t\t\t\tAND (`passwd`=PASSWORD(" . quote_smart($_POST['frm_passwd']) . ") \n\t\t\t\tOR `passwd`=MD5(" . quote_smart(strtolower($_POST['frm_passwd'])) . " )) \n\t\t\t\tLIMIT 1";
$result = mysql_query($query) or do_error("", 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
if (mysql_affected_rows() == 1) {
$row = stripslashes_deep(mysql_fetch_assoc($result));
if ($row['sortorder'] == NULL) {
$row['sortorder'] = "date";
}
$dir = $row['sort_desc'] ? " DESC " : "";
$sid = session_id();
// 1/8/10
$browser = checkBrowser(FALSE);
$the_date = mysql_format_date($expiry);
$query = "UPDATE `{$GLOBALS['mysql_prefix']}user` SET \n\t\t\t\t\t`sid` = '{$sid}', \n\t\t\t\t\t`expires`= '{$the_date}', \n\t\t\t\t\t`login` = '{$now}', \n\t\t\t\t\t`_from`= '{$_SERVER['REMOTE_ADDR']}', \n\t\t\t\t\t`browser` = '{$browser}' \n\t\t\t\t\tWHERE `id` = {$row['id']} LIMIT 1";
$result = mysql_query($query) or do_error("", 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
$_SESSION['id'] = $sid;
$_SESSION['expires'] = time();
$_SESSION['user_id'] = $row['id'];
$_SESSION['user'] = $row['user'];
$_SESSION['level'] = $row['level'];
$_SESSION['login_at'] = $now;
$_SESSION['scr_height'] = $_POST['scr_height'];
$_SESSION['scr_width'] = $_POST['scr_width'];
// monitor dimensions this user
$_SESSION['allow_dirs'] = TRUE;
// allow directions
$_SESSION['show_closed'] = TRUE;
// show closed dispatched
$_SESSION['sortorder'] = $row['sortorder'] == NULL ? "date" : $row['sortorder'];
$_SESSION['sort_desc'] = $row['sort_desc'] == NULL ? " DESC " : $row['sort_desc'];
$_SESSION['ticket_per_page'] = 0;
$_SESSION['show_hide_unit'] = "s";
// show/hide units
$_SESSION['show_hide_unav'] = "s";
// show/hide unavailable units - 4/27/10
//.........这里部分代码省略.........
示例14: mysql_query
print "<FONT CLASS='header'>{$patient} record deleted</FONT><BR /><BR />";
} else {
$query = "SELECT * FROM `{$GLOBALS['mysql_prefix']}patient` WHERE `id`='{$_GET['id']}' LIMIT 1";
$result = mysql_query($query) or do_error($query, $query, mysql_error(), basename(__FILE__), __LINE__);
$row = stripslashes_deep(mysql_fetch_assoc($result));
print "<FONT CLASS='header'>Really delete {$patient} record ' " . shorten($row['description'], 24) . "' ?</FONT><BR /><BR />";
print "<FORM METHOD='post' ACTION='patient_w.php?action=delete&id={$_GET['id']}&ticket_id={$_GET['ticket_id']}&confirm=1'>\n\t\t\t\t<INPUT TYPE='Submit' VALUE='Yes'>";
print "<INPUT TYPE = 'button' VALUE = 'Cancel' onClick = 'window.close();' STYLE = 'margin-left:40px' /></FORM>";
}
} else {
if ($get_action == 'update') {
//update patient record and show ticket
$frm_meridiem_asof = array_key_exists('frm_meridiem_asof', $_POST) ? $_POST[frm_meridiem_asof] : "";
$frm_asof = "{$_POST['frm_year_asof']}-{$_POST['frm_month_asof']}-{$_POST['frm_day_asof']} {$_POST['frm_hour_asof']}:{$_POST['frm_minute_asof']}:00{$frm_meridiem_asof}";
// $query = "UPDATE `$GLOBALS[mysql_prefix]patient` SET `description`='$_POST[frm_description]' , `name`='$_POST[frm_name]', `updated` = '$frm_asof' WHERE id='$_GET[id]' LIMIT 1";
$now = mysql_format_date(now());
if (array_key_exists('frm_fullname', $_POST)) {
// 6/22/11
$ins_data = "\n\t\t\t\t`fullname`\t= " . quote_smart(addslashes(trim($_POST['frm_fullname']))) . ",\n\t\t\t\t`dob`\t= " . quote_smart(addslashes(trim($_POST['frm_dob']))) . ",\n\t\t\t\t`gender`\t= " . quote_smart(addslashes(trim($_POST['frm_gender_val']))) . ",\n\t\t\t\t`insurance_id`\t=" . quote_smart(addslashes(trim($_POST['frm_ins_id']))) . ",\n\t\t\t\t`facility_contact` = " . quote_smart(addslashes(trim($_POST['frm_fac_cont']))) . ",";
} else {
$ins_data = "";
}
$query = "UPDATE `{$GLOBALS['mysql_prefix']}patient` SET \n\t \t{$ins_data}\n\t \t`description`= " . quote_smart(addslashes(trim($_POST['frm_description']))) . ",\n\t \t`ticket_id`= " . quote_smart(addslashes(trim($_GET['ticket_id']))) . ",\n\t \t`date`= " . quote_smart(addslashes(trim($frm_asof))) . ",\n\t \t`user`= " . quote_smart(addslashes(trim($_SESSION['user_id']))) . ",\n\t \t`action_type` = " . quote_smart(addslashes(trim($GLOBALS['ACTION_COMMENT']))) . ",\n\t \t`name` = " . quote_smart(addslashes(trim($_POST['frm_name']))) . ", \n\t \t`updated` = " . quote_smart(addslashes(trim($now))) . "\n\t \tWHERE id= " . quote_smart($_GET['id']) . " LIMIT 1";
$result = mysql_query($query) or do_error($query, 'mysql_query', mysql_error(), basename(__FILE__), __LINE__);
$query = "UPDATE `{$GLOBALS['mysql_prefix']}ticket` SET `updated` = '{$frm_asof}' WHERE id='{$_GET['ticket_id']}'";
$result = mysql_query($query) or do_error($query, 'mysql_query', mysql_error(), basename(__FILE__), __LINE__);
$result = mysql_query("SELECT ticket_id FROM `{$GLOBALS['mysql_prefix']}patient` WHERE id='{$_GET['id']}'") or do_error('patient_w.php::update patient record', 'mysql_query', mysql_error(), basename(__FILE__), __LINE__);
$row = stripslashes_deep(mysql_fetch_assoc($result));
?>
<script>
setTimeout("document.next_Form.submit()",1500);
示例15: edit_ticket
function edit_ticket($id)
{
/* post changes */
global $addrs, $NOTIFY_TICKET;
$post_frm_meridiem_problemstart = empty($_POST) || !empty($_POST) && empty($_POST['frm_meridiem_problemstart']) ? "" : $_POST['frm_meridiem_problemstart'];
$post_frm_meridiem_booked_date = empty($_POST) || !empty($_POST) && empty($_POST['frm_meridiem_booked_date']) ? "" : $_POST['frm_meridiem_booked_date'];
//10/1/09
$post_frm_affected = empty($_POST) || !empty($_POST) && empty($_POST['frm_affected']) ? "" : $_POST['frm_affected'];
$_POST['frm_description'] = strip_html($_POST['frm_description']);
//clean up HTML tags
$post_frm_affected = strip_html($post_frm_affected);
$_POST['frm_scope'] = strip_html($_POST['frm_scope']);
/* if (get_variable('reporting')) { // if any change do automatic action reporting
// if ($_POST[frm_affected] != $_POST[frm_affected_default]) report_action($GLOBALS[ACTION_AFFECTED],$_POST[frm_affected],0,$id);
if ($_POST[frm_severity] != $_POST[frm_severity_default]) report_action($GLOBALS[ACTION_SEVERITY],get_severity($_POST[frm_severity_default]),get_severity($_POST[frm_severity]),$id);
if ($_POST[frm_scope] != $_POST[frm_scope_default]) report_action($GLOBALS[ACTION_SCOPE],$_POST[frm_scope_default],0,$id);
}
*/
if (!get_variable('military_time')) {
//put together date from the dropdown box and textbox values
if ($post_frm_meridiem_problemstart == 'pm') {
$post_frm_meridiem_problemstart = ($post_frm_meridiem_problemstart + 12) % 24;
}
if (isset($_POST['frm_meridiem_booked_date'])) {
//10/1/09
if ($_POST['frm_meridiem_booked_date'] == 'pm') {
$_POST['frm_hour_booked_date'] = ($_POST['frm_hour_booked_date'] + 12) % 24;
}
}
// if ($_POST['frm_meridiem_problemend'] == 'pm') $_POST['frm_hour_problemend'] = ($_POST['frm_hour_problemend'] + 12) % 24;
}
if (empty($post_frm_owner)) {
$post_frm_owner = 0;
}
// $frm_problemstart = $_POST['frm_year_problemstart']-$_POST['frm_month_problemstart']-$_POST['frm_day_problemstart'] $_POST['frm_hour_problemstart']:$_POST['frm_minute_problemstart']:00";
$frm_problemstart = "{$_POST['frm_year_problemstart']}-{$_POST['frm_month_problemstart']}-{$_POST['frm_day_problemstart']} {$_POST['frm_hour_problemstart']}:{$_POST['frm_minute_problemstart']}:00{$post_frm_meridiem_problemstart}";
$curr_groups = $_POST['frm_exist_groups'];
// 6/10/11
$groups = "," . implode(',', $_POST['frm_group']) . ",";
// 6/10/11
// dump($_POST); // 6/10/11
if (!get_variable('military_time')) {
//put together date from the dropdown box and textbox values
if ($post_frm_meridiem_problemstart == 'pm') {
$_POST['frm_hour_problemstart'] = ($_POST['frm_hour_problemstart'] + 12) % 24;
}
if (isset($_POST['frm_meridiem_problemend'])) {
if ($_POST['frm_meridiem_problemend'] == 'pm') {
$_POST['frm_hour_problemend'] = ($_POST['frm_hour_problemend'] + 12) % 24;
}
}
if (isset($_POST['frm_meridiem_booked_date'])) {
//10/1/09
if ($_POST['frm_meridiem_booked_date'] == 'pm') {
$_POST['frm_hour_booked_date'] = ($_POST['frm_hour_booked_date'] + 12) % 24;
}
}
}
$frm_problemend = isset($_POST['frm_year_problemend']) ? quote_smart("{$_POST['frm_year_problemend']}-{$_POST['frm_month_problemend']}-{$_POST['frm_day_problemend']} {$_POST['frm_hour_problemend']}:{$_POST['frm_minute_problemend']}:00") : "NULL";
$frm_booked_date = isset($_POST['frm_year_booked_date']) ? quote_smart("{$_POST['frm_year_booked_date']}-{$_POST['frm_month_booked_date']}-{$_POST['frm_day_booked_date']} {$_POST['frm_hour_booked_date']}:{$_POST['frm_minute_booked_date']}:00") : "NULL";
//10/1/09
if ($_POST['frm_status'] != 1) {
$frm_problemend = "NULL";
}
// perform db update
$now = mysql_format_date(time() - get_variable('delta_mins') * 60);
$by = $_SESSION['user_id'];
// 12/7/10
if (empty($post_frm_owner)) {
$post_frm_owner = 0;
}
// 8/23/08, 9/20/08, 9/22/09 (Facility), 10/1/09 (receiving facility), 6/26/10 (911), 6/10/11
$query = "UPDATE `{$GLOBALS['mysql_prefix']}ticket` SET \n\t\t\t`contact`= " . quote_smart(trim($_POST['frm_contact'])) . ",\n\t\t\t`street`= " . quote_smart(trim($_POST['frm_street'])) . ",\n\t\t\t`city`= " . quote_smart(trim($_POST['frm_city'])) . ",\n\t\t\t`state`= " . quote_smart(trim($_POST['frm_state'])) . ",\n\t\t\t`phone`= " . quote_smart(trim($_POST['frm_phone'])) . ",\n\t\t\t`facility`= " . quote_smart(trim($_POST['frm_facility_id'])) . ",\n\t\t\t`rec_facility`= " . quote_smart(trim($_POST['frm_rec_facility_id'])) . ",\n\t\t\t`lat`= " . quote_smart(trim($_POST['frm_lat'])) . ",\n\t\t\t`lng`= " . quote_smart(trim($_POST['frm_lng'])) . ",\n\t\t\t`scope`= " . quote_smart(trim($_POST['frm_scope'])) . ",\n\t\t\t`owner`= " . quote_smart(trim($post_frm_owner)) . ",\n\t\t\t`severity`= " . quote_smart(trim($_POST['frm_severity'])) . ",\n\t\t\t`in_types_id`= " . quote_smart(trim($_POST['frm_in_types_id'])) . ",\n\t\t\t`status`=" . quote_smart(trim($_POST['frm_status'])) . ",\n\t\t\t`problemstart`=" . quote_smart(trim($frm_problemstart)) . ",\n\t\t\t`problemend`=" . $frm_problemend . ",\n\t\t\t`description`= " . quote_smart(trim($_POST['frm_description'])) . ",\n\t\t\t`comments`= " . quote_smart(trim($_POST['frm_comments'])) . ",\n\t\t\t`nine_one_one`= " . quote_smart(trim($_POST['frm_nine_one_one'])) . ",\n\t\t\t`booked_date`= \t\t{$frm_booked_date},\n\t\t\t`_by` = \t\t\t{$by}, \n\t\t\t`updated`='{$now}'\n\t\t\tWHERE ID='{$id}'";
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), __FILE__, __LINE__);
$list = $_POST['frm_exist_groups'];
// 6/10/11
$ex_grps = explode(',', $list);
// 6/10/11
if ($curr_groups != $groups) {
// 6/10/11
foreach ($_POST['frm_group'] as $posted_grp) {
// 6/10/11
if (!in_array($posted_grp, $ex_grps)) {
$tick_stat = $_POST['frm_status'];
$query = "INSERT INTO `{$GLOBALS['mysql_prefix']}allocates` (`group` , `type`, `al_as_of` , `al_status` , `resource_id` , `sys_comments` , `user_id`) VALUES \n\t\t\t\t\t\t\t({$posted_grp}, 1, '{$now}', {$tick_stat}, {$id}, 'Allocated to Group' , {$by})";
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
}
}
foreach ($ex_grps as $existing_grp) {
// 6/10/11
print $existing_grp;
if (in_array($existing_grp, get_allocates(4, $id))) {
if (!in_array($existing_grp, $_POST['frm_group'])) {
$query = "DELETE FROM `{$GLOBALS['mysql_prefix']}allocates` WHERE `type` = 1 AND `group` = '{$existing_grp}' AND `resource_id` = {$id}";
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
}
}
}
}
//.........这里部分代码省略.........