?
Path : /home/admin/domains/happytokorea.com/public_html/modules/gallery/ |
Current File : /home/admin/domains/happytokorea.com/public_html/modules/gallery/function.php |
<? function select_cat($db_resource,$table,$name,$key_field,$value_field,$chk){ $m=$_GET['m']; $html="<select name=$name class=\"backend_inputbox\">"; $result=$db_resource->Query("SELECT * FROM $table WHERE cat_main='$m' order by $value_field DESC"); while($data=mysql_fetch_array($result)){ $v=$data[$value_field]; $k=$data[$key_field]; if($chk==$v && $chk!=''){ $html.="<option value=$v selected>$k</option>"; }else{ $html.="<option value=\"$v\">$k</option>"; } } $html.="</select>"; return $html; } function chang_field($db_resource,$table,$field,$field_change,$key){ $result=$db_resource->Query("SELECT $field_change FROM $table where $field='$key'"); $data=mysql_fetch_array($result); $return=$data[$field_change]; return $return; } function CountData($db_resource,$table,$condition){ $arr=$db_resource->Query("SELECT COUNT(*) FROM $table $condition"); $data=mysql_fetch_array($arr); return $data[0]; } function get_sub_cat($parent,$selected,$option){ global $user_login,$db; $rs=$db->Query("SELECT * FROM tour_cat where CatParentID='$parent' AND CatID!='{$_GET['group_id']}' "); if($parent!=''){ $option.=" "; } //$rs=$this->Query("SELECT * FROM package_cat where parent='$parent' and user_id='$u'"); while($arr=mysql_fetch_array($rs)){ $id=$arr['CatID']; $name=$arr['CatName']; if($arr['CatID']==$selected){$s="selected";}else{$s="";} if($parent!=''){ $html.="<OPTION VALUE=\"$id\" $s>$option $name</OPTION>"; }else{ $html.="<OPTION VALUE=\"$id\" $s>-$name</OPTION>"; } $html.=get_sub_cat($arr['CatID'],$selected,$option); }//end while return $html; } function genURLCat($url){ global $db; $url=trim($url); $searach=array(' ', '#', '+', '?', '%','/','\"'); $replace=array('-', '-', '-', '-', '-','-','-'); $url=str_replace($searach,'-',trim($url)); $url = str_replace("\'","",$url); return $url; }//end function load function WebCat($parent,$selected,$option){ global $user_login,$db; $rs=$db->Query("SELECT * FROM tour_cat where CatParentID='$parent' ORDER BY binary CatName ASC"); if($parent!=''){ $option.=" "; } while($arr=mysql_fetch_array($rs)){ $id=$arr['CatID']; $name=$arr['CatName']; if($arr['CatID']==$selected){$s="selected";}else{$s="";} if($parent!=''){ $html.="<OPTION VALUE=\"$id\" $s>$option $name</OPTION>"; }else{ $html.="<OPTION VALUE=\"$id\" $s>-$name</OPTION>"; } $html.=WebCat($arr['CatID'],$selected,$option); }//end while return $html; } ?>