Skip to content

Өгөгдөл боловсруулах хуудас

November 1, 2006

Вэбсофт Монгол ХХК-ын вэб боловсруулах программын эх кодыг та бүхэнд танилцуулж байна
<? if(isset($id)) {
   $result=mysql_query(“select * from $tbl_pref”.$admin[$sel].” where id=$id”); 
   $row=mysql_fetch_object($result);
   }
   else $result=mysql_query(“select * from $tbl_pref”.$admin[$sel]);  
?>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″>
<script language=”javascript” type=”text/javascript” src=”tiny_mce/tiny_mce.js”></script>
<? $cssfilename = $_SESSION[‘cssfilename’]; ?>
<script type=”text/javascript”>
 tinyMCE.init({
  theme : “advanced”,
  language : “uk”,
  mode : “specific_textareas”,
  document_base_url : “<?=$SITE_DOMAIN?>/01_admin/tiny_mce/”,
   invalid_elements : “script,object,applet,iframe”,
   theme_advanced_toolbar_location : “top”,
   theme_advanced_source_editor_height : “550”,
  theme_advanced_source_editor_width : “750”,
   directionality: “ltr”,
   force_br_newlines : “false”,
   content_css : “<?=$SITE_DOMAIN?>/images/_img_00.css”,  
  debug : false
 });
