<?php
error_reporting(0);
	include_once("../includes/config.php");
	
	
	
	$upgraded = false;
	
	
/*-----------Database Settings--------------*/
	
	$txtDBServerName = $glb_dbhost;
	$txtDBName       = $glb_dbname;
	$txtDBUserName 	 = $glb_dbuser;
	$txtDBPassword 	 = $glb_dbpass;
	$txtDBPrefix 	 = "";
        $message         = "";
//	$txtRootServer   = $rootserver;
//	$txtServer       = SITE_URL;
//	$txtSecureServer = SECURE_SITE_URL;
//	$sellerFriendly=enable_seller_friendly;

        
	




	$display_button = "";	
	
	if(isset($_POST['submit']))
	{
	
        				
		/*---------Datbase Connection Details--------------*/	
			$connection = @mysql_connect($txtDBServerName, $txtDBUserName, $txtDBPassword);
		
			
		
			if($connection === false)
			{
				$error = true;
				$message .= " * Connection Not Successful! Please verify your database details!<br><br>";
			}
			else
			{
				$dbselected = @mysql_select_db($txtDBName, $connection);
				
				if (!$dbselected)
				{
					$error = true;
					$message .= " * Database could not be selected! Please verify your database details!<br><br>";
				}
				
			}
					
			 if($error)
			 {
				$message = "<u><b>Please correct the following errors to continue:</b></u>" . "<br><br>" . $message;
				
				//echo $message;
			
			 }
			 else
			 {
			 		//store config file details
                             $sql= "CREATE TABLE IF NOT EXISTS `tbl_cms` (
                                      `page` varchar(250) NOT NULL,
                                      `cmsContent` text NOT NULL,
                                      PRIMARY KEY  (`page`)
                                    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;";
                             mysql_query($sql);

                             $result=mysql_query("SELECT COALESCE(COUNT(*),0) FROM `tbl_cms` WHERE `page`='main'");
                             $rowResult=mysql_fetch_row($result);
                             if($rowResult[0]==0)
                             {
                                 //CMS INSERT
                                $mainContent = 'a:3:{s:11:"mainContent";s:332:"<html>\r\n	<head>\r\n		<title></title>\r\n	</head>\r\n	<body>\r\n		<div class="cnt">\r\n			Easycreate site builder is packed with features designed to save your time. Just select one of our pre-designed templates then pick your custom color scheme , add your text, upload your own images.You have done with your site.</div>\r\n	</body>\r\n</html>\r\n";s:9:"mainTitle";s:45:"Easycreate is an easy website creation center";s:10:"startPrice";s:4:"$150";}';
                                $homeContent = 'a:5:{s:11:"mainContent";s:91:"<html>\r\n	<head>\r\n		<title></title>\r\n	</head>\r\n	<body>\r\n		<p>\r\n			3</p>\r\n	</body>\r\n</html>\r\n";s:9:"mainTitle";s:1:"1";s:10:"startPrice";s:1:"2";s:11:"homeContent";s:699:"<html>\r\n	<head>\r\n		<title></title>\r\n	</head>\r\n	<body>\r\n		<p>\r\n			Easycreate is an easy website creation center. Easycreate lets you build your websites from scratch or edit an existing web site quickly and easily.<br />\r\n			<br />\r\n			Easycreate site builder is packed with features designed to save your time. Just select one of our pre-designed templates then pick your custom color scheme , add your text, upload your own images.You have done with your site. It is that easy.<br />\r\n			<br />\r\n			Take complete control of your website. Make changes, add pages, do whatever you want whenever you want to. You can do it anytime, from any computer connected to the Internet.</p>\r\n	</body>\r\n</html>\r\n";s:9:"homeTitle";s:21:"Welcome to Easycreate";}';
                                $termsContent = 'a:5:{s:11:"mainContent";s:91:"<html>\r\n	<head>\r\n		<title></title>\r\n	</head>\r\n	<body>\r\n		<p>\r\n			3</p>\r\n	</body>\r\n</html>\r\n";s:9:"mainTitle";s:1:"1";s:10:"startPrice";s:1:"2";s:12:"termsContent";s:1235:"<html>\r\n	<head>\r\n		<title></title>\r\n	</head>\r\n	<body>\r\n		<div align="justify">\r\n			<strong>We prohibit the posting of the following content in any member account:</strong></div>\r\n		<ul>\r\n			<li>\r\n				<div align="justify">\r\n					Nudity, pornography, and sexual material of a lewd, lecherous or obscene nature or intent or that violates local, state or national laws.</div>\r\n			</li>\r\n			<li>\r\n				<div align="justify">\r\n					Any material that violates or infringes in any way upon the proprietary rights of others including, without limitation, copyright or trademark rights.</div>\r\n			</li>\r\n			<li>\r\n				<div align="justify">\r\n					Any material that is threatening, abusive, harassing, slanderous, defamatory, invasive of privacy or publicity rights, vulgar, obscene, profane, indecent, or otherwise objectionable including posting private information belonging to or about other individuals.</div>\r\n			</li>\r\n			<li>\r\n				<div align="justify">\r\n					Content that promotes, encourages, or provides instructional information about illegal activities.</div>\r\n			</li>\r\n			<li>\r\n				<div align="justify">\r\n					Hate propaganda or hate mongering, swearing, or fraudulent material or activity.</div>\r\n			</li>\r\n		</ul>\r\n	</body>\r\n</html>\r\n";s:10:"termsTitle";s:5:"Terms";}';
                                $cmsData1 = "INSERT INTO tbl_cms SET page = 'main', cmsContent = '" . addslashes($mainContent) .  "'";
                                $cmsData2 = "INSERT INTO tbl_cms SET page = 'home', cmsContent = '" . addslashes($homeContent) .  "'";
                                $cmsData3 = "INSERT INTO tbl_cms SET page = 'terms', cmsContent = '" . addslashes($termsContent) .  "'";
                                mysql_query($cmsData1);
                                mysql_query($cmsData2);
                                mysql_query($cmsData3);
                             }


                             $result=mysql_query("SELECT COALESCE(COUNT(*),0) FROM `tbl_lookup` WHERE `vname`='rootpath'");
                             $rowResult=mysql_fetch_row($result);
                             if($rowResult[0]==0)
                             {
                             //setting default permissions
                                $defaultPermisson           = '0777';
                                //checking whether it is a server with CGI SERVER API
                                $sapiName = "_" . php_sapi_name();
                                if(stripos($sapiName, 'cgi') > 0) {
                                    //its CGI
                                    $defaultPermisson           = 0755;

                                }
                                $currentWorkingDIR = getcwd();
                                $installPath = substr($currentWorkingDIR, 0, strripos($currentWorkingDIR, 'upgrade2.0'));
                                $sql= "INSERT INTO `tbl_lookup` (`vname`, `vvalue`) VALUES ('theme', 'Coastal-Green');";
                                mysql_query($sql);
                                $sql= "INSERT INTO `tbl_lookup` (`vname`, `vvalue`) VALUES ('rootpath', '".addslashes($installPath)."');";
                                mysql_query($sql);
                                $sql= "INSERT INTO `tbl_lookup` (`vname`, `vvalue`) VALUES ('serverPermission', '$defaultPermisson')";
                                mysql_query($sql);
                             }

			 }
		
	
	}






