| 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/tessabalpatiu.go.th/private_html/administrator/modules/setting/ |
Upload File : |
<?php
$res = 0;
$linkurl = "index.php?name=setting&file=country";
$tablename = "country";
if(@$_GET['act']=="add"){
$arrData = array();
//$idarr = $db->getOne("banner","max(country_id) as country_id","");
$idarr = $db->getOne($tablename,"max(country_id) as country_id","");
$id = $idarr['country_id'];
$autoid = $id+1;
$lang = $db->getAll("language","*","","","");
if($lang){
foreach($lang as $key => $value ){
$arrData['country_id'] = @$autoid;
$arrData['country_name'] = @$_POST['country_name'];
$arrData['lang_code'] = $value['lang_code'];
foreach($arrData as $k => $v ){
$arrData[$k] = str_replace("'", "\'", $v);
}
//echo "<pre>"; print_r($arrData);
//exit;
$db->insertData($tablename,$arrData);
}
}
//exit;
$msg = $lang_set['txtSaveComplete'];
$res = 1;
}elseif(@$_GET['act']=="editdata"){
$arrData = array();
$arrData['country_name'] = @$_POST['country_name'];
foreach($arrData as $k => $v ){
$arrData[$k] = str_replace("'", "\'", $v);
}
$db->updateData($tablename,$arrData,"country_id='".@$_POST['country_id']."' and lang_code='".$lang_code."'");
$msg = $lang_set['txtEditComplete'];
$res = 1;
}elseif(@$_GET['act']=="edit"){
$arrRes = $db->getOne($tablename,"*"," country_id='".@$_GET['country_id']."' and lang_code='".$lang_code."'");
}elseif(@$_GET['act']=="deletedata"){
$db->deleteData($tablename,"country_id='".@$_GET['country_id']."'");
//@unlink("../pagedata/news_".@$_GET['id'].".txt");
$msg = $lang_set['txtDeleteComplete'];
$res = 1;
}elseif(@$_GET['act']=="deleteAll"){
if($_POST['actdel']=="update"){
//$arrData = array();
foreach($_POST['CountryNameArray'] as $ke => $va){
$arrData1['country_name'] = $va;
$db->updateData($tablename,$arrData1,"country_id='".$ke."' and lang_code='".$lang_code."'");
};
$msg = $lang_set['txtEditComplete'];
}elseif ($_POST['actdel']=="del"){
//$arrData = array();
foreach($_POST['pagedel'] as $ke => $va){
$db->deleteData($tablename,"country_id='".$va."'");
}
$msg = $lang_set['txtDeleteComplete'];
}
$res = 1;
}
$where_f = "lang_code='".$lang_code."'";
$where_f2 = "lang_code='".$lang_code."'";
if(@$_REQUEST['keyword']){
@$_REQUEST['keyword'] = str_replace("'", "\'", @$_REQUEST['keyword']);
if($where_f){
$where_f .= " and ( country_name like '%".@$_REQUEST['keyword']."%')";
$where_f2 .= " and ( country_name like '%".@$_REQUEST['keyword']."%')";
}else{
$where_f = " ( country_name like '%".@$_REQUEST['keyword']."%')";
$where_f2 = " ( country_name like '%".@$_REQUEST['keyword']."%')";
}
$linkurl .= "&keyword=".$_REQUEST['keyword'];
}
$page = @$_GET['page'] ? @$_GET['page'] : 1;
$arrpageP = $db->getAll( $tablename, "*",$where_f,"" );
$arrPage = $objMaster->viewPages($page, $arrpageP, "15");
$getPage = $db->getAll($tablename,"*",$where_f,"order by country_name asc",@$arrPage["offset"]);
//echo "<pre>"; print_r($getPage);
?>
<div class="content-box"><!-- Start Content Box -->
<div class="content-box-header">
<h3><?php echo $lang_set['country_title']; ?></h3>
<ul class="content-box-tabs">
<li><a href="#tab1" <?php echo ($_GET['act']=="" ? 'class="default-tab"' : "" );?>><?php echo $lang_set['list_page']; ?></a></li>
<li><a href="#tab2" <?php echo ($_GET['act']=="edit" ? 'class="default-tab"' : "" );?>><?php echo $lang_set['add_page']; ?></a></li>
</ul>
<div class="clear"></div>
</div> <!-- End .content-box-header -->
<div class="content-box-content">
<div class="tab-content <?php echo ($_GET['act']!="edit" ? "default-tab" : "" );?>" id="tab1"> <!-- This is the target div. id must match the href of this div's tab -->
<?php if($res==1){?>
<div class="notification success png_bg">
<a href="#" class="close"><img src="images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
<div>
<?php echo $msg;?>
</div>
</div>
<meta http-equiv="refresh" content="0;URL=<?php echo $linkurl;?>">
<?php }?>
<form action="<?php echo $linkurl;?>" method="post">
<table>
<tr>
<td>
<input type="text" class="text-input small-input" name="keyword" value="<?php echo $_POST['keyword'];?>" />
<input type="submit" class="button" value="<?php echo $lang_set['search']; ?>" /> </td>
</tr>
</table>
</form>
<form action="<?php echo $linkurl;?>&act=deleteAll" method="post">
<input type="hidden" name="keyword" value="<?php echo $_POST['keyword']?>"/>
<table width="100%">
<thead>
<tr>
<th width="100"><input type="checkbox" class="check-all" /></th>
<th><?php echo $lang_set['country_name']; ?></th>
<th width="75"> </th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="2">
<div class="bulk-actions align-left">
<select name="actdel">
<option value="update"><?php echo $lang_set['update']; ?></option>
<option value="del"><?php echo $lang_set['delete']; ?></option>
</select>
<input type="submit" class="button" value="<?php echo $lang_set['submit2']; ?>" />
</div>
<div class="pagination">
<?php if( $arrPage["startPage"]!="" && $arrPage["endPage"] !="" ){?>
<a href="<?php echo $linkurl;?>&page=<?php echo $arrPage["startPage"];?>" title="First Page">« <?php echo $lang_set['txtFirst']?></a><a href="<?php echo $linkurl;?>&page=<?php echo ($page-1);?>" title="Previous Page">« <?php echo $lang_set['txtPrevious']?></a>
<?php
for($i = $arrPage["startPage"]; $i <= $arrPage["endPage"]; ++$i) {
echo'<a href="'.$linkurl.'&page='.$i.'" class="number '.($page == $i ? 'current' : '').'">'.($i).'</a>';
}?>
<a href="<?php echo $linkurl;?>&page=<?php echo ($page+1);?>" title="Next Page"><?php echo $lang_set['txtNext']?> »</a><a href="<?php echo $linkurl;?>&page=<?php echo $arrPage["endPage"];?>" title="Last Page"><?php echo $lang_set['txtLast']?> »</a>
<?php }?>
</div> <!-- End .pagination -->
<div class="clear"></div> </td>
</tr>
</tfoot>
<tbody>
<?php
if($getPage){
foreach($getPage as $key => $val){
?>
<tr>
<td><input type="checkbox" name="pagedel[]" value="<?php echo @$val['country_id'];?>"/></td>
<td><input type="text" value="<?php echo $val['country_name'];?>" class="text-input medium-input" name="CountryNameArray[<?php echo $val['country_id'];?>]" /></td>
<td> <a href="<?php echo $linkurl;?>&act=deletedata&country_id=<?php echo $val['country_id']?>" title="Delete"><img src="images/icons/cross.png" alt="Delete" /></a></td>
</tr>
<?php
}
}else{
?>
<tr>
<td colspan="3" style="text-align:center"><?php echo $lang_set['page_not_have']; ?>.</td>
</tr>
<?php
}
?>
</tbody>
</table>
</form>
</div> <!-- End #tab1 -->
<div class="tab-content <?php echo ($_GET['act']=="edit" ? "default-tab" : "" );?>" id="tab2">
<form action="<?php echo $linkurl;?>&act=<?php echo (@$_GET['act']=="edit" ? "editdata" : "add");?>" method="post" id="formID1">
<p>
<input type="hidden" name="country_id" value="<?php echo @$_GET['country_id'];?>">
</p>
<p>
<label><?php echo $lang_set['country_name']; ?>:</label>
<input type="text" class="validate[required] text-input small-input" name="country_name" id="country_name" value="<?php echo @$arrRes['country_name'];?>" />
</p>
<hr />
<p>
<input type="submit" class="button" value="<?php echo $lang_set['submit']; ?>" />
</p>
</form>
</div> <!-- End #tab2 -->
</div> <!-- End .content-box-content -->
</div>