forked from khoegenauer/tickets-cad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
do_cid.php
50 lines (43 loc) · 2.09 KB
/
do_cid.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
<?php
/**
* @package do_cid.php
* @author John Doe <[email protected]>
* @since 2010-11-05
* @version 2010-11-05
*/
/*
11/5/10 initial release
*/
error_reporting(E_ALL);
require_once './incs/functions.inc.php';
$the_number = "1234567890";
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]constituents` WHERE `phone`= '{$phone}'
OR `phone_2`= '{$phone}' OR `phone_3`= '{$phone}' OR `phone_4`= '{$phone}' ORDER BY `updated` ASC";
$result = mysql_query($query) or do_error("", 'mysql query failed', mysql_error(), basename( __FILE__), __LINE__);
$street = $apartment = $city = $st = "";
while ($row = stripslashes_deep(mysql_fetch_array($result))) { // use most recent data
if (!(empty(trim($row['street'])))) {$street = trim($row['city']);} // 11/5/10
if (!(empty(trim($row['apartment'])))) {$apartment = trim($row['apartment']);}
if (!(empty(trim($row['city'])))) {$city = trim($row['city']);}
if (!(empty(trim($row['state'])))) {$st = trim($row['state']);}
}
if (empty($city)) {$city = get_variable('def_city');}
if (empty($st)) {$st = get_variable('def_st');}
$street = quote_smart($street);
$apartment = quote_smart($apartment);
$city = quote_smart($city);
$st = quote_smart($st);
$query = "DELETE FROM `$GLOBALS[mysql_prefix]ticket` WHERE `status` = {$GLOBALS['STATUS_RESERVED']} AND `_by` = {tbd};"; //8/10/10
$result = mysql_query($query);
$query_insert = "INSERT INTO `$GLOBALS[mysql_prefix]ticket` (
`id` , `in_types_id` , `contact` , `street` , `city` , `state` , `phone` , `lat` , `lng` , `date` ,
`problemstart` , `problemend` , `scope` , `affected` , `description` , `comments` , `status` , `owner` ,
`severity` , `updated`, `booked_date`, `_by`
) VALUES (
NULL , 0, 0, NULL , '{$street} {$apartment}', {$st} , {$the_number} , NULL , NULL , NULL ,
NULL , NULL , '', NULL , '', NULL , '{$GLOBALS['STATUS_RESERVED']}', '0', '0', NULL, NULL, $by
)";
$result_insert = mysql_query($query_insert) or do_error($query_insert,'mysql_query() failed', mysql_error(), basename( __FILE__), __LINE__);
@session_start();
if (!(empty($_SESSION))) {
}