</script>
<table width=”100%” cellpadding=”5″ cellspacing=”2″>
  <form action=”exec.php?sel=<?=$sel?>” method=”post” enctype=”multipart/form-data”>
    <tr bgcolor=”#efefef”>
      <td height=”25″ colspan=”2″> <font color=”#000″><strong>
        <?
      echo $vtitle[$sel].” “;
      echo (isset($id))? “засварлах”: “шинээр нэмэх”;
   ?>
        </strong></font> </td>
    </tr>
    <? for($i=1;$i<mysql_num_fields($result);$i++)   
 {  $field_type=mysql_field_type($result,$i);
    $field_name=mysql_field_name($result,$i);
    if(isset($_GET[“sel_”.$field_name])) { echo “<input type=’hidden’ name=’sel_”.$field_name.”‘ value='”;
                                           echo $_GET[“sel_”.$field_name];
             echo “‘>”; }
    elseif(isset($_POST[“sel_”.$field_name])) { echo “<input type=’hidden’ name=’sel_”.$field_name.”‘ value='”;
                                                echo $_POST[“sel_”.$field_name];
               echo “‘>”; }
 if($field_name != “menu_menu” and $field_name != “rang” and $field_name != “page_type”){
   ?>
    <tr bgcolor=”#FFFFFF”>
      <td height=”25″ colspan=”2″ align=”left”>
        <? if(substr($field_name,0,4)!=’rate’ && $field_name!=”page” && $field_name!=”acount”)
                                              {
              echo “<font color=’#666666′>”;
              switch($field_name){
               case “name”: if($sel==”zone”) echo “Хvргэх бvс”;
                   elseif($sel==”help”) echo “Гарчиг”;    
                else echo “Нэр: “; break;              
               case “apass”: echo “Нууц vг: “; break;              
               case “title”: echo “Гарчиг: “; break;
               case “body”: if($sel==2) echo “Санал асуулга”;
                            elseif($sel==10) echo “Сонголт”;
                    else echo “Мэдээлэл: “; break;
               case “edate”: echo “Огноо: “; break;
               case “pic”: echo “Зураг: “; break;
               /********************************************/
               case “enname”: echo “Англиар”; break;
               case “mnname”: echo “Монголоор”; break;
               case “entitle”: echo “Англи гарчиг”; break;
               case “mntitle”: echo “Монгол гарчиг”; break;
               case “enbody”: echo “Англи”; break;
               case “mnbody”: echo “Монгол”; break;
               case “type_lr”: echo “Рекламны баннер хаана байрлах вэ?”; break;
               case “menu_type”: echo “Линкний төрөл<br />
                  *<strong>Динамик</strong> – Хоосон орхино уу<br />
                  *<strong>Статик</strong> – Ямар линкээр дамжихыг зааж өгнө үү”; break;
               case “link_url”: echo “Рекламны баннер дээр дархад хайшаа үсрэх вэ? (линк) жиш: http://www.websoft.mn“; break;
              
               /********************************************/
               default : echo $field_name.”:”;               
               }
              echo “</font>”;
             }?>
      </td>
    </tr>
 <?
 }
 if($field_name == “menu_type”){
 ?>
    <tr bgcolor=”#FFFFFF”>
      <td>Төрөл
        <select name”link_type”
  onChange=”form.link_link.disabled=false;”>
            <option value=”true”>Динамик</option>
            <option value=”false”>Статик</option>
      </select></td>
      <td>Линк
      <input type=”text” name=”link_link” disabled=”disabled” value=”<? if(isset($id)) echo $row->$field_name;?>”  /></td>
    </tr>
    <?
 break;
 }
 ?>
    <tr bgcolor=”#FFFFFF”>
      <td width=”449″ height=”25″ colspan=”2″ align=”left”>
        <?
  if(isset($id)) echo “<input type=’hidden’ name=’id’ value=$id>”;
  if(!isset($type_id)) $type_id = $id;
  echo “<input type=’hidden’ name=type_id value=$type_id>”;
  switch($field_type)
       { case “date” : { if(isset($id)) { $strdate=explode(“-“,$row->edate);
              echo “”; 
                       echo “<input name=’kyear’ type=’text’ size=5 maxlength=’4′ value=’$strdate[0]’><font color=’#666666′> он </font>”;
                       echo “<input name=’kmonth’ type=’text’ size=2 maxlength=’2′ value=’$strdate[1]’><font color=’#666666′> сар </font>”;
           echo “<input name=’kday’ type=’text’ size=2 maxlength=’2′ value=’$strdate[2]’><font color=’#666666′> єдєр </font>”;
           echo “”;
                     }
           else { $date=getdate();
               echo “<input name=’kyear’ type=’text’ size=5 maxlength=’4′ value='”.$date[‘year’].”‘><font color=’#666666′> он </font>”;
                  echo “<input name=’kmonth’ type=’text’ size=2 maxlength=’2′ value='”.$date[‘mon’].”‘><font color=’#666666′> сар </font>”;
         echo “<input name=’kday’ type=’text’ size=2 maxlength=’2′ value='”.$date[‘mday’].”‘><font color=’#666666’> єдєр </font>”;
            }
                      break;}
      case “string” :{    
        
        if($field_name == ‘new_new’){
          if(isset($id))
           if($row->$field_name == “1”)
           echo “Шинэ шинэ <input checked=checked type=’checkbox’ name=’new_new’>”;
         else
         echo “Шинэ шинэ <input type=’checkbox’ name=’new_new’>”;
          else
          echo “Шинэ шинэ <input type=’checkbox’ name=’new_new’>”;
          break;
          }
       
        if($field_name == “active_news”) {
        $checkeds =””;
        if(isset($id)) {
         $page_active_news_query = mysql_query(“select active_news from $tbl_pref”.$admin[$sel].” where id =”.$id); 
         //echo “sdf = “.$admin[$sel];
         $page_active_news=mysql_fetch_object($page_active_news_query);
         if($page_active_news->active_news == “tr”) $checkeds = “checked=checked”;
        }
        echo “<input type=checkbox name= $field_name  $checkeds> <font color=’#ff0000′>З?вх?н б?ртг??лсэн хэрэглэгчид харагдах мэдээ</font>”;
        break;
       }   
       
         if($field_name == “type_lr”) {
        $checkedr =””;
        $checkedl =””;
        if(isset($id)) {
         $page_type_lr_query = mysql_query(“select type_lr from $tbl_pref”.$admin[$sel].” where id =”.$id); 
         //echo “sdf = “.$admin[$sel];
         $page_type_lr_news=mysql_fetch_object($page_type_lr_query);
         
         if($page_type_lr_news->type_lr == “l”) $checkedl = “checked=checked”;
         elseif($page_type_lr_news->type_lr == “r”) $checkedr = “checked=checked”;
         elseif($page_type_lr_news->type_lr == “l_r”) { $checkedl = “checked=checked”; $checkedr = “checked=checked”;}
        }
        echo “<input type=checkbox name= rigth_m  $checkedr> <font color=’#ff0000′>Баруун талд гарах баннер</font>”;
        echo “<input type=checkbox name= left_m  $checkedl> <font color=’#ff0000′>Зүүн талд гарах баннер</font>”;
        break;
       }          
                    if($page==”contact”){
              switch($field_name)
              {                
             case “email”: $nsel=2; break;
             case “name”: $nsel=3; break;
             default : $nsel=0;
            }
             }
        else $nsel=0;         
        if($nsel==0) {
        
         if(substr($field_name,0,4)!=’rate’ && $field_name!=”page” && $field_name!=”acount”)
          {
                        if(substr($field_name,0,3)==’pic’ || substr($field_name,0,4)==’logo’ || substr($field_name,0,4)==’file’)
           {
            if(isset($id) && $row->$field_name!=””){
          $folder_s = “news_update”;
          if($sel == 16) $folder_s = “banners”;
          if($sel == 17) $folder_s = “news_update”;
          $img_size = get_image_size1($folder_s.”/”.$row->$field_name,150,150);
          echo “<a href='”.$folder_s.”/”.$row->$field_name.”‘>
          <img src='”.$folder_s.”/”.$row->$field_name.”‘ $img_size border=0 />
          “.$row->$field_name.”</a>”;
          echo “<input type=’checkbox’ name='”.$field_name.”_del’>Устгах”;
                      }
                        echo “<input type=’file’ name='”.$field_name.”‘>”; 
         }
            else       
                        if(isset($id))createobject($field_name,”text”,$row->$field_name,”50″,0);                       
            else createobject($field_name,”text”,””,”50″,0);
          }
          }
        else {
         if( $nsel==3 || $nsel==2 ){
           if(isset($id)) echo $row->$field_name;
               }        
        } 
       
        break; }
   
   case “blob”  :{  if(isset($id)){         
         $body_1 = str_replace(“adminpage”,$SITE_DOMAIN.”/adminpage”,$row->$field_name); 
         echo “<textarea name=\”$field_name\” rows=\”25\” cols=\”72\” id=\”fulltext\” mce_editable=\”true\”>”.$body_1.”</textarea>\n”;
        }
         else         
         echo “<textarea name=\”$field_name\” rows=\”25\” cols=\”72\” id=\”fulltext\” mce_editable=\”true\”></textarea>\n”; 
      break;}
  case “datetime” :  if(isset($id) && $id!=0) {
                                      $date_arr=explode(” “,$row->ddate);
                                      $strdate=explode(“-“,$date_arr[0]);

                       echo “<input name=’kyear’ type=’text’ size=5 maxlength=’4′ value=’$strdate[0]’> он “;
                       echo “<input name=’kmonth’ type=’text’ size=2 maxlength=’2′ value=’$strdate[1]’> сар “;
           echo “<input name=’kday’ type=’text’ size=2 maxlength=’2′ value=’$strdate[2]’> єдєр “;
                     }
           else { $date=getdate();
               echo “<input name=’kyear’ type=’text’ size=5 maxlength=’4′ value='”.$date[‘year’].”‘> он “;
                  echo “<input name=’kmonth’ type=’text’ size=2 maxlength=’2′ value='”.$date[‘mon’].”‘> сар “;
         echo “<input name=’kday’ type=’text’ size=2 maxlength=’2′ value='”.$date[‘mday’].”‘> єдєр”;
             }
                      break;    
    } 
    ?> </td>
    </tr>
 <? }
 if($sel == 18 || $sel ==1 || $sel ==17){
 ?>
 <tr>
   <td bgcolor=”#FFFFFF”  colspan=”2″><strong>Хуудасны харагдах хэлбэрийг сонгоно уу</strong><br />
 <br>
 <?
  for($j=0; $j<=$page_type_len; $j++){
  if(!isset($id)){
   echo “<input type=’radio’ checked name=’page_type’ value = ‘”.$j.”‘>”;
   echo $page_type_mon[$j]; echo “<br>”; }
  else{
   $page_query1=mysql_query(“select page_type from $tbl_pref”.$admin[$sel].”
   where id =”.$id); 
   $page_fetch1=mysql_fetch_object($page_query1);
   echo “<input type=’radio’ “; if($j == $page_fetch1->page_type) echo ” checked “;  echo”name=’page_type’ value = ‘”.$j.”‘>”;
   echo $page_type_mon[$j]; echo”<br>”;
  }
  }
 ?> </td>
 </tr>
 <tr>
   <td colspan=”2″ bgcolor=”#FFFFFF”>Цэсний эрэмбэ<br> 
          <select name=”rang” >
            <option value=”0″ >Хамгийн эхэнд</option>
            <?
  $rang_table = “$tbl_pref”.$admin[$sel];
  $rang_where=” WHERE menu_menu=”.$menu_menu.” ORDER BY `rang`”;
  $rang_query=mysql_query(“select mnname,rang from $rang_table “.$rang_where); 
     while($rang_fetch=mysql_fetch_object($rang_query)){
 ?>
            <option value=”<?=$rang_fetch->rang+1?>” <? if(isset($id)){
   $rang_where01=” WHERE menu_menu=”.$menu_menu.” and id = $id”;
   $rang_query01=mysql_query(“select rang from $rang_table “.$rang_where01);
   $rang_fetch01=mysql_fetch_object($rang_query01);
   if($rang_fetch01->rang == $rang_fetch->rang) echo “selected”;}?>><? echo $rang_fetch->mnname; ?> -ийн ард</option>
            <? }
  ?>
      </select></td>
 </tr> 
 <? } ?>
    <tr bgcolor=”#FFFFFF”>
      <td height=”25″ colspan=”2″ align=”right”>
        <?
    if(isset($id)) $imgbtn=”../images/btn_update.jpg”;
  else $imgbtn=”../images/btn_insert.jpg”;
   ?>
   <? if(isset($menu_news_id)){?>
   <input type=”hidden” name=”menu_news_id” value=”<?=$menu_news_id?>”>
   <input type=”hidden” name=”m_t” value=”<?=$m_t?>” />
   <input type=”hidden” name=”sel_1″ value=”<?=$sel_1?>” />
   <? } ?>
   <? if(isset($sel_2)){?> <input type=”hidden” name=”sel_2″ value=”<?=$sel_2?>” /><? }?>
   <? if(isset($m_ta)){?> <input type=”hidden” name=”m_ta” value=”<?=$m_ta?>” /><? }?>
   <input type=”hidden” name=”folderid” value=”<?=$folderid?>”>
   <input type=”hidden” name=”sel1″ value=”<?=$sel1?>”>
   <input type=”hidden” name=”l_sel” value=”<?=$l_sel?>”>
   <input type=”hidden” name=”menu_menu” value=”<?=$menu_menu?>” />
   <input type=”hidden” name=”page_id” value=”<?=$page_id?>”>
  <? if(isset($page_type)){?> <input type=”hidden” name=”page_type” value=”<?=$page_type?>”><? }?>
   <? if(isset($opage_type)){?> <input type=”hidden” name=”opage_type” value=”<?=$opage_type?>”><? }?>
   <input type=”hidden” name=”group_id” value=”<?=$group_id?>”>
   <input type=”hidden” name=”menu_r” value=”<?=$menu_r?>”>
        <input type=”image” src=”<?=$imgbtn?>”>  </td>
    </tr>
  </form>
  <tr bgcolor=”#FFFFFF”>
    <td height=”22″ colspan=”2″ align=”center” valign=”bottom”><a href=”javascript: history.back()”><font color=’#666666’>буцах</font></a></tr>
</table>

No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: