Tryag File Manager
Home
||
Turbo Force
||
B-F Config_Cpanel
Current Path :
/
home
/
ltman.eemo.co.kr
/
public_html
/
www
/
Or
Select Your Path :
Upload File :
New :
File
Dir
/home/ltman.eemo.co.kr/public_html/www/farm_sensor_add_do.php
<? session_cache_limiter('no-cache, must-revalidate'); session_start(); header("Pragma: no-cache"); header("Cache-Control: no-cache,must-revalidate"); header("Content-Type: text/html; charset=utf-8"); include_once("dbconn.php"); include_once("lib.php"); foreach($_GET as $key => $value) { ${$key}=mysql_real_escape_string(trim($value)); } foreach($_POST as $key => $value) { ${$key}=mysql_real_escape_string(trim($value)); } $arr_rst=array(); $is_rs=RS("select * from farm_sensor where vcode='$vcode' "); if($is_rs[no]) { $arr_rst['rst']='double'; echo json_encode($arr_rst); exit; } $rs_is2=RS("select * from farm_sensor where farm_no='$farm_no' and dong_no='$dong_no' and pos_no='$pos_no' "); if($rs_is2[no]) { $arr_rst['rst']='double2'; $arr_rst['msg']='같은 동에 동일한 센서위치 이름이 존재합니다.'; echo json_encode($arr_rst); exit; } $rs=RS("select * from farm where no='$farm_no' "); $rs_max=RS("select MAX( RIGHT( sensor_code, 3 ) ) as cnt from farm_sensor where farm_no='$farm_no' "); $sensor_code=$rs[farm_code]."_S".sprintf("%03d",($rs_max[cnt]+1)); $rs_dong=RS("select * from farm_dong_info where no='$dong_no' "); mysql_query("insert into farm_sensor set sensor_code='$sensor_code', farm_no='$farm_no' , farm_code='{$rs[farm_code]}', dong_no='$dong_no', dong_code='{$rs_dong[dong_code]}', vcode='$vcode' , pos_no='$pos_no' , sensor_type='$sensor_type', regmem_no='{$_SESSION[mem_no]}', regdate=now() ") or die(); $arr_rst['rst']='1'; $arr_rst['code']=$rs[farm_code]; echo json_encode($arr_rst); ?>