Location: PHPKode > scripts > Linker IMG > linker-img/manage/set_base.php
<?php

//=====================================
// LINKER Category Engine
//=====================================
// Filename : set_base.php
// Path  : Manage directory
// last update : 2002/07/13
// Desc : Base info file modify
//=====================================

//=====================================
// File include part
//=====================================

include ("./authen.php");
include ("../function/main_func.php");
include ("../function/userfield_info.php"); 
include ("../$Slang/m_common.php"); 

//=====================================
// Print Form parts
//=====================================



if (!$switch) { 

switch ($Ssort) 
{
    case "title": $so1="selected";	break;
    case "url": $so2="selected";	break;
    case "name": $so3="selected";	break;
    case "email": $so4="selected";	break;
    case "scont": $so5="selected";	break;
    case "count": $so6="selected";	break;
    case "uptime": $so8="selected";	break;
    case "user1": $so9="selected";	break;
    case "user2": $so10="selected";	break;
    case "user3": $so11="selected";	break;
    case "user4": $so12="selected";	break;
    case "user5": $so13="selected";	break;
    default: $sort1="selected";
}

switch ($Sorder) 
{
    case "asc" : $or1="selected";
	break;
    case "desc": $or2="selected";
	break;
    default: $or1="selected";
}


// Add tyoe
if ($Saddtype) $op_addtype1 = "selected";
else $op_addtype2 = "selected";

// Pinrt established time
if ($Stime == "Y")  $op_time1 = "selected";
else $op_time2 = "selected";

// Maillig list func
if ($Sfmaillist) $op_mail1 = "selected";
else $op_mail2 = "selected";

// Main page top search keyword print
if ($Stkword) $op_tkword1 = "selected";
else $op_tkword2 = "selected";

// Main page new img
if ($Snewimg) $op_newimg1 = "selected";
else $op_newimg2 = "selected";

// pre order pick
if ($Sorderpick) $op_orderpick1 = "selected";
else $op_orderpick2 = "selected";

// Tree type
if ($Streetype == "java") $op_javatree = "selected";
else $op_nomaltree = "selected";

// template config
$handle = opendir("../template");
while ($dirname = readdir($handle)){

	if ($dirname <> "." && $dirname <> ".." && is_dir("../template/$dirname")) {
	$full_path = "template/" . $dirname;
	if ($full_path == $Stemplate) 
	$template_op .= "<option value='$full_path' selected>$dirname</option>\n";
	else
	$template_op .= "<option value='$full_path'>$dirname</option>\n";
	
	
	}
}
closedir($handle); 


// Language Select

$handle = opendir("../lang");
while ($dirname = readdir($handle)){

	if ($dirname <> "." && $dirname <> ".." && is_dir("../lang/$dirname")) {
	$full_path = "lang/" . $dirname;
	if ($full_path == $Slang) 
	$lang_op .= "<option value='$full_path' selected>" . ucfirst($dirname) . "</option>\n";
	else
	$lang_op .= "<option value='$full_path'>" . ucfirst($dirname) . "</option>\n";
	
	
	}
}
closedir($handle); 

//=======================================

print <<<EOF

<html>
<head>
<LINK rel='stylesheet' type='text/css' href='./linker.css'>
<meta http-equiv='Content-Type' content='text/html; charset=$Scharset'>
</head>

<body bgcolor="#E9E9E9" text='black' link='blue' vlink='purple' alink='red'>
<form action='set_base.php' method='post' name='myform'>
<input type="hidden" name="switch" value="conf">

<div align='left'>
<table border=0 cellpadding=0 cellspacing=1>
<tr>
<td colspan=2>

	<table width="100%" border="1"><tr><td bgcolor="#000066" align="center">
	<b><font color="white" size="2">$l_config_base</font></b>
	</td></tr></table>

</td>	</tr>

<tr><td colspan=2 width=500>&nbsp;</td></tr>



<tr>
<td height='20' colspan='2' bgcolor='#E0E0E0'>&nbsp;<font  size='2'><b>$l_database_set</b></font></td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_db_host</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<input type='text' class=input  name='db_host' value="$Sdb_host"> </td>

</tr>
<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_db_user</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<input type='text' class=input  name='db_user' value='$Sdb_user'></td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_db_pass</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<input type='password'  class=input name='db_pass' value='$Sdb_pass'></td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_db_name</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<input type='text' class=input  name='select_db' value='$Sselect_db'></td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_db_type</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<input type='text' class=input  name='db_type' value='$Sdb_type'></td>
</tr>

<tr><td colspan=2 width=500>&nbsp;</td></tr>

<!-- Site Configuration -->


<tr>
<td height='20' colspan='2' bgcolor='#E0E0E0'>&nbsp;<font  size='2'><b>$l_site_set</b></font></td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_site_name</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<input type='text' class=input  name='site_name' value='$Ssite_name' size='30'></td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_site_align</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<input type='text' class=input  name='align' value='$Salign' size='30'></td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_site_width</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<input type='text' class=input  name='main_width' value='$Smain_width'></td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_site_color</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<input type='text' class=input  name='bgcolor' value='$Sbgcolor'></td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_thumb_width</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<input type='text' class=input  name='nail_width' value='$Snail_width'></td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_thumb_height</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<input type='text' class=input  name='nail_height' value='$Snail_height'></td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_thumb_nailrow</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<input type='text' class=input  name='nail_row' value='$Snail_row'></td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_admin_mail</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<input type='text' class=input  name='admin_mail' value='$Sadmin_mail' size='30'></td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_site_path </font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<input type='text' class=input  name='domain' value='$Sdomain' size='30'></td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_site_template</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<font size=2><select name='template'>
$template_op
</select></font></td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_site_lang</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<font size=2><select name='lang'>
$lang_op
</select></font></td>
</tr>

<tr><td colspan=2 width=500>&nbsp;</td></tr>
<!-- E.T.C Configuration -->


<tr>
<td height='20' colspan='2' bgcolor='#E0E0E0'>&nbsp;<font  size='2'><b>$l_etc_func</b></font></td>
</tr>


<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_etc_add</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<font size=2><select name='addtype'>
<option value='1' $op_addtype1>$l_etc_addauth_yes</option>
<option value='0' $op_addtype2>$l_etc_addauth_no</option></select></font></td>
</tr>


<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_upfile_txt</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<font size=2><input type='text' class=input  name='fupext' value='$Sfupext' size='20'></td>
</tr>


<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_mailing_func</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<font size=2><select name='fmaillist'>
<option value=1 $op_mail1 >$l_user_yes</option>
<option value=0 $op_mail2 >$l_user_no</option></select></font>
</td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_tkword_func</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<font size=2><select name='ftkword'>
<option value=1 $op_tkword1 >$l_user_yes</option>
<option value=0 $op_tkword2 >$l_user_no</option></select></font>
</td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_recent</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<font size=2><select name='fnewimg'>
<option value=1 $op_newimg1 >$l_user_yes</option>
<option value=0 $op_newimg2 >$l_user_no</option></select></font>
</td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_pick_pre</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<font size=2><select name='orderpick'>
<option value=1 $op_orderpick1 >$l_user_yes</option>
<option value=0 $op_orderpick2 >$l_user_no</option></select></font>
</td>
</tr>

<!--

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_est_time</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<font size=2><select name='time'>
<option value="N" $op_time2>$l_user_no</option>
<option value="Y" $op_time1>$l_user_yes</option></select></font>
</td>
</tr>

-->

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_cat_tree</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<font size=2><select name='treetype'>
<option value="java" $op_javatree>$l_java_tree</option>
<option value="nomal" $op_nomaltree>$l_nomal_tree</option></select></font>
</td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_sort_order</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<font size=2><select name='sort'>
<option value='title' $so1>$l_title</option>
<option value='url' $so2>$l_source</option>
<option value='name' $so3>$l_name</option>
<option value='email' $so4>$l_email</option>
<option value='scont' $so5>$l_scont</option>
<option value='count' $so6>$l_count</option>
<option value='uptime' $so8>$l_uptime</option>

EOF;


for ($i=1,$k=9;$i<=5 ;$i++,$k++) {
$u_name = ${"u_user" . $i};
$u_select = ${"so" . $k};
$u_fname = "user". $i;

if($u_name) echo "<option value='$u_fname' $u_select>$u_name</option>\n";
}



print <<<EOF


</select>
<select name='order'>
<option value='asc' $or1>$l_asc_order</option>
<option value='desc' $or2>$l_desc_order</option></select></font>
</td>
</tr>

<tr><td colspan=2 width=500>&nbsp;</td></tr>
<!-- E.T.C Configuration -->


<tr>
<td height='20' colspan='2' bgcolor='#E0E0E0'>&nbsp;<font  size='2'><b>$l_etc_config</b></font></td>
</tr>



<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_main_cat_column</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<input type='text' class=input  name='main_col' value='$Smain_col' size='5'></td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_sub_cat_column</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<input type='text' class=input  name='sub_col' value='$Ssub_col' size='5'></td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_cat_subnum</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<input type='text' class=input  name='main_sub_num' value='$Smain_sub_num' size='5'></td>
</tr>


<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_cool $l_count </font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<input type='text' class=input  name='cool_num' value='$Scool_num' size='5'></td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_cool $l_vote_ave</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<input type='text' class=input  name='cool_aver' value='$Scool_aver' size='5'></td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_page_num</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<input type='text' class=input  name='pagecut' value='$Spagecut' size='5'></td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_page_cut</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<input type='text' class=input  name='directcut' value='$Sdirectcut' size='5'></td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_new_before</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<input type='text' class=input  name='newdate' value='$Snewdate' size='5'></td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_keyword_num</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<input type='text' class=input  name='topkword' value='$Stopkword' size='5'></td>
</tr>


<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_sep_cat </font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<input type='text' class=input  name='arrow' value='$Sarrow' size='5'></td>
</tr>

<tr>
<td width='150' bgcolor='#F6F6F6'><font size='2'>&nbsp;$l_cook_limit</font></td>
<td width='350' bgcolor='#F6F6F6'>&nbsp;<input type='text' class=input  name='cooklimit' value='$Scooklimit' size='10'><font size=2>$l_sec &nbsp;&nbsp;$l_cook_txt </font></td>
</tr>

<tr bgcolor='#E0E0E0'>
<td colspan='3' align=center>
<input type='submit' value=' $l_submit ' class=cinput>
<input type='reset' value=' $l_reset ' class=cinput></td>
</tr>
</table></div></form>

<br><br>
</body>
</html>   
EOF;

}

