<? include("conn.php"); header("Content-Type:text/plain;charset=TIS-620"); $conn ; function userLogin($citizenid,$birth_date){ Conn2DB(); $query="select count(*) cnt from registration R where R.card_id = '".$citizenid."' and R.birth_date = '".$birth_date."' "; $result=mysql_query($query); if($row=mysql_fetch_array($result)){ $cnt = $row[0]; }else { $cnt = 0; } //echo $cnt; return $cnt; } function show_registration($citizenid){ Conn2DB(); $query="select * From registration where card_id = '".$citizenid."'"; //echo $query; $result = mysql_query($query); return $result; } function show_regis($application_id){ Conn2DB(); $query="select * From registration a,branchname b where a.branch = b.branch and a.application_id = $application_id"; //echo $query; $result = mysql_query($query); return $result; } function show_branch($branch){ Conn2DB(); $query="select * From branchname where branch = $branch"; echo $query; $result = mysql_query($query); return $result; } function show_prename(){ Conn2DB(); $query="select a.prename_no,a.prename_thai_s,a.prename_eng_s From b_prename a WHERE a.prename_thai_s is not null order by a.prename_no "; //echo $query; $result = mysql_query($query); return $result; } function show_prename_eng(){ Conn2DB(); $query="select a.prename_no,a.prename_eng_s From b_prename a WHERE a.prename_eng_s is not null order by a.prename_no"; //echo $query; $result = mysql_query($query); return $result; } function show_province(){ Conn2DB(); $query="select a.province_id,a.province_name From b_province a order by a.province_name"; //echo $query; $result = mysql_query($query); return $result; } function show_yyyy(){ Conn2DB(); $query="SELECT DATE_FORMAT(now(), '%Y') dateYYYY FROM ad_setup"; //echo $query; $result = mysql_query($query); return $result; } function show_religion(){ Conn2DB(); $query="SELECT a.religion_id,a.religion_name_th FROM b_religion a"; //echo $query; $result = mysql_query($query); return $result; } function show_nation(){ Conn2DB(); $query="SELECT a.nation_id,a.nation_name_th FROM b_nation a order by a.nation_name_th"; //echo $query; $result = mysql_query($query); return $result; } function show_race(){ Conn2DB(); $query="SELECT a.race_no,a.race_name_thai FROM b_race a "; //echo $query; $result = mysql_query($query); return $result; } function show_district($district_name){ Conn2DB(); $query="select district_id,district_name from b_district where district_name like '$district_name%'"; //echo $query; $result = mysql_query($query); return $result; } function show_amper($province_no){ Conn2DB(); $province_no2=$province_no; $province_no = substr($province_no,0,2); $query="SELECT loc_code, loc_abbr FROM b_location WHERE loc_code != '000000' and loc_code != '$province_no2' AND loc_code LIKE '$province_no%' AND flag_disaster IS NULL ORDER BY loc_code, loc_abbr "; //echo $query; $result = mysql_query($query); return $result; } function show_setup(){ Conn2DB(); $query="SELECT a.fiscal_year,a.semester,b.series_name FROM ad_setup a,b_series b where a.series_no = b.series_no"; //echo $query; $result = mysql_query($query); return $result; } function show_education(){ Conn2DB(); $query="SELECT distinct(a.edu_no) edu_no,b.edu_name,c.series_name FROM ad_setup a,b_education_center b,b_series c where a.edu_no = b.edu_no and a.series_no = c.series_no and DATE_FORMAT(now(), '%Y-%m-%e') between a.date_start and a.date_end order by a.date_start"; //echo $query; $result = mysql_query($query); return $result; } function show_seq($edu_no){ Conn2DB(); $query="SELECT a.seq_num,e.plan_name,d.name_thai,b.edu_name,c.series_name FROM ad_setup a,b_education_center b,b_series c,b_main_major d,b_plan_study e where a.edu_no = b.edu_no and a.series_no = c.series_no and a.edu_no = '".$edu_no."' and a.curr_no = d.curr_no and a.major_no = d.major_no and a.main_major_no = d.main_major_no and d.plan_no = e.plan_no and a.plan_no = e.plan_no and DATE_FORMAT(now(), '%Y-%m-%e') between a.date_start and a.date_end order by a.plan_no,a.date_start"; //echo $query; $result = mysql_query($query); return $result; } function updateRegistration($application_id,$title_name_thai,$first_name_thai,$last_name_thai,$title_name_eng,$first_name_eng,$last_name_eng,$birth_date,$age,$province,$cur_address,$telephone,$mobile,$email_addr,$work_or_not,$ifwork_pass,$ifwork_position,$ifwork_salary,$ifwork_address,$ifwork_telephone,$contact_addr,$uni_name1,$from_date_to1,$brn_name1,$uni_name2,$from_date_to2,$brn_name2,$uni_name3,$from_date_to3,$brn_name3,$pri_blo,$sec_plo,$averge_point,$why_interest){ Conn2DB(); $query="UPDATE REGISTRATION SET title_name_thai='$title_name_thai',first_name_thai='$first_name_thai',last_name_thai='$last_name_thai',title_name_eng='$title_name_eng',first_name_eng='$first_name_eng',last_name_eng='$last_name_eng',birth_date='$birth_date',age='$age',province='$province',cur_address='$cur_address',telephone='$telephone',mobile='$mobile',email_addr='$email_addr',work_or_not='$work_or_not',ifwork_pass='$ifwork_pass',ifwork_position='$ifwork_position',ifwork_salary='$ifwork_salary',ifwork_salary='$ifwork_salary',ifwork_address='$ifwork_address',ifwork_telephone='$ifwork_telephone',contact_addr='$contact_addr',uni_name1='$uni_name1',from_date_to1='$from_date_to1',uni_name2='$uni_name2',from_date_to2='$from_date_to2',brn_name2='$brn_name2',uni_name3='$uni_name3',from_date_to3='$from_date_to3',brn_name3='$brn_name3',pri_blo='$pri_blo',sec_plo='$sec_plo',averge_point='$averge_point',why_interest='$why_interest' "; $query.=" WHERE application_id = $application_id "; //echo $query; $result = mysql_query($query); return $result; } function insertRegistration_his($application_id,$title_name_thai,$first_name_thai,$last_name_thai,$title_name_eng,$first_name_eng,$last_name_eng,$birth_date,$age,$province,$cur_address,$telephone,$mobile,$email_addr,$work_or_not,$ifwork_pass,$ifwork_position,$ifwork_salary,$ifwork_address,$ifwork_telephone,$contact_addr,$uni_name1,$from_date_to1,$brn_name1,$uni_name2,$from_date_to2,$brn_name2,$uni_name3,$from_date_to3,$brn_name3,$pri_blo,$sec_plo,$averge_point,$why_interest){ Conn2DB(); $query="INSERT INTO REGISTRATION_HIS (application_id,title_name_thai,first_name_thai,last_name_thai,title_name_eng,first_name_eng,last_name_eng,birth_date,age,province,cur_address,telephone,mobile,email_addr,work_or_not,ifwork_pass,ifwork_position,ifwork_salary,ifwork_address,ifwork_telephone,contact_addr,uni_name1,from_date_to1,brn_name1,uni_name2,from_date_to2,brn_name2,uni_name3,from_date_to3,brn_name3,$pri_blo,sec_plo,averge_point,why_interest)"; $query.="VALUES ($application_id,$title_name_thai,$first_name_thai,$last_name_thai,$title_name_eng,$first_name_eng,$last_name_eng,$birth_date,$age,$province,$cur_address,$telephone,$mobile,$email_addr,$work_or_not,$ifwork_pass,$ifwork_position,$ifwork_salary,$ifwork_address,$ifwork_telephone,$contact_addr,$uni_name1,$from_date_to1,$brn_name1,$uni_name2,$from_date_to2,$brn_name2,$uni_name3,$from_date_to3,$brn_name3,$pri_blo,$sec_plo,$averge_point,$why_interest)"; echo $query; $result = mysql_query($query); return $result; } function show_comcode($std_code){ Conn2DB(); $query="select std_code,first_name_thai,last_name_thai,project_name1,telephone,mobile,DATE_FORMAT(now(), '%Y%m%e') dateCom,now() dateNow From std_data a where a.std_code = '".$std_code."'"; //echo $query; $result = mysql_query($query); return $result; } function show_comregis($app_id){ Conn2DB(); $query="select a.project_id, concat('00',a.application_id)num_id,card_id,first_name_thai,last_name_thai,a.project_id,telephone,mobile,DATE_FORMAT(a.date_app, '%Y%m%e') dateCom,now() dateNow ,b.ac_code,b.ac_name,b.ac_bank,b.run_no,c.fee_amount,concat(FORMAT(c.fee_amount, 0),'00') fee_total,c.fee_name,d.year,d.semester,e.project_name ,f.series_name From registration a,ad_bankaccount b,ad_fee c,ad_setup d,b_project e,b_series f where a.application_id = $app_id and a.project_id = b.project_id and b.project_id = c.project_id and c.fee_no = 1 and c.project_id = d.project_id and d.project_id = e.project_id and d.series_no = f.series_no "; //echo $query; $result = mysql_query($query); return $result; } function show_applicationid($mycard){ Conn2DB(); $query="SELECT max(application_id) app_id FROM registration WHERE card_id = '".$mycard."'"; //echo $query; $result = mysql_query($query); return $result; } function insert_ad_receipt($app_id,$total,$ac_bank,$dateCom,$barcode,$project_id){ Conn2DB(); $query="insert into ad_receipt(application_id,total,payment_type,app_date,trans_date,receipt_pay_status,barcode,project_id) values ($app_id,$total,'".$ac_bank."','".$dateCom."',now(),'1','".$barcode."','".$project_id."')"; $result = mysql_query($query); return $result; } function show_theses($q,$op,$main_major){ Conn2DB(); if(($op == "0") && ($main_major == "00")){ $query="select * from theses_std where title_thai like '%".$q."%' AND title_eng like '%".$q."%' AND heading like '%".$q."%' AND authors like '%".$q."%' AND fiscal_year like '%".$q."%'"; }else if(($op == "0") && (!($main_major == "00"))){ $query="select * from theses_std where main_major = '".$main_major."' AND title_thai like '%".$q."%' AND title_eng like '%".$q."%' AND heading like '%".$q."%' AND authors like '%".$q."%' AND fiscal_year like '%".$q."%'"; }else if(($op == "1") && ($main_major == "00")){ $query="select * from theses_std where title_thai like '%".$q."%' AND title_eng like '%".$q."%' "; }else if(($op == "1") && (!($main_major == "00"))){ $query="select * from theses_std where main_major = '".$main_major."' AND title_thai like '%".$q."%' AND title_eng like '%".$q."%'"; }else if(($op == "2") && ($main_major == "00")){ $query="select * from theses_std where heading like '%".$q."%'"; }else if(($op == "2") && (!($main_major == "00"))){ $query="select * from theses_std where main_major = '".$main_major."' AND heading like '%".$q."%' "; }else if(($op == "3") && ($main_major == "00")){ $query="select * from theses_std where authors like '%".$q."%'"; }else if(($op == "3") && (!($main_major == "00"))){ $query="select * from theses_std where main_major = '".$main_major."' AND authors like '%".$q."%'"; }else if(($op == "4") && ($main_major == "00")){ $query="select * from theses_std where fiscal_year like '%".$q."%'"; }else if(($op == "4") && (!($main_major == "00"))){ $query="select * from theses_std where main_major = '".$main_major."' AND fiscal_year like '%".$q."%'"; }else { $query="select * from theses_std where title_thai like '%".$q."%' AND title_eng like '%".$q."%' AND heading like '%".$q."%' AND authors like '%".$q."%' AND fiscal_year like '%".$q."%'"; } //echo $query; $result = mysql_query($query); return $result; } function show_theses_page($q,$op,$main_major,$start,$limit){ Conn2DB(); if(($op == "0") && ($main_major == "00")){ $query="select * from theses_std where title_thai like '%".$q."%' AND title_eng like '%".$q."%' AND heading like '%".$q."%' AND authors like '%".$q."%' AND fiscal_year like '%".$q."%' ORDER BY theses_id DESC LIMIT $start,$limit"; }else if(($op == "0") && (!($main_major == "00"))){ $query="select * from theses_std where main_major = '".$main_major."' AND title_thai like '%".$q."%' AND title_eng like '%".$q."%' AND heading like '%".$q."%' AND authors like '%".$q."%' AND fiscal_year like '%".$q."%' ORDER BY theses_id DESC LIMIT $start,$limit"; }else if(($op == "1") && ($main_major == "00")){ $query="select * from theses_std where title_thai like '%".$q."%' AND title_eng like '%".$q."%' ORDER BY theses_id DESC LIMIT $start,$limit "; }else if(($op == "1") && (!($main_major == "00"))){ $query="select * from theses_std where main_major = '".$main_major."' AND title_thai like '%".$q."%' AND title_eng like '%".$q."%' ORDER BY theses_id DESC LIMIT $start,$limit"; }else if(($op == "2") && ($main_major == "00")){ $query="select * from theses_std where heading like '%".$q."%' ORDER BY theses_id DESC LIMIT $start,$limit"; }else if(($op == "2") && (!($main_major == "00"))){ $query="select * from theses_std where main_major = '".$main_major."' AND heading like '%".$q."%' ORDER BY theses_id DESC LIMIT $start,$limit"; }else if(($op == "3") && ($main_major == "00")){ $query="select * from theses_std where authors like '%".$q."%' ORDER BY theses_id DESC LIMIT $start,$limit"; }else if(($op == "3") && (!($main_major == "00"))){ $query="select * from theses_std where main_major = '".$main_major."' AND authors like '%".$q."%' ORDER BY theses_id DESC LIMIT $start,$limit"; }else if(($op == "4") && ($main_major == "00")){ $query="select * from theses_std where fiscal_year like '%".$q."%' ORDER BY theses_id DESC LIMIT $start,$limit"; }else if(($op == "4") && (!($main_major == "00"))){ $query="select * from theses_std where main_major = '".$main_major."' AND fiscal_year like '%".$q."%' ORDER BY theses_id DESC LIMIT $start,$limit"; }else { $query="select * from theses_std where title_thai like '%".$q."%' AND title_eng like '%".$q."%' AND heading like '%".$q."%' AND authors like '%".$q."%' AND fiscal_year like '%".$q."%' ORDER BY theses_id DESC LIMIT $start,$limit"; } //echo $query; $result = mysql_query($query); return $result; echo $result; } function show_fulltext($theses_id){ Conn2DB(); $query="select * from theses_std where theses_id = '".$theses_id."'"; //echo $query; $result = mysql_query($query); return $result; } function show_link($theses_id){ Conn2DB(); $query="select * from theses_fulltext where theses_id = '".$theses_id."'"; //echo $query; $result = mysql_query($query); return $result; } ?>