Location: PHPKode > scripts > Linker IMG > linker-img/install/step3.php
<?php

function get_perms($file) {
   $p_bin = substr(decbin(@fileperms($file)), -9) ;
   $p_arr = explode(".", substr(chunk_split($p_bin, 1,"."), 0, 17)) ;
   $perms = ""; $i = 0;
   foreach ($p_arr as $this) { 
      $p_char = ( $i%3==0 ? "r" : ( $i%3==1 ? "w" :"x" ) ); 
      $perms .= ( $this=="1" ? $p_char : "-" ) . ($i%3==2 ? " " : "" );
      $i++;
   }
   return trim($perms);
}

if (!$db_host) $errcode .= "<li>Fill DB HOST field</li>\n";
if (!$db_name) $errcode .= "<li>Fill DB NAME field</li>\n";
if (!$db_user) $errcode .= "<li>Fill DB USER field</li>\n";
if (!$db_pass) $errcode .= "<li>Fill DB PASS field</li>\n";
if (!$db_type) $errcode .= "<li>Fill DB TYPE field</li>\n";
if (!$admin_id) $errcode .= "<li>Fill Admin ID field</li>\n";
if (!$admin_pass) $errcode .= "<li>Fill Admin Pass field</li>\n";
if (!$admin_email) $errcode .= "<li>Fill Admin email field</li>\n";
if (!$site_path) $errcode .= "<li>Fill Site path field</li>\n";
if (!$language) $errcode .= "<li>Select Language field</li>\n";

if (get_perms("../function/base_info.php") <> "rw- rw- rw-") 
$errcode .="<li>base_info.php file must have 666 permittion</li>\n";

if (file_exists("../function/{$db_type}.php")) 
include "../function/{$db_type}.php";

$db = new DB_Sql($db_host,$db_user,$db_pass,$db_name);
$db->DBconnect();
if (!$db->Connect) $errcode .= "<li>Cannot connect Database</li>\n";
if (!$db->ReSelect) $errcode .= "<li>Incorrct or non exist db name</li>\n";

//=====================================
// Error Code
//=====================================


if ($errcode) {

$table_content = <<<EOF

<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td height="25" colspan="2" bgcolor="#E0E0E0" align="center">	<font size="2" color=red><b>ERROR !!</b></font></td>
</tr>

<tr>
<td height=100><font size=2><b><ul>$errcode</ul></b></td>
</tr>

<tr>
<td height="30" colspan="2" bgcolor="#E0E0E0" valign="bottom" align="center">&nbsp;
<input type="button" value=" << BACK " style="background-color:rgb(255,255,223);" onClick="history.back()"></td>
</tr>

</table>

EOF;
}


//=====================================
// Step3 output
//=====================================

