<?
$UploadMax=26;

/////////////////////////////
//                         //
//   GOLDEN-TELNET V1.00   //
//   COPYRIGHT 2003        //
//   BY KHALED MAMDOUH     //
//   vbzoom@hotmail.com    //
//   www.hzoom.com         //
//   www.vbzoom.com        //
//   www.holy-book.com     //
//   All RIGHTS RESERVED   //
//                         //
/////////////////////////////

Echo "<TITLE> VBZooM Holy-Book - Powered by VBZooM.COM</TITLE>";

if ($REQUEST_METHOD=="POST" or $UploadNo!="")
{
	// الاتصال بقاعدة البانات
	include("../admin/config.php");
	$Connect =mysql_connect($DBHostName,$DBUserName,$DBPassword);
	$Select =mysql_select_db($DBName,$Connect);
	

	if($Select=="")
	{
	Echo "<TABLE border=0 Cellpadding=0 cellSpacing=0 width=100%><TD Align=middle bgcolor=000070 width=100%> <FONT face='Verdana' size=1 color=#ffffff> DATABASE ERROR. </TD></TABLE>";
	exit;
	}

@set_time_limit(10000);

function split_sql($sql)
{
    $sql = trim($sql);
    $sql = ereg_replace("#[^\n]*\n", "", $sql);
    $buffer = array();
    $ret = array();
    $in_string = false;

    for($i=0; $i<strlen($sql)-1; $i++)
    {
         if($sql[$i] == ";" && !$in_string)
        {
            $ret[] = substr($sql, 0, $i);
            $sql = substr($sql, $i + 1);
            $i = 0;
        }

        if($in_string && ($sql[$i] == $in_string) && $buffer[0] != "\\")
        {
             $in_string = false;
        }
        elseif(!$in_string && ($sql[$i] == "\"" || $sql[$i] == "'") && (!isset($buffer[0]) || $buffer[0] != "\\"))
        {
             $in_string = $sql[$i];
        }
        if(isset($buffer[1]))
        {
            $buffer[0] = $buffer[1];
        }
        $buffer[1] = $sql[$i];
     }

    if(!empty($sql))
    {
        $ret[] = $sql;
    }

    return($ret);
}

$sql_query = addslashes(fread(fopen("$UploadNo.sql", "r"), filesize("$UploadNo.sql")));

$pieces  = split_sql($sql_query);

for ($i=0; $i<count($pieces); $i++)
{
    $pieces[$i] = stripslashes(trim($pieces[$i]));
    if(!empty($pieces[$i]) && $pieces[$i] != "#")
    {
        $result = mysql_db_query ($DBName, $pieces[$i]);
    }
}


	if (file_exists("$UploadNo.sql"))
	{
	

			$Percent=ceil(100*$UploadNo/$UploadMax);

			Echo "<TABLE align=center border=0 Cellpadding=0 cellSpacing=0 bgcolor=#ffffff width=80%>";
			Echo "<TD Align=left width=100%>";

				Echo "<TABLE align=center border=0 Cellpadding=2 cellSpacing=0 bgcolor=#ffffff width=100%>";
				Echo "<TD Align=left width=100%>";
				Echo "<FONT face='Verdana' size=1> <b> $Percent% COMPLETE. FILE NO : $UploadNo <b>";
				Echo "</TD>";
				Echo "</table>";

				Echo "<TABLE border=0 Cellpadding=0 cellSpacing=1 bgcolor=#000000 width=100%>";
				Echo "<TD Align=left bgcolor=#ffffff width=100%>";
				Echo "<TABLE border=0 Cellpadding=0 cellSpacing=0 bgcolor=#000000 width=$Percent%><TD Align=left bgcolor=#ff0000 width=100% height=9></TD></table>";
				Echo "</TD>";
				Echo "</table>";

				Echo "<TABLE border=0 Cellpadding=1 cellSpacing=1 bgcolor=#ffffff width=100%>";
				Echo "<TD Align=left bgcolor=#ffffff width=50%>";
				Echo "<FONT face='Verdana' size=1> <b> 0% </b>";
				Echo "</TD>";

				Echo "<TD Align=right bgcolor=#ffffff width=50%>";
				Echo "<FONT face='Verdana' size=1> <b> 100% </b>";
				Echo "</TD>";
				Echo "</table>";

				Echo "<TABLE border=0 Cellpadding=0 cellSpacing=0 width=100%><TD Align=middle bgcolor=000070 width=100%> <FONT face='Verdana' size=1 color=#ffffff> Holy-Book V1.02 - COPYRIGHT © 2003 BY KHALED MAMDOUH.All rights reserved. <BR> POWERED BY: VBZooM V1.02 <a href='http://www.vbzoom.com' target=newframe>www.vbzoom.com</a> </TD></TABLE>";

			Echo "</TD>";
			Echo "</TABLE>";


			if ($UploadNo==$UploadMax) 
			{
			Echo "<BR><TABLE border=0 Cellpadding=0 cellSpacing=0 width=100%><TD Align=middle bgcolor=000070 width=100%> <FONT face='Verdana' size=1 color=#ffffff> 100% COMPLETE. </TD></TABLE>";
			exit;
			}

			$UploadNo=$UploadNo+1;
			Echo "<META HTTP-EQUIV='Refresh' Content='1;URL=index.php?UploadNo=$UploadNo'>";
			exit;

	
	}
	else
	{
	Echo "<TABLE border=0 Cellpadding=0 cellSpacing=0 width=100%><TD Align=middle bgcolor=000070 width=100%> <FONT face='Verdana' size=1 color=#ffffff> $UploadNo.sql FILE NOT FOUND. </TD></TABLE>";
	}

}
else
{
?>
<Body BGColor=3864d0 leftMargin=2 topMargin=2 marginheight=2 marginwidth=2><TABLE border=1 Cellpadding=3 cellSpacing=4 bordercolor=98cc00 bgcolor=98cc00 width=100%><TD Align=middle bgcolor=3864d0 width=100%>

<Form Name=Telnet method="POST" action='index.php'>

<Center>
<TABLE border=1 cellPadding=3 cellSpacing=3 bgcolor=#99aa99 bordercolor=blue width=100%>
<TD  BGCOLOR=98cc00 width=100%>
<FONT face='Verdana, Arial, Helvetica, sans-serif' color=#000070 size=2>
<b>Holy-Book V1.02</b>
</FONT>
</TD>
</TABLE>
</Center>

<Center>
<TABLE border=1 cellPadding=3 cellSpacing=3 bgcolor=#99aa99 bordercolor=blue width=100%>

<TD align=Left bgColor=#EDF7F0 width=30%>
<FONT face='Verdana, Arial, Helvetica, sans-serif' color=#000070 size=2>
<b>START FILE NO.</b>
</FONT>
</TD>


<TD align=left bgColor=#EDF7F0 width=30%>
<input type=text name=UploadNo value=1
</TD>

</TABLE>

<TABLE align=center border=1 cellPadding=3 cellSpacing=3 bgcolor=#99aa99 bordercolor=blue width=2%>
<TD Align=middle BGCOLOR=98cc00 width=100%>
<Input type='submit' Value='Install'>
</TD>
</TABLE>

</Form>

<FONT face='Fixedsys, ms sans serif, verdana' color=#d9ae2c size=1>
COPYRIGHT &copy; 2003 BY KHALED MAMDOUH AHMED 
<FONT face='Fixedsys, ms sans serif, verdana' color=Yellow size=1>
www.vbzoom.com
</FONT>


<?

}
?>