?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<link href="style.css" rel="stylesheet" type="text/css">
<script>
function DisplayHtAccessDiv()
{

	if(document.frmUpgradation.sellerFriendly.checked)
	{
		document.getElementById("htaccessDiv").style.display = "";
		document.getElementById("htaccessDivMsg").style.display = "";
	}
	else
	{
		document.getElementById("htaccessDiv").style.display = "none";
		document.getElementById("htaccessDivMsg").style.display = "none";
	}	

}
</script>

	<body>

	<center>

	<div align="left" id="layout">
	
		<div align="left" id="header">
		<!--header area start -->
				
				<div align="left" id="logo"><img src="images/logotrans.gif" alt=""  border="0" /></div>
				
				
                               
		<!--header area end -->
		</div>
		
		
		<div align="left" class="main_body">
			<!--mainbody area start -->
			
			
			<div align="left" id="item_details">
	
	
			<!--items display area start -->
		
			<div align="left" id="items_top_area">
					<img src="images/top_title_left.gif" alt="" class="items_top_area_img" />
					<div align="left" id="items_top_area_ttl">EasyCreate 3.0 Upgrade</div>
					<img src="images/top_title_right.gif" alt="" class="items_top_area_img" />&nbsp;&nbsp;
					<a title="If you have any difficulty, submit a ticket to the support department" href="#" onClick="window.open('http://www.iscripts.com/support/postticketbeforeregister.php','','top=100,left=100,width=820,height=550,scrollbars=yes,toolbar=no,status=yrd,resizable=yes');">														
						<strong>Get Support</strong>
					</a>
			</div>
			
			<div>&nbsp;</div>
			
					
		
			<div>

			<form name="frmUpgradation" method="post" action="#">
					<table cellpadding="0" cellspacing="0" width="100%">
					<tr>
						<td align="center" class="text_information"><?php echo $message?></td>
					</tr>
<?php

	if(!$upgraded)
	{
	
?>					
					
					<tr>
						<td align="center" valign="top" >
						<b><font size="1">
						<div align="justify" >
						<br>
							<font color="#F4700E" size="+1">Thank you for purchasing the upgrade kit of EasyCreate 3.0</font> <br><br>
							<div id="htaccessDiv" style="display:none">
							
							&nbsp;&nbsp;&nbsp;&nbsp;<img src="../images/install_steps.jpg"> Change the permission (chmod) of '.htaccess' file to 777. <br><br>
							
							</div>
					
						</div>
		
						</font></b>
						</td>
					</tr>
										<tr>
											<td>
												<FIELDSET>
														<LEGEND class="block_class">Upgradation Instructions</LEGEND>
														<br />
														<table width="100%" border="0" cellpadding="0" cellspacing="0">
														<tr>
															<td colspan="3" class="maintext"><font class="required">*</font>&nbsp;Make sure that you have done the following things before pressing the 'Upgrade' button</td>
														</tr>
														<tr>
															<td colspan="3">&nbsp;</td>
														</tr>
														<tr>
															<td colspan="2">&nbsp;</td>
															<td class="maintext"><img src="images/arrow1.gif" />&nbsp;Take the backup of the existing EasyCreate files and folders!! </td>
														</tr>
														<tr>
															<td colspan="3">&nbsp;</td>
														</tr>
														<tr>
															<td colspan="2">&nbsp;</td>
															<td class="maintext"><img src="images/arrow1.gif" />&nbsp;Take the backup of the existing EasyCreate Database !! </td>
														</tr>
														<tr>
															<td colspan="3">&nbsp;</td>
														</tr>
														<tr>
														  <td colspan="2">&nbsp;</td>
														  <td ><img src="images/arrow1.gif" />Change the permission (<b><font size="1"><font color="#000000">chmod 777 for linux server</font></font></b>) of 'includes/configsettings.php' to 777. <br />
													      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(After installation dont forget to change it back to 644)</td>
														  </tr>
														<tr>
														  <td colspan="2">&nbsp;</td>
														  <td class="maintext">&nbsp;</td>
														  </tr>
														  <tr>
														  <td colspan="2">&nbsp;</td>
														  <td ><img src="images/arrow1.gif" />Change the permission (<b><font size="1"><font color="#000000">chmod 777 for linux server</font></font></b>) of 'api/useradd.php' folder to 777. <br />
													      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
														  </tr>
														<tr>
														  <td colspan="2">&nbsp;</td>
														  <td class="maintext"><img src="images/arrow1.gif" />Change the permission (<b><font size="1"><font color="#000000">chmod 777 for linux server</font></font></b>) of 'api/server_class.php' folder to 777. </td>
														  </tr>
														    <tr>
														  <td colspan="2">&nbsp;</td>
														  <td ><img src="images/arrow1.gif" />Change the permission (<b><font size="1"><font color="#000000">chmod 777 for linux server</font></font></b>) of 'gc/googlemessage.log' folder to 777. <br />
													      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
														  </tr>
                                                                                                                  <tr>
														  <td colspan="2">&nbsp;</td>
														  <td class="maintext"><img src="images/arrow1.gif" alt=""/>Change the permission (<b><font size="1"><font color="#000000">chmod 777 for linux server</font></font></b>) of 'categories/avatar' folder to 777. </td>
														  </tr>
														  <tr>
														  <td colspan="2">&nbsp;</td>
														  <td class="maintext">&nbsp;</td>
														  </tr>
														<tr>
															<td colspan="2">&nbsp;</td>
															<td class="maintext"><img src="images/arrow1.gif" />&nbsp;Once it is done press the 'Upgrade' button to start the upgradation procedure...</td>
														</tr>
														
														<tr>
															<td colspan="3">&nbsp;</td>
														</tr>
														<tr>
															<td colspan="2">&nbsp;</td>
															<td class="maintext"><img src="images/arrow1.gif" />&nbsp;When the upgradation procedure is completed successfully <br />&nbsp;&nbsp;&nbsp;cross check your existing files and database with the upgraded one</td>
														</tr>
														</table>
														<br />
											  </FIELDSET>
												</td>
											</tr>
											<tr>
												<td>&nbsp;</td>
											</tr>
											<tr>
												<td>
													<div id="upgradeButton" style="display:<?php echo $display_button?>">
														<table cellspacing="0" cellpadding="0" width="100%">
															<tr>
																<td align="center"><input type="submit" class="button" name="submit" value="Upgrade"></td>
															</tr>
														</table>	
													</div>
												</td>
											</tr>
											<tr>
												<td>&nbsp;</td>
											</tr>
<?php

	}
	else
	{
	
?>
			<tr>
				<td align="center"><font color="#F4700E" size="+1">EasyCreate 3.0 Upgradation Is Completed Successfully !!</font></td>
			</tr>
			<tr>
				<td>&nbsp;</td>
			</tr>
			<tr>
				<td>
					<fieldset>
						<legend class="block_class">Site Login Details</legend>
							<table cellpadding="0" cellspacing="0" width="100%">
							<tr>
								<td colspan="2">&nbsp;</td>
							</tr>
							<tr>
								<td width="15%"><b><font size="-1">Admin URL&nbsp;:</font></b></td>
								<td width="85%"><a style="cursor:pointer" href="<?php echo $txtRootServer?>/admin/login.php"><?php echo $txtRootServer?>/admin/login.php&nbsp;<img src="../images/admin_login_install.jpg" border="0" height="25"></a></td>
							</tr>
						
							<tr>
								<td colspan="2">&nbsp;</td>
							</tr>
							<tr>
								<td width="15%"><b><font size="-1">Home URL&nbsp;:</font></b></td>
								<td width="85%"><a style="cursor:pointer" href="<?php echo $txtRootServer?>/index.php"><?php echo $txtRootServer?>/index.php&nbsp;<img src="../images/home_page.jpg" border="0" height="25"></a></td>
							</tr>
							
							</table>
						</fieldset>	
				</td>
			</tr>
			
<?php

	}

