"; if (is_uploaded_file($_FILES["imageFile"]["tmp_name"])) { $dest_file = "as_wv/" . $_FILES["imageFile"]["name"]; if (!move_uploaded_file($_FILES["imageFile"]["tmp_name"], $dest_file)) die ("Failed image Upload."); } $sid = $_REQUEST['sid']; $idx = $_REQUEST['idx']; $tid = $_REQUEST['tid']; if ($idx == 0 ) { $mtids = $_REQUEST['mtids']; if ($mtids != "") $sq = explode("^", $_REQUEST['mtids']); else if ($_REQUEST['tid_sq'] != "") $sq = explode(",", $_REQUEST['tid_sq']); $phone = $_REQUEST['phone']; } else { $midxs = $_REQUEST['midxs']; if ($midxs != "") $sq = explode("^", $_REQUEST['midxs']); } $regtime = $_REQUEST['regtime']; $assign = $_REQUEST['assign']; $content = $_REQUEST['content']; $codecause = $_REQUEST['codecause']; $cause = $_REQUEST['cause']; $classify = $_REQUEST['classify']; $codeaction = $_REQUEST['codeaction']; if ( $classify == '1' ) $aqty = $_REQUEST['aqty']; else $aqty = 0; $action = $_REQUEST['action']; $filename = $_FILES["imageFile"]["name"]; include("dbconn.php"); if ($idx != 0 ) { //update only if ($filename != '' || $_REQUEST['chkdel'] == '1' ) { $sql = "select pict from bm_as where idx=" . $idx; $rs = mysql_query ($sql); if (mysql_num_rows ($rs) > 0) { $row = mysql_fetch_object ($rs); if ($row->pict <> "" ) { @unlink("as_wv/".$row->pict); echo "deleted " . $row->pict . "
"; } } mysql_free_result ($rs); }} if ($idx == 0) { if ( $codeaction == "" ) { $sql = "insert into bm_as (tid,sid,phone,content,assign,aid,codecause,cause,classify,regtime,pict) values ("; $sql = $sql . "'" . $tid . "','" . $sid . "','" .$phone . "','" . $content . "','" .$assign . "','" . $_SESSION["ss_id"] ."','" . $codecause . "'"; $sql = $sql . ",'" . $cause . "','" . $classify . "',now(),'" .$filename ."')"; } else { $sql = "insert into bm_as (tid,sid,phone,content,assign,aid,codecause,cause,classify,codeaction,aqty,action,regtime,acttime,pict) values ("; $sql = $sql . "'" . $tid . "','" . $sid . "','" .$phone . "','" . $content . "','" .$assign . "','" . $_SESSION["ss_id"] ."','" . $codecause . "'"; $sql = $sql . ",'" . $cause . "','" . $classify . "','" .$codeaction . "'," . $aqty . ",'" . $action . "',now(),now(),'" .$filename ."')"; } if ( $sq != "" ) { for($i=0;$i < sizeof($sq);$i++) { mysql_query($sql); if ($mtids != "") $tid = $sq[$i]; else $tid = substr($tid, 0, 11) . $sq[$i]; if ( $codeaction == "" ) { $sql = "insert into bm_as (tid,sid,phone,content,assign,aid,codecause,cause,classify,regtime,pict) values ("; $sql = $sql . "'" . $tid . "','" . $sid . "','" .$phone . "','" . $content . "','" .$assign . "','" . $_SESSION["ss_id"] ."','" . $codecause . "'"; $sql = $sql . ",'" . $cause . "','" . $classify . "',now(),'" .$filename ."')"; } else { $sql = "insert into bm_as (tid,sid,phone,content,assign,aid,codecause,cause,classify,codeaction,aqty,action,regtime,acttime,pict) values ("; $sql = $sql . "'" . $tid . "','" . $sid . "','" .$phone . "','" . $content . "','" .$assign . "','" . $_SESSION["ss_id"] ."','" . $codecause . "'"; $sql = $sql . ",'" . $cause . "','" . $classify . "','" .$codeaction . "'," . $aqty . ",'" . $action . "',now(),now(),'" .$filename ."')"; } } } } else { $sql = "update bm_as set tid='" . $tid . "',regtime ='" . $regtime . "',assign='" . $assign . "',content='" . $content . "',codecause='" . $codecause . "',cause='" . $cause . "'"; $sql = $sql . ",classify='" . $classify . "',codeaction='" . $codeaction . "',aqty=" . $aqty . ",action='" . $action . "'"; $sql = $sql . ",pict='" . $filename . "',aid='" . $_SESSION["ss_id"] . "',acttime=now() where idx=" . $idx; if ( $sq != "" ) //multiple for($i=0;$i < sizeof($sq);$i++) { mysql_query($sql); $idx = $sq[$i]; $sql = "update bm_as set codecause='" . $codecause . "',cause='" . $cause . "'"; $sql = $sql . ",classify='" . $classify . "',codeaction='" . $codeaction . "',aqty=" . $aqty . ",action='" . $action . "'"; $sql = $sql . ",aid='" . $_SESSION["ss_id"] . "',acttime=now() where idx=" . $idx; } } mysql_query($sql); echo "
Just a moment, please.
"; } ?>