else {

$db->query("drop table LINKER_CAT");
$db->query("drop table LINKER_LINK");
$db->query("drop table LINKER_COM");
$db->query("drop table LINKER_WAIT");
$db->query("drop table LINKER_TWORD");
$db->query("drop table LINKER_MAIL");

$dump = @file("linker.sql");
$count = count($dump);

for ($i=0 ;$i<$count ;$i++) {

	if (!trim($dump[$i])) continue;
	if (ereg("^#",$dump[$i])) continue;
	$content .= str_replace(";","",$dump[$i]);

	if (ereg(";$",trim($dump[$i]))) {
	$db->query($content);
	$content = "";
	}
}


include ("../function/base_info.php"); 
//echo $Sdb_host;exit;
// set_base.php content
$config = <<<EOF
<?

\$Sdb_host = "$db_host";
\$Sdb_user = "$db_user"; 
\$Sdb_pass = "$db_pass"; 
\$Sselect_db = "$db_name";
\$Sdb_type =  "$db_type";
\$Stemplate = "$Stemplate";
\$Slang = "$language";
\$Sadmin_mail = "$admin_email";
\$Ssite_name = "$Ssite_name";
\$Sdomain = "$site_path";
\$Scool_num = "$Scool_num";
\$Scool_aver = "$Scool_aver";
\$Spagecut = "$Spagecut";
\$Smain_col = "$Smain_col";
\$Ssub_col = "$Ssub_col";
\$Salign = "$Salign";
\$Smain_width = "$Smain_width";
\$Smain_sub_num = "$Smain_sub_num";
\$Sdirectcut = "$Sdirectcut";
\$Ssepchar = "|O|";
\$Sarrow = "$Sarrow";
\$Sbgcolor = "$Sbgcolor";
\$Snail_width = "$Snail_width";
\$Snail_height = "$Snail_height";
\$Snail_row = "$Snail_row";
\$Snewdate = "$Snewdate";
\$Stopkword = "$Stopkword";
\$Scooklimit = "$Scooklimit";
\$Saddtype = "$Saddtype";
\$Sfupload = "1";
\$Sfmaillist = "$Sfmaillist";
\$Stkword = "$Stkword";
\$Snewimg = "$Snewimg";
\$Sfupext = "$Sfupext";
\$Sorderpick = "$Sorderpick";
\$Ssort = "$Ssort";
\$Sorder = "$Sorder";
\$Stime = "N";
\$Streetype = "$Streetype";
\$Sversion = "$Sversion";

?>
EOF;

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


$admin_id = md5($admin_id);
$admin_pass = md5($admin_pass);

$config2 = <<<EOF
<?

\$Sadmin_id = "$admin_id";
\$Sadmin_pass = "$admin_pass";

?>
EOF;


$fp=@fopen("../function/pass_info.php",w);
@fputs($fp,$config2);
@fclose($fp);

// regist
$site_name = urlencode($Ssite_name);
$Sversion = urlencode($Sversion);

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



$table_content = <<<EOF

	<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
	<tr>
	<td height="25" bgcolor="#E0E0E0" align="center">	<font size="2"><b>Installation completed</b></font></td>
	</tr>

	<tr><td height=1 bgcolor=gray></td></tr>

	<tr>
	<td height="100" bgcolor="#F6F6F6"><font size=2><ul>
	<li>You can set miscellaneous things in Admin mode</li>
	<li>Delete install directory and all files</li>
	</ul></font></td>
	</tr>

	<tr><td height=1 bgcolor=gray></td></tr>
	

	</table>

EOF;

}




print <<<EOF

<html>
<head>
<title>LINKER INSTALL</title>
</head>

<body bgcolor="#F6F6F6" leftmargin="0" marginwidth="0" topmargin="0" marginheight="0">

<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%">
<tr>
<td height="75" bgcolor="#E0E0E0" align="center"><img src="image/title.gif" border="0"></td>
</tr>

<tr>
<td bgcolor="black"><font color="white" size=2 face="Arial"><b>&nbsp;&nbsp;INSTALL &gt;&gt; STEP 3</b></font></td>
</tr>

<tr>
<td bgcolor="#F6F6F6"  valign=top>

<br><br><br><br>

<table width="500" cellspacing="0" cellpadding="0" border="0" align=center>
<tr>
<td align="left" valign=top width="11"><img src="image/ul.gif" width="11" height="11" border="0"></td>
<td bgcolor="#E0E0E0" width=100%><img src="image/x1.gif"></td>
<td align="right" valign=top width="11"><img src="image/ur.gif" width="11" height="11" border="0"></td>
</tr>

<tr>
<td bgcolor="#E0E0E0" width="11"><img src="image/x1.gif"></td>
<td bgcolor="#E0E0E0">

<!-- Start content -->
$table_content


</td>

<td bgcolor="#E0E0E0" width="11"><img src="image/x1.gif"></td>
</tr>

<tr>
<td align="left" valign=bottom width="11"><img src="image/dl.gif" width="11" height="11" border="0"></td>
<td bgcolor="#E0E0E0"><img src="image/x1.gif"></td>
<td align="right" valign=bottom width="11"><img src="image/dr.gif" width="11" height="11" border="0"></td>
</tr>

</table>


</td></tr></table>

</body></html>

EOF;

?>
Return current item: Linker IMG