?>
			</table>
			
			</form>					
		
	
	
			</div>	
			
			
			
			
			
			
	
	
		<div align="left" class="float_clear1"></div>
					
					
		 <!--items display area end -->
		  </div>
		
			
		<!--center content area end-->	


		<div align="left" class="float_clear"><img src="images/clear.gif" alt="" width="1" height="1" /></div>		
		<!--mainbody area end -->
        </div>
		<div align="left" class="float_clear"><img src="images/clear.gif" alt="" width="1" height="1" /></div>


<!----Footer Area Starts----------------->

<div align="left" class="float_clear"><img src="images/clear.gif" alt="" width="1" height="1" /></div>
		
		<div align="left" class="copyright_area">
		<!--copyright area start -->
		
				<div align="left" id="copyright_lft">
<!--				
				<a href="javascript:;">Privacy Statement</a> &nbsp;|&nbsp;
				  <a href="javascript:;">Contact Us</a>&nbsp;|&nbsp;
-->				  
				  
  
				  
				  
				  
				</div>
				<div align="right" id="copyright_rgt">Powered by <a rel="nofollow" href="http://www.iscripts.com/easycreate/" target="_blank"><font color="#F4700E"><b>iScripts EasyCreate</b></font></a>. A premium product from <a rel="nofollow" href="http://www.iscripts.com" class="" target="_blank"><font color="#F4700E"><b>iScripts.com</b></font></a></div>
		
		<!--copyright area start -->
		</div>
	</div>
</center>
</body>
</html>