//=====================================
// Write set_base.php
//=====================================
if ($switch=="conf") {

/*
while (list($key,$val) = each($HTTP_POST_VARS)) 
$$key = trim($val);
*/

// set_base.php content

$config = <<<EOF
<?

\$Sdb_host = "$db_host";
\$Sdb_user = "$db_user"; 
\$Sdb_pass = "$db_pass"; 
\$Sselect_db = "$select_db";
\$Sdb_type =  "$db_type";
\$Stemplate = "$template";
\$Slang = "$lang";
\$Sadmin_mail = "$admin_mail";
\$Ssite_name = "$site_name";
\$Sdomain = "$domain";
\$Scool_num = "$cool_num";
\$Scool_aver = "$cool_aver";
\$Spagecut = "$pagecut";
\$Smain_col = "$main_col";
\$Ssub_col = "$sub_col";
\$Salign = "$align";
\$Smain_width = "$main_width";
\$Smain_sub_num = "$main_sub_num";
\$Sdirectcut = "$directcut";
\$Ssepchar = "|O|";
\$Sarrow = "$arrow";
\$Sbgcolor = "$bgcolor";
\$Snail_width = "$nail_width";
\$Snail_height = "$nail_height";
\$Snail_row = "$nail_row";
\$Snewdate = "$newdate";
\$Stopkword = "$topkword";
\$Scooklimit = "$cooklimit";
\$Saddtype = "$addtype";
\$Sfupload = "1";
\$Sfmaillist = "$fmaillist";
\$Stkword = "$ftkword";
\$Snewimg = "$fnewimg";
\$Sfupext = "$fupext";
\$Sorderpick = "$orderpick";
\$Ssort = "$sort";
\$Sorder = "$order";
\$Stime = "N";
\$Streetype = "$treetype";
\$Sversion = "$Sversion";


?>
EOF;

//echo $config;exit;

$fp=fopen("../function/base_info.php",w);
fputs($fp,$config);
fclose($fp);

// Registration
$site_name = urlencode($site_name);
$Sversion = urlencode($Sversion);
@fopen("http://product.codelib.co.kr/enregist.php?site_path=$domain&site_name=$site_name&site_admin=$admin_mail&version=$Sversion","r");

echo("<meta http-equiv='refresh' content='0; url=set_base.php'>");
}

?>
Return current item: Linker IMG