| Server IP : 27.254.152.13 / Your IP : 216.73.217.38 Web Server : Apache/2 System : Linux ns1-252017.dragonhispeed.com 5.2.0 #1 SMP Fri Mar 29 22:50:14 MSK 2024 x86_64 User : coloflew ( 1072) PHP Version : 5.6.40 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/coloflew/domains/fulltion.com/private_html/administrator/modules/manu_masterbus/ |
Upload File : |
<?php
$linkUrl = "index.php?name=manu_masterbus&file=bus";
if(@$_GET['act']=="add"){
@$arrData = array();
@$arrchk = @$db->getOne("bus"," count(*) as cost","BusType = '".@$_POST['BusType']."' and BusName = '".@$_POST['BusName']."'","","");
@$chk = @$arrchk['cost'];
if(@$chk == '0'){
@$idarr = @$db->getOne("bus","*","","order by BusID desc","limit 1");
@$id = @$idarr['BusID'];
@$autoid = @$id+1;
@$lang = @$db->getAll("language","*","","","");
if(@$lang){
foreach(@$lang as $key => $value ){
if(isset($_FILES)){
foreach(@$_FILES as $key => $val){
if( @ereg("^image", @$key)){
if( @$val['name'] ){
@$thumnelwid = array("width"=>"100","hight"=>"35");
@$arrData[@$key] = @$objMaster->uploadImage("image", "images/bus",@$key,"bus_".time(),@$_FILES,"",@$thumnelwid);
if(@$key=="image"){@$chk_img1 = @$arrData[@$key];}
@$chk_img = @$arrData[@$key];
}
}
}
}
@$arrData['BusID'] = @$autoid;
@$arrData['BusPlate'] = @$_POST['BusPlate'];
@$arrData['BusName'] = @$_POST['BusName'];
@$arrData['BusBrand'] = @$_POST['BusBrand'];
@$arrData['BusContract'] = @$_POST['BusContract'];
@$arrData['BusContractOut'] = @$objMaster->getdateformat(@$_POST['BusContractOut']);
@$arrData['BusInsurance'] = @$_POST['BusInsurance'];
@$arrData['BusInsuranceOut'] = @$objMaster->getdateformat(@$_POST['BusInsuranceOut']);
@$arrData['BusSeat'] = @$_POST['BusSeat'];
@$arrData['BusType'] = @$_POST['BusType'];
@$arrData['BusStatus'] = @$_POST['BusStatus'];
@$arrData['lang_code'] = @$value['lang_code'];
foreach(@$arrData as $k => $v ){
@$arrData[@$k] = str_replace("'", "\'", @$v);
}
//echo "<pre>"; print_r(@$arrData);
//exit;
@$db->insertData("bus",@$arrData);
}
}
//exit;
@$msg = "Save Data complete.";
@$res = true;
}else{
@$err = "ไม่สามารถบันทึกข้อมูลได้ เนื่องจากอาจกรอกข้อมูลรถที่ซ้ำกัน";
}
}elseif(@$_GET['act']=="editdata"){
@$arrData = array();
@$arrchk = @$db->getOne("bus"," count(*) as cost","BusType = '".@$_POST['BusType']."' and BusName = '".@$_POST['BusName']."' and BusID not in (select BusID from ".DB_PREFIX."bus where BusID='".@$_POST['BusID']."')","","");
@$chk = @$arrchk['cost'];
if(@$chk == "0"){
if(isset($_FILES['image']['name']) || isset($_FILES['image']['name'])){
if(@$_POST['oldImage1']) @unlink ("images/bus/".@$_POST['oldImage1']);
if(@$_POST['oldImage1']) @unlink ("images/bus/thumbs/".@$_POST['oldImage1']);
foreach(@$_FILES as $key => $val){
if( @ereg("^image", @$key)){ //image
@$k="chkDel".ucfirst(strtolower(@$key));
if( @$val['name']){
@$thumnelwid = array("width"=>"100","hight"=>"35");
@$arrData[@$key] = @$objMaster->uploadImage("image","images/bus",@$key,"bus_".time(),@$_FILES,"",@$thumnelwid);//exit;
if(@$key=="image"){@$chk_img1 = @$arrData[@$key]; }
@$chk_img = @$arrData[@$key];
if(@$_POST[@$k] && @$chk_img){
@unlink("images/bus", @$_POST[@$k], "0");
@unlink("images/bus/thumbs", @$_POST[@$k], "0");
}
}else{
if(@$_POST[@$k]){
@unlink("images/bus", @$arrData[@$k], "0");
@unlink("images/bus/thumbs", @$arrData[@$k], "0");
@$arrData[@$key] = "";
}
}
}
}
}else{
@$arrData['image'] = @$_POST['oldImage1'];
}
@$arrData['BusPlate'] = @$_POST['BusPlate'];
@$arrData['BusName'] = @$_POST['BusName'];
@$arrData['BusBrand'] = @$_POST['BusBrand'];
@$arrData['BusContract'] = @$_POST['BusContract'];
@$arrData['BusContractOut'] = @$objMaster->getdateformat(@$_POST['BusContractOut']);
@$arrData['BusInsurance'] = @$_POST['BusInsurance'];
@$arrData['BusInsuranceOut'] = @$objMaster->getdateformat(@$_POST['BusInsuranceOut']);
@$arrData['BusSeat'] = @$_POST['BusSeat'];
@$arrData['BusType'] = @$_POST['BusType'];
@$arrData['BusStatus'] = @$_POST['BusStatus'];
foreach(@$arrData as $k => $v ){
@$arrData[@$k] = str_replace("'", "\'", @$v);
}
@$db->updateData("bus",@$arrData," BusID='".@$_POST['BusID']."' and lang_code='".@$lang_code."'");
@$msg = "Edit Data complete.";
@$res = true;
}else{
@$err = "ไม่สามารถบันทึกข้อมูลได้ เนื่องจากอาจกรอกข้อมูลรถที่ซ้ำกัน";
}
}elseif(@$_GET['act']=="edit"){
@$arrRes = @$db->getOne("bus","*"," BusID='".@$_GET['BusID']."' and lang_code='".@$lang_code."'");
}elseif(@$_GET['act']=="deletedata"){
@$db->deleteData("bus"," BusID='".@$_GET['BusID']."'");
@$arrdel = @$db->getOne("bus","*"," BusID='".@$_GET['BusID']."' and lang_code='".@$lang_code."'");
@unlink("images/bus", @$arrdel['image'], "0");
@unlink("images/bus/thumbs", @$arrdel['image'], "0");
@$msg = "Delete Data complete.";
@$res = true;
}elseif(@$_GET['act']=="deleteAll"){
//echo "<pre>"; print_r(@$_POST);
if(count(@$_POST['pagedel']) > 0){
foreach(@$_POST['pagedel'] as $key => $val){
@$arrdel = @$db->getOne("bus","*"," BusID='".@$val."' and lang_code='".@$lang_code."'");
@unlink("images/bus", @$arrdel['image'], "0");
@unlink("images/bus/thumbs", @$arrdel['image'], "0");
@$db->deleteData("bus"," BusID='".@$val."'");
}
}
@$msg = "Delete Data complete.";
@$res = true;
}
@$where_f = "lang_code='".@$lang_code."'";
@$where_lang = " lang_code='".@$lang_code."'";
@$search = @$_POST['keyword'] ? @$_POST['keyword'] : @$_GET['keyword'];
if(@$search){
@$searchnew = str_replace("'", "\'", @$search);
if(@$where_f){
@$where_f .= " and (BusName like '%".@$searchnew."%' or BusBrand like '%".@$searchnew."%' or BusPlate like '%".@$searchnew."%')";
}else{
@$where_f = " (BusName like '%".@$searchnew."%' or BusBrand like '%".@$searchnew."%' or BusPlate like '%".@$searchnew."%')";
}
}
@$bustypeID = @$_POST['bustypeID'] ? @$_POST['bustypeID'] : @$_GET['bustypeID'];
if(@$bustypeID){
if(@$where_f){
@$where_f .= " and BusType='".@$bustypeID."'";
}else{
@$where_f = " BusType='".@$bustypeID."'";
}
}
@$page = @$_GET['page'] ? @$_GET['page'] : 1;
@$arrpageP = @$db->getAll( "bus", "*",@$where_f,"" );
@$arrPage = @$objMaster->viewPages(@$page, @$arrpageP, "15");
@$getPage = @$db->getAll("bus","*",@$where_f,"",@$arrPage["offset"]);
@$gettype = @$db->getAll( "bustype", "*",@$where_lang." and BusTypeStatus = '1'","" );
//echo "<pre>"; print_r(@$getPage);
?>
<!-- Start Content Box -->
<div class="content-box">
<!-- Start Content Box Header-->
<div class="content-box-header">
<h3>ข้อมูลรถ </h3>
<span style="width:60px; float:left; padding-top:10px;"><a href="<?php echo $linkUrl;?>"><img src="images/icon_back.gif" border="0" /></a></span>
<ul class="content-box-tabs">
<?php if(@$_GET['act']!="edit"){?>
<li><a href="#list" <?php echo (@$_GET['act']=="" ? 'class="default-tab"' : '');?>><?php echo @$lang_set['list_bus']; ?></a></li> <!-- href must be unique and match the id of target div -->
<li><a href="#add" <?php echo (@$_GET['act']=="edit" ? 'class="default-tab"' : '');?>><?php echo @$lang_set['add_bus']; ?></a></li>
<?php }else{?>
<li><a href="#add" <?php echo (@$_GET['act']=="edit" ? 'class="default-tab"' : '');?>>แก้ไขข้อมูล</a></li>
<?php }?>
</ul>
<div class="clear"></div>
</div>
<!-- End Content Box Header-->
<!-- Start Content Box Content-->
<div class="content-box-content">
<?php if(@$res){?>
<div class="notification success png_bg">
<a href="#" class="close"><img src="resources/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
<div>
<?php echo @$msg;?>
</div>
</div>
<meta http-equiv="refresh" content="1;URL=<?php echo $linkUrl;?>">
<?php }?>
<?php if(@$err != ""){?>
<div class="notification error png_bg">
<a href="#" class="close"><img src="resources/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
<div>
<?php echo @$err;?>
</div>
</div>
<meta http-equiv="refresh" content="3;URL=<?php echo $linkUrl;?>">
<?php }?>
<!-- Start Tab Content id="list"-->
<div class="tab-content <?php echo (@$_GET['act']=="" ? 'default-tab' : '');?>" id="list">
<form action="<?php echo $linkUrl;?>" method="post" name="form_search">
<table>
<tr>
<td style="width:80px;"><?php echo @$lang_set['input_search'];?> :</td>
<td style="width:150px;">ประเภทรถ <br />
<select name="bustypeID">
<?php
if(@$gettype){foreach(@$gettype as $key => $val){
?>
<option value="<?php echo @$val['BusTypeID'];?>" <?php echo (@$val['BusTypeID']=='' || @$val['BusTypeID']==@$bustypeID ? "selected" : "")?>><?php echo @$val['BusTypeName'];?></option>
<?php }
}
?>
</select>
</td>
<td style="width:300px;">หมายเลข /ทะเบียนรถ <br />
<input type="text" class="text" value="<?PHP echo @$search;?>" name="keyword" />
</td>
<td style="vertical-align:middle; text-align:left;">
<input type="submit" class="button" value="ค้นหา"/>
</td>
</tr>
</table>
</form>
<form action="<?php echo $linkUrl;?>&act=deleteAll" method="post" onsubmit="return confirmDelete(this);">
<table cellpadding="0" cellspacing="0" width="100%">
<thead>
<tr>
<th width="20"><input type="checkbox" class="check-all" /></th>
<th style="text-align:left;"><?php echo @$lang_set['image']; ?></th>
<th style="text-align:left;"><?php echo @$lang_set['bus_plate']; ?></th>
<th style="text-align:left;"><?php echo @$lang_set['bus_name']; ?></th>
<th style="text-align:left;"><?php echo @$lang_set['bus_seat']; ?></th>
<th style="text-align:left;"><?php echo @$lang_set['bustype_name']; ?></th>
<th><?php echo @$lang_set['bus_status']; ?></th>
<th style="text-align:center;"><?php echo @$lang_set['action']; ?></th>
</tr>
</thead>
<?php
if(@$getPage){
foreach(@$getPage as $key => $val){
@$getbustype = @$db->getOne( "bustype", "*"," BusTypeID = '".@$val['BusType']."'","" );
?>
<tr>
<th><input type="checkbox" name="pagedel[]" value="<?php echo @$val['BusID'];?>"/></th>
<th><?php
if(@$val['image']!=''){
?>
<img src="images/bus/thumbs/<?php echo @$val['image'];?>" />
<?php
}
else{
?>
<img src="images/noimg.jpg" width="100" height="100"/>
<?php
}
?> </th>
<th><?php echo @$val['BusPlate'];?></th>
<th><?php echo @$val['BusName'];?></th>
<th><?php echo @$val['BusSeat'];?></th>
<th><?php echo @$getbustype['BusTypeName'];?></th>
<th>
<select name="BusStatus" onchange="AJAX_Update_status('bus','BusStatus',this.options[this.selectedIndex].value,'<?php echo @$val['BusID']?>','BusID');">
<option value="1" <?php echo (@$val['BusStatus']=="1" ? "selected" : "");?>><?php echo @$lang_set['show']; ?></option>
<option value="0" <?php echo (@$val['BusStatus']=="0" ? "selected" : "");?>><?php echo @$lang_set['hide']; ?></option>
</select>
</th>
<th style="text-align:center;">
<a href="index.php?name=manu_masterbus&file=addemp&BusID=<?php echo @$val['BusID']?>" title="AddEmp"><img src="resources/images/icons/icon_links.png" alt="AddEmp" /></a> |
<a href="<?php echo $linkUrl;?>&act=edit&BusID=<?php echo @$val['BusID']?>#add" title="Edit"><img src="resources/images/icons/pencil.png" alt="Edit" /></a> |
<a href="javascript:void();" title="Delete" onclick="chkConfirm('<?php echo $linkUrl;?>&act=deletedata&BusID=<?php echo @$val['BusID']?>','ยืนยันการลบข้อมูล');"><img src="resources/images/icons/cross.png" alt="Delete" /></a>
</th>
</tr>
<?php
}
}else{
?>
<tr>
<th colspan="11" style="text-align:center"><?php echo @$lang_set['not_data']; ?></th>
</tr>
<?php
}
?>
<tfoot>
<tr>
<td colspan="11">
<div class="bulk-actions align-left">
<select name="actdel">
<option value="del"><?php echo @$lang_set['delete']; ?></option>
</select>
<input class="button" type="submit" value="<?php echo @$lang_set['selected']; ?>" />
</div>
<!-- Start .pagination -->
<?php if($arrPage['allpage']>1){?>
<div class="pagination">
<a href="<?php echo $linkUrl;?>&page=1&keyword=<?PHP echo @$search;?>" title="หน้าแรก">« หน้าแรก</a><a href="<?php echo $linkUrl;?>&page=<?php echo ($page==1 ? $page : @$page-1);?>&keyword=<?PHP echo @$search;?>" title="ก่อนหน้า">« ก่อนหน้า</a>
<?php if( @$arrPage["startPage"]!="" && @$arrPage["endPage"] !="" ){?>
<?php
for($i = @$arrPage["startPage"]; $i <= @$arrPage["endPage"]; ++$i) {
echo'<a href="'.$linkUrl.'&keyword='.@$search.'&page='.@$i.'" '.(@$page == @$i ? 'class="number current"' : '').'>'.(@$i).'</a>';
}?>
<?php }?>
<a href="<?php echo $linkUrl;?>&page=<?php echo ($page==$arrPage["allpage"] ? $page : $page+1);?>&keyword=<?PHP echo @$search;?>" title="ถัดไป">ถัดไป »</a><a href="<?php echo $linkUrl;?>&page=<?php echo @$arrPage["allpage"];?>&keyword=<?PHP echo @$search;?>" title="หน้าสุดท้าย">หน้าสุดท้าย »</a>
</div>
<?php }?>
<!-- End .pagination -->
<div class="clear"></div>
</td>
</tr>
</tfoot>
</table>
</form>
</div>
<!-- End Tab Content id="list"-->
<!-- Start Tab Content id="add"-->
<div class="tab-content <?php echo (@$_GET['act']=="edit" ? 'default-tab' : '');?>" id="add">
<form action="<?php echo $linkUrl;?>&act=<?php echo (@$_GET['act']=="edit" ? "editdata" : "add");?>#add" method="post" enctype="multipart/form-data" onsubmit="return checkpagebus();"><!--onsubmit="return checkdelivery();"-->
<fieldset>
<input type="hidden" name="BusID" value="<?php echo @$_GET['BusID'];?>">
<table>
<tr style="background:#fff;">
<td width="75">
<label><?php echo @$lang_set['bus_type']; ?>:</label>
</td><td>
<select name="BusType">
<?php
if(@$gettype){foreach(@$gettype as $key => $val){
?>
<option value="<?php echo @$val['BusTypeID'];?>" <?php echo (@$val['BusTypeID']=='' || @$val['BusTypeID']==@$arrRes['BusType'] ? "selected" : "")?>><?php echo @$val['BusTypeName'];?></option>
<?php }
}
?>
</select>
</td>
<tr>
</table>
<table>
<tr style="background:#fff;">
<td width="75">
<label><?php echo @$lang_set['bus_brand']; ?>:</label>
</td><td>
<input type="text" class="text-input large-input" name="BusBrand" id="BusBrand" value="<?php echo @$arrRes['BusBrand'];?>" />
</td><td width="75px">
<label><?php echo @$lang_set['bus_plate']; ?>:</label>
</td><td>
<input type="text" class="text-input large-input" name="BusPlate" id="BusPlate" value="<?php echo @$arrRes['BusPlate'];?>" />
</td><td width="75px">
<label><?php echo @$lang_set['bus_name']; ?>:</label>
</td><td>
<input type="text" class="text-input large-input" name="BusName" id="BusName" value="<?php echo @$arrRes['BusName'];?>" />
</td><td width="20%">
</td>
<tr>
</table>
<table>
<tr style="background:#fff;">
<td width="75px">
<label><?php echo @$lang_set['bus_contract']; ?>:</label>
</td><td>
<input type="text" class="text-input large-input" name="BusContract" id="BusContract" value="<?php echo @$arrRes['BusContract'];?>" />
</td><td width="75px">
<label><?php echo @$lang_set['bus_purchase']; ?>:</label>
</td><td>
<input type="text" class="text date_picker" name="BusContractOut" value="<?php echo @$arrRes['BusContractOut'] == ''? @$objMaster->getdbdateformat(date("Y-m-d")): @$objMaster->getdbdateformat(@$arrRes['BusContractOut']);?>"/>
</td><td width="75px">
<label><?php echo @$lang_set['bus_insurance']; ?>:</label>
</td><td>
<input type="text" class="text-input large-input" name="BusInsurance" id="BusInsurance" value="<?php echo @$arrRes['BusInsurance'];?>" />
</td><td width="75px">
<label><?php echo @$lang_set['bus_purchase']; ?>:</label>
</td><td>
<input type="text" class="text date_picker" name="BusInsuranceOut" value="<?php echo @$arrRes['BusInsuranceOut'] == ''? @$objMaster->getdbdateformat(date("Y-m-d")) :@$objMaster->getdbdateformat(@$arrRes['BusInsuranceOut']);?>"/>
</td>
<tr>
</table>
<table>
<tr style="background:#fff;">
<td width="75px">
<label><?php echo @$lang_set['bus_seat']; ?>:</label>
</td><td>
<input type="text" class="text-input small-input" name="BusSeat" id="BusSeat" value="<?php echo @$arrRes['BusSeat'];?>" />
</td>
<tr>
</table>
<table>
<tr style="background:#fff;">
<td width="75px">
<label><?php echo @$lang_set['image'];?>:</label>
</td>
<td>
<?php if(@$arrRes['image']){?>
<img src="images/bus/thumbs/<?php echo @$arrRes['image'];?>" />
<?php }?>
<p class="fileupload"><input type="file" name="image" id="image" class="shortcut-button upload-image" size="45" <?php echo ( !@$arrRes['image'] ? "":"DISABLED");?> ><span class="png_bg"><img src="resources/images/icons/icon_upload.png" alt="อัพโหลดรูปภาพ" width="20" height="20"/></span>
<?php echo ( !@$arrRes['image'] ? "": "<br><input type='checkbox' onClick='if(this.checked){document.getElementById(\"chkDelImage1\").value=\"".@$arrRes['image']."\";document.getElementById(\"image\").disabled=\"\";}else{document.getElementById(\"chkDelImage1\").value=\"\";document.getElementById(\"image\").disabled=\"true\";}'> ".@$lang_set['delete_image']." <input type='hidden' value='' id='chkDelImage1' name='chkDelImage1'>" ) ?><input type="hidden" id="oldImage1" name="oldImage1" value="<?php echo @$arrRes['image']; ?>"></p>
</td>
<tr>
</table>
<table>
<tr style="background:#fff;">
<td>
<input type="radio" name="BusStatus" value="1" <?php echo (@$arrRes['BusStatus']=="1" ? "checked" : "" ); ?> /> <?php echo @$lang_set['show']; ?>
<input type="radio" name="BusStatus" value="0" <?php echo ( !@$arrRes['BusStatus'] || @$arrRes['BusStatus']=="0" ? "checked" : "" ); ?>/><?php echo @$lang_set['hide']; ?>
</td>
<tr>
</table>
<p>
<input type="submit" class="button" value="<?php echo @$lang_set['submit']; ?>" />
</p>
</fieldset>
</form>
</div>
<!-- End Tab Content id="add"-->
</div>