Location: PHPKode > projects > DDL CMS > Upload these files to your webspace/install-3.2.php
<?php
	define('SCRIPT_VERSION', '3.2');
/**********************************************************
*  ______   ______   ___      _______  ___ ___  _______   *
* |   _  \ |   _  \ |   |    |   _   ||   Y   ||   _   |  *
* |.  |   \|.  |   \|.  |    |.  1___||.      ||   1___|  *
* |.  |    |.  |    |.  |___ |.  |___ |. \_/  ||____   |  *
* |:  1    |:  1    |:  1   ||:  1   ||:  |   ||:  1   |  *
* |::.. . /|::.. . /|::.. . ||::.. . ||::.|:. ||::.. . |  *
* `------' `------' `-------'`-------'`--- ---'`-------'  *
*                                _______        _______   *
*                    .--.--.    |   _   |      |       |  *
*                    |  |  |    |___|   |  __  |___|   |  *
*                     \___/      _(__   | |__|  /  ___/   *
*                               |:  1   |      |:  1  \   *
*                               |::.. . |      |::.. . |  *
*                               `-------'      `-------'  *
*                                                         *
*                                   Script: DDLCMS v3.2   *
*                                 Author: Little Dragon   *
*                              Email: hide@address.com   *
*                        Website: http://www.ddlcms.com   *
*                                                         *
*    Please direct bug reports, suggestions or feedback   *
*                                 to the DDLCMS forums:   *
*                                                         *
*                          http://www.ddlcms.com/forums   *
*                                                         *
*    DDLCMS is a commercial grade content management      *
*    system for DDL site owners. It is provided free      *
*    of charge, provided:                                 *
*                                                         *
*    1. You keep the linkback to http://www.ddlcms.com    *
*       in the footer.                                    *
*                                                         *
*    2. You keep the sponsored links to Sharingzone.net   *
*       on your site.                                     *
*                                                         *
*    By using this script, you agree that you will not    *
*    modify, remove, or replace any encoded parts of      *
*    this script. All encoded parts MUST remain intact    *
*    for your site to remain in good standing.            *
*                                                         *
**********************************************************/
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<title>DDLCMS Installation Script</title>
		<style>
		body { 
			background: #aaaaaa;
			color: #000000; 
			font-family: verdana, arial, serif;
			font-size: 1em;
			/*font-size: 11px;*/
		} 

		h2, h3, .center {
			text-align: center;
		}

		table {
			background: #ffffff;
			border: 1px #000000 solid;
			border-spacing: 0;
			margin: 15px;
			width: 700px;
			align: center;
		}
		
		td { 
			background: inherit;
			color: #000000; 
			font-family: verdana, arial, serif; 
			font-size: 11px; 
			padding: 5px; 
		} 

		table.form { 
			background: dddddd;
		} 

		form.td { 
			color: #444444; 
			font-family: verdana, arial, serif; 
			font-size: 13px; 
			padding: 2px; 
		} 

		.right {
			text-align: right;
		}

		.checked {
			background: inherit;
			color: #008800;
			margin: 10px;
		}

		.warning {
			background: inherit;
			color: #ff0000;
			margin: 10px;
		}

		.indent {
			margin: 10px;
		}

		.red {
			background: inherit;
			color: #ff0000;
		}

		.green {
			background: inherit;
			color: #008000;
		}

		div.scroll {
			width:450px;
			height:250px;
			overflow:auto;
		}
				
		a {
			font-family: verdana;
		}
		
		a:link {
			background: inherit;
 			color: #3333dd;
			text-decoration: none;
		}
		a:visited {
			background: inherit;
			color: #3333dd;
			text-decoration: none;
		}
		a:hover {
			text-decoration: underline;
		}
		</style>
	</head>
	<body>
		<h2>DDLCMS Installation Script</h2>
<?php
	if(isset($_POST) && is_array($_POST) && count($_POST) == 8 && strlen($_POST['baseDir']) > 0 && strlen($_POST['MySQLhost']) > 0 && strlen($_POST['MySQLuser']) > 0 && strlen($_POST['MySQLpasswd']) > 0 && strlen($_POST['MySQLdb']) > 0 && strlen($_POST['siteName']) > 0 && strlen($_POST['adminEmail']) > 6 && strlen($_POST['docRoot']) >= strlen($_POST['baseDir']) && ((posix_getuid() == fileowner($_POST['baseDir']) && substr(sprintf('%o', fileperms($_POST['baseDir'])), -3, 1) == '7') || (posix_getgid() == filegroup($_POST['baseDir']) && substr(sprintf('%o', fileperms($_POST['baseDir'])), -2, 1) == '7') || substr(sprintf('%o', fileperms($_POST['baseDir'])), -1, 1) == '7') && is_resource(@mysql_connect($_POST['MySQLhost'], $_POST['MySQLuser'], $_POST['MySQLpasswd'])))
	{
		function dbcom($host, $user, $passwd, $db, $query)
		{
			if(isset($query) === TRUE && empty($query) === FALSE & strlen($query) > 0)
			{
				$dbLink = mysql_connect($host, $user, $passwd);
				mysql_select_db($db, $dbLink);
				$theResult = mysql_query($query, $dbLink);
				if($theResult === FALSE)
				{
					echo mysql_error($dbLink);
					return FALSE;
				}
				else
				{
					return $theResult;
				}
				mysql_close($dbLink);
			}
			else
			{
				return NULL;
			}
		}
		$dbLink = mysql_connect($_POST['MySQLhost'], $_POST['MySQLuser'], $_POST['MySQLpasswd']);
		if(mysql_select_db($_POST['MySQLdb'], $dbLink) === FALSE)
		{
			die('Could not connect to database: ' . $_POST['MySQLdb']);
		}
		mysql_close($dbLink);

		$replace_baseDir = array
		(
			'aboutus.php',
			'admin/addnews.php',
			'admin/autosubmitter.php',
			'admin/ddl.php',
			'admin/deletenews.php',
			'admin/editnews.php',
			'admin/index.php',
			'admin/instantLEadmin.php',
			'admin/news.php',
			'admin/submit.php',
			'admin/submitfiles.php',
			'admin/submitnews.php',
			'admin/tsadmin/admin.php',
			'admin/tsadmin/iframe.php',
			'admin/tsadmin/newwin.php',
			'autosubmitter/index.php',
			'autosubmitter/urls.php',
			'blacklist.php',
			'button.php',
			'contact.php',
			'dmca.php',
			'faq.php',
			'frame.php',
			'fwd.php',
			'go.php',
			'index.php',
			'instantle/addlink.php',
			'instantle/form.php',
			'linktous.php',
			'main.php',
			'news/page.php',
			'seoreport.php',
			'submit.php',
			'submitted.php',
			'thanks.php',
			'tools.php',
			'top.php',
			'topsites/accounts.php',
			'topsites/in.php',
			'topsites/templates/admin_bannediplist.tpl',
			'tos.php',
			'whitelist.php'
		);
		$_POST = array_map('trim', $_POST);
		$_POST['baseDir'] = rtrim($_POST['baseDir'], '/');
		$docRoot = rtrim($_SERVER['DOCUMENT_ROOT'], '/');
		if($docRoot == $_POST['baseDir'])
		{
			$baseDirLength = strlen($docRoot) + 1;
		}
		else
		{
			$baseDirLength = strlen($_POST['baseDir']) + 1;
		}
		for($i = 0; $i < count($replace_baseDir); $i++)
		{
			$theFile = file_get_contents(dirname(__FILE__) . '/' . $replace_baseDir[$i]);
			$theFile = str_replace('##BASEDIR##', $baseDirLength, $theFile);
			file_put_contents(dirname(__FILE__) . '/' . $replace_baseDir[$i], $theFile);
		}



		$config = file_get_contents(dirname(__FILE__) . '/config.php');
		$config = str_replace('##MYSQLHOST##', $_POST['MySQLhost'], $config);
		$config = str_replace('##MYSQLUSER##', $_POST['MySQLuser'], $config);
		$config = str_replace('##MYSQLPASSWD##', $_POST['MySQLpasswd'], $config);
		$config = str_replace('##MYSQLDB##', $_POST['MySQLdb'], $config);
		file_put_contents(dirname(__FILE__) . '/config.php', $config);
		$dbInit = file_get_contents(dirname(__FILE__) . '/dbInit.sql');
		$dbInit = str_replace('##SITEURL##', 'http://' . $_SERVER['SERVER_NAME'], $dbInit);
		$dbInit = str_replace('##SITENAME##', $_POST['siteName'], $dbInit);
		$dbInit = str_replace('##ADMINEMAIL##', $_POST['adminEmail'], $dbInit);
		file_put_contents(dirname(__FILE__) . '/dbInit.sql', $dbInit);
		$htaccess = file_get_contents(dirname(__FILE__) . '/.htaccess');
		$htaccess = str_replace('##SITEURL##', 'http://' . $_SERVER['SERVER_NAME'], $htaccess);
		file_put_contents(dirname(__FILE__) . '/.htaccess', $htaccess);
		$tsVars = file_get_contents(dirname(__FILE__) . '/topsites/data/variables');
		$tsVars = str_replace('##DOCROOT##', $_SERVER['DOCUMENT_ROOT'], $tsVars);
		$tsVars = str_replace('##SITEURL##', 'http://' . $_SERVER['SERVER_NAME'], $tsVars);
		$tsVars = str_replace('##ADMINEMAIL##', $_POST['adminEmail'], $tsVars);
		$tsVars = str_replace('##MYSQLHOST##', $_POST['MySQLhost'], $tsVars);
		$tsVars = str_replace('##MYSQLUSER##', $_POST['MySQLuser'], $tsVars);
		$tsVars = str_replace('##MYSQLPASSWD##', $_POST['MySQLpasswd'], $tsVars);
		$tsVars = str_replace('##MYSQLDB##', $_POST['MySQLdb'], $tsVars);
		file_put_contents(dirname(__FILE__) . '/topsites/data/variables', $tsVars);

		if (!file_exists($_POST['baseDir'] . '/backups')) 
		{
			mkdir($_POST['baseDir'] . '/backups');
			chmod($_POST['baseDir'] . '/backups', 0777);
		}

		$commands = preg_split('/;/', $dbInit, -1, PREG_SPLIT_NO_EMPTY);
		for($i = 0; $i < count($commands); $i++)
		{
			if(strlen(trim($commands[$i])) > 0)
			{
				dbcom($_POST['MySQLhost'], $_POST['MySQLuser'], $_POST['MySQLpasswd'], $_POST['MySQLdb'], $commands[$i]);
			}
		}
		$moveToBaseDir = array
		(
			'custom_dictionary.txt',
			'funcs.inc',
			'config.php',
			'dbInit.sql',
		);
		if($docRoot != $_POST['baseDir'])
		{
			for($i = 0; $i < count($moveToBaseDir); $i++)
			{
				rename(dirname(__FILE__) . '/' . $moveToBaseDir[$i], $_POST['baseDir'] . '/' . $moveToBaseDir[$i]);
			}
		}
?>
		<table align="center">
			<tr>
				<td>
					<h3><span style="color:green"><b>&#x2713;</b> Installation was successful!</span></h3>
					<p><b>Do NOT Close or Refresh this page! Read all the following information!</b></p>
					<p>Install file deleted.</p>

					<hr>

					<h3>Admin Login:</h3>
					<p><a target="_blank" href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/admin/"><b>Please click here to login to your Admin Panel</b></a>.</p>
					<p>Login details:</p>
					<ul>
						<li> URL: http://<?php echo $_SERVER['SERVER_NAME']; ?>/admin</li>
						<li> Username: admin123admin</li>
						<li> Password: admin123admin</li>
					</ul>
					<p><i>After logging in, click on "Change Password" on the lower left pane and change your password immediately!!!</i></p>

					<hr>

					<h3>Affiliate Button</h3>
					<p>Be sure to edit <b>button.gif</b> in the images folder -- this is your affiliate button:<br /><br />
						<img src="http://<?php echo $_SERVER['SERVER_NAME']; ?>/images/button.gif" /> &lt;-- edit or replace this image
						<br><i><?php echo $_SERVER['SERVER_NAME']; ?>/images/button.gif</i>
						<br>Size: 88 x 31 pixels
					</p>

					<hr>

					<h3>Some Security Precautions</h3>
					
					<P>
					Be sure to chmod folders and files back to 755 and 644 respectively
					(<b>except for rss.xml and custom_dictionary.txt</b>):

					<P>
					<P>
					Be sure to CHMOD the following folders back to 755:
					
					<P>
					<ul>
					<?
							$chmod755 = array
							(
								'edit',
								'topsites',
								'topsites/templates',
								$_SERVER['DOCUMENT_ROOT'],
							);
					
							for($i = 0; $i < count($chmod755); $i++)
							{
								if (file_exists($chmod755[$i])) {
									echo "<li> <span style=\"color:";
									if (substr(sprintf('%o', fileperms($chmod755[$i])), -4) != "0755") 
									{
										echo "red"; 
									} else {
										echo "green";
									}
									echo "\">";
									echo $chmod755[$i]; 
									echo " (" . substr(sprintf('%o', fileperms($chmod755[$i])), -3);
									echo ")</span></li>";
								} else {
									echo "<li><span style=\"color:red\">Warning! The directory \"" . $chmod755[$i] . "\" doesn't exist. Make sure you uploaded it.</span></li>";
								}
							}
					
					?>
					</ul>
					
					<P>
					Be sure to CHMOD the following files back to 644:
					
					<P>
					<ul>
					<div class="scroll">
					<?
							$chmod644 = array
							(
								'aboutus.php',
								'blacklist.php',
								'button.php',
								'contact.php',
								'dmca.php',
								'faq.php',
								'frame.php',
								'fwd.php',
								'go.php',
								'index.php',
								'linktous.php',
								'main.php',
								'seoreport.php',
								'submit.php',
								'submitted.php',
								'thanks.php',
								'tools.php',
								'top.php',
								'tos.php',
								'whitelist.php',
								'autosubmitter/index.php',
								'autosubmitter/urls.php',
								'instantle/addlink.php',
								'instantle/form.php',
								'news/page.php',
								'admin/addnews.php',
								'admin/autosubmitter.php',
								'admin/ddl.php',
								'admin/deletenews.php',
								'admin/editnews.php',
								'admin/index.php',
								'admin/instantLEadmin.php',
								'admin/news.php',
								'admin/submit.php',
								'admin/submitfiles.php',
								'admin/submitnews.php',
								'admin/tsadmin/admin.php',
								'admin/tsadmin/iframe.php',
								'admin/tsadmin/newwin.php',
								'topsites/accounts.php',
								'topsites/in.php',
							);
							for($i = 0; $i < count($chmod644); $i++)
							{
								if (file_exists($chmod644[$i])) {
									echo "<li> <span style=\"color:";
									if (substr(sprintf('%o', fileperms($chmod644[$i])), -4) != "0644") 
									{
										echo "red"; 
									} else {
										echo "green";
									}
									echo "\">";
									echo $chmod644[$i]; 
									echo " (" . substr(sprintf('%o', fileperms($chmod644[$i])), -3);
									echo ")</span></li>";
								} else {
									echo "<li><span style=\"color:red\">Warning! The file \"" . $chmod644[$i] . "\" doesn't exist. Make sure you uploaded it.</span></li>";
								}
							}
					?>
					</div>
					</ul>
					<P>
					Note: Do not refresh this page.  To check your file permissions, <a href="perms.php" target="_blank">click here</a>.


<?php
					if($docRoot == $_POST['baseDir'])
					{
?>
						<hr>
	
						<h3>BaseDir = DocRoot?</h3>
	
						<P>
						If the script installed all files with your BASEDIR = DOCROOT 
						due to your vhost setup or because you could not chmod your base directory to 777, then your config.php file is also 
						within public access (it's not viewable to the public unless
						your apache webhost goes down).
						
						<P>
						For additional security, it's better to COPY your config.php 
						file one level up (above your document root folder, which is 
						<? echo substr($_SERVER['DOCUMENT_ROOT'], 0, strrpos(rtrim($_SERVER['DOCUMENT_ROOT'], '/'), '/')); ?>).  
						
						<P>
						Then, edit your original config.php file, by removing all it's
						contents and replacing it with this one line:
						
						<P>
						&lt;?php include ('<? echo substr($_SERVER['DOCUMENT_ROOT'], 0, strrpos(rtrim($_SERVER['DOCUMENT_ROOT'], '/'), '/')); ?>/config.php'); ?&gt;
						
						<P>
						Note: <? echo substr($_SERVER['DOCUMENT_ROOT'], 0, strrpos(rtrim($_SERVER['DOCUMENT_ROOT'], '/'), '/')); ?>/config.php is the 
						RELATIVE PATH TO YOUR config.php file.
						
						<P>
						Test your site and make sure it works.
<?php
					}
?>

					<hr>

					<h3>Monetization Of Your DDL Site</h3>
					
					<P>
					The script is pre-monetized -- meaning once your site is running with DDLCMS (and generating hits) you will begin earning money right away!
					
					<P>
					The script is pre-populated with strategically placed text links which will send surfers to your sponsors, generating maximum revenue.  All you have to do is fill in your 3 sponsor codes in your Admin panel (Go to Admin > DDL > Edit Options).
					
					<P>
					Your 3 sponsors by default are: 
					
					<ol>
						<li> <a href="http://www.sharingzone.net/aff_signup.php?r=2248" target="_blank">Sharingzone.net</a> 
						<li> <a href="http://cams.com/go/g656263-brk" target="_blank">Cams.com</a>
						<li> <a href="http://webmasters.videosz.com/index.php?webmaster_id=8006" target="_blank">Videosz.com</a>
					</ol>
					
					<P>
					If you are not currently an affiliate of the above 3 sites, click the links and signup, then enter your affiliate username in Admin > DDL > Edit Options.
					
					<P>
					The script is optimized to generate and gradually increase traffic, and pulls in the most revenues with given sponsors.
					
					<P>
					Of course, in addition to the above 3 sponsors, you can always add or edit your advertisements through out your site manually with your own ads or other sponsors.

					<hr>

					<h3>Why You Should Promote Sharingzone</h3>
					
					<P>
					Basically, it's a requirement for using DDLCMS.  Other reasons:
					
					<ul>
					<li> higher sales conversions 
					<li> higher per-sale commissions (upto $56.45 per sale)
					<li> revshare commissions ($14.99 sales -- you get the commission EVERY month!)
					<li> 2 tier commission structure
					<li> lowest refund rates (less than 5% refund rate!)
					<li> bonus payouts for high traffic sites
					<li> new web 2.0/flash/interactive site
					<li> direct links to join page
					<li> customize your own join page by using "Signup System" join forms on your site
					<li> you simply make more money!!!
					</ul>
					
					<P>
					<b>More info on Sharingzone: </b>

					<P>
					Visit their Webmasters page:<br>
					<a href="http://www.sharingzone.net/webmasters.php?r=2248" target="_blank">http://www.sharingzone.net/webmasters.php</a>
					
					<hr>

					<h3>Remain In Good Standing</h3>
					
					<P>
					DDLCMS is a commercial grade content management system for DDL 
					site owners. It is provided free of charge, provided:  
					
					<ol>
					<li>You keep the linkback to http://www.ddlcms.com in the footer.<br><br>
					<li>You keep the sponsored links to Sharingzone.net on your site.
					</ol>
					
					<P>
					By using this script, you agree that you will not modify, remove, 
					or replace any encoded parts of this script. All encoded parts MUST 
					remain intact for your site to remain in good standing.  
					
					<P>
					By remaining in good standing, your site will be listed in our
					"Demo" section to help your site get indexed by Google AND you
					will be entitled to free support, upgrades, new features, and 
					unlimited technical support with VIP benefits.
					
					<hr>

					<h3>Support</h3>
					
					<P>
					For support or extra feature requests, visit:
					
					<a href="http://www.ddlcms.com" target="_blank">www.ddlcms.com</a>
					
					Visit our forums page and signup for fastest service and support!

					<br>
					<br>


				</td>
			</tr>
		</table>
<?php
		unlink(dirname(__FILE__) . '/install-' . SCRIPT_VERSION . '.php');
	}
	elseif(isset($_POST) && is_array($_POST) && count($_POST) == 8 && (!is_resource(@mysql_connect($_POST['MySQLhost'], $_POST['MySQLuser'], $_POST['MySQLpasswd'])) || !strlen($_POST['baseDir']) > 0 || !strlen($_POST['MySQLhost']) > 0 || !strlen($_POST['MySQLuser']) > 0 || !strlen($_POST['MySQLpasswd']) > 0 || !strlen($_POST['MySQLdb']) > 0 || !strlen($_POST['siteName']) > 0 || !strlen($_POST['adminEmail']) > 6 || !strlen($_POST['docRoot']) >= strlen($_POST['baseDir']) || ((posix_getuid() != fileowner($_POST['baseDir']) && substr(sprintf('%o', fileperms($_POST['baseDir'])), -3, 1) == '7') || (posix_getgid() != filegroup($_POST['baseDir']) && substr(sprintf('%o', fileperms($_POST['baseDir'])), -2, 1) == '7') || substr(sprintf('%o', fileperms($_POST['baseDir'])), -1, 1) == '7')))
	{
?>
		<p class="center">The form contained one or more errors or the database connection details are incorrect. Please, go back and try again.</p>
<?php
	}
	else
	{
		$enabled = FALSE;
?>
		<table align="center">
			<tr>
				<td>
					<h3>Prerequisites to Running This Script:</h3>
					<ol>
<?php
		if(ini_get('allow_url_fopen') == '1')
		{
?>
						<li class="checked"><b>&#x2713;</b> Your PHP configuration has allow_url_fopen set to "On".</li>
<?php
			$enabled = TRUE;
		}
		else
		{
?>
						<li class="warning"><span style="font-size:15px; font-weight:bold">&#10754;</span> allow_url_fopen is currently set to 'Off'. Your PHP configuration must have allow_url_fopen set to "On".</li>
<?php
			$enabled = FALSE;
		}
		if(function_exists('pspell_new') === TRUE)
		{
?>
						<li class="checked"><b>&#x2713;</b> PHP-pspell is installed.</li>
<?php
		}
		else
		{
?>
						<li class="indent">PHP-pspell module is not installed or enabled. It's recommended to install/enable the PHP-pspell module in order for the search spell checker to work, but not required.</li>
<?php
		}
		if(function_exists('posix_getuid') === TRUE)
		{
?>
						<li class="checked"><b>&#x2713;</b> PHP-posix is installed.</li>
<?php
			if($enabled !== FALSE)
			{
				$enabled = TRUE;
			}
		}
		else
		{
?>
						<li class="indent"><span class="red"><span style="font-size:15px; font-weight:bold">&#10754;</span> Warning: PHP-posix module is not installed or enabled.</span> Installation cannot proceed. Please, enable it and try again.</li>
<?php
			$enabled = FALSE;
		}
		if(function_exists('posix_getuid') === TRUE)
		{
			if((posix_getuid() == fileowner(dirname(__FILE__)) && substr(sprintf('%o', fileperms(dirname(__FILE__))), -3, 1) == '7') || (posix_getgid() == filegroup(dirname(__FILE__)) && substr(sprintf('%o', fileperms(dirname(__FILE__))), -2, 1) == '7') || substr(sprintf('%o', fileperms(dirname(__FILE__))), -1, 1) == '7')
			{
?>
						<li class="checked"><b>&#x2713;</b> The owner or group of the Document Root and the vhost user or group is the same and this directory is writable by that user or group.</li>
<?php
				if($enabled !== FALSE)
				{
					$enabled = TRUE;
				}
			}
			else
			{
?>
						<li class="indent">
							<span class="red">
								<span style="font-size:15px; font-weight:bold">&#10754;</span> <!-- The owner or group of the Document Root and the vhost user or group is not the same. --> 
								The Document Root and (preferrably) Base Directory will have to be chmod'd 775 or 777 
								for this installation script to complete successfully.  Chmod the following two directories to 777: 
							</span>
							<P>
							<ul>
								<li><? echo $_SERVER['DOCUMENT_ROOT']; ?> </li>
								<li><? echo substr($_SERVER['DOCUMENT_ROOT'], 0, strrpos(rtrim($_SERVER['DOCUMENT_ROOT'], '/'), '/')); ?> </li>
							</ul>
						</li>
<?php
				$enabled = FALSE;
			}
		}
?>
						<li class="indent">

							Before proceeding, you must change permissions (chmod) to the following directories and files:<br>
							
							<br>
							    <ul>
							        <li>Chmod the following <b>folders</b> to 777:
									<ul>
									<?
											$chmod777 = array
											(
												'edit',
												'topsites',
												'topsites/cache',
												'topsites/data',
												'topsites/data/pages',
												'topsites/data/reject',
												'topsites/templates',

											);
											for($i = 0; $i < count($chmod777); $i++)
											{
												if (file_exists($chmod777[$i])) {
													echo "<li> <span style=\"color:";
													if (substr(sprintf('%o', fileperms($chmod777[$i])), -4) != "0777") 
													{
														echo "red"; 
														$enabled = FALSE;
													} else {
														echo "green";
														$enabled === TRUE;
													}
													echo "\">";
													echo $chmod777[$i]; 
													echo " (" . substr(sprintf('%o', fileperms($chmod777[$i])), -3);
													echo ")</span></li>";
												} else {
													echo "<li><span style=\"color:red\">Warning! The folder \"" . $chmod777[$i] . "\" doesn't exist. Make sure you uploaded it.</span></li>";
												}
											}
									
									?>
									</ul>
								</ul>
							
							
							<br>
							    <ul>
							        <li>Chmod the following <b>files</b> to 666:
									<ul>
									<div class="scroll">
									<?
											$chmod666 = array
											(
												'.htaccess',
												'aboutus.php',
												'blacklist.php',
												'button.php',
												'config.php',
												'contact.php',
												'dbInit.sql',
												'dmca.php',
												'faq.php',
												'frame.php',
												'fwd.php',
												'go.php',
												'index.php',
												'instantle/addlink.php',
												'instantle/form.php',
												'linktous.php',
												'main.php',
												'seoreport.php',
												'submit.php',
												'submitted.php',
												'thanks.php',
												'tools.php',
												'top.php',
												'tos.php',
												'whitelist.php',
												'custom_dictionary.txt',
												'rss.xml',
												'news/page.php',
												'admin/addnews.php',
												'admin/autosubmitter.php',
												'admin/ddl.php',
												'admin/deletenews.php',
												'admin/editnews.php',
												'admin/index.php',
												'admin/instantLEadmin.php',
												'admin/news.php',
												'admin/submit.php',
												'admin/submitfiles.php',
												'admin/submitnews.php',
												'admin/tsadmin/admin.php',
												'admin/tsadmin/iframe.php',
												'admin/tsadmin/newwin.php',
												'autosubmitter/index.php',
												'autosubmitter/urls.php',
												'edit/aboutus.php',
												'edit/adblock1.php',
												'edit/adblock2.php',
												'edit/adblock3.php',
												'edit/adblock4.php',
												'edit/adblock5.php',
												'edit/dmca.php',
												'edit/extraline.php',
												'edit/extraxxxlines.php',
												'edit/faq.php',
												'edit/rules.php',
												'edit/tools.php',
												'edit/tos.php',
												'topsites/accounts.php',
												'topsites/in.php',
												'topsites/cache/accounts_edited.tpl',
												'topsites/cache/accounts_edit.tpl',
												'topsites/cache/accounts_links.tpl',
												'topsites/cache/accounts_remind.tpl',
												'topsites/cache/accounts_statistics.tpl',
												'topsites/cache/default',
												'topsites/cache/default.time',
												'topsites/cache/user_error.tpl',
												'topsites/data/bulkmessage',
												'topsites/data/cheatlog',
												'topsites/data/icons',
												'topsites/data/language',
												'topsites/data/rerank',
												'topsites/data/reset',
												'topsites/data/rrlock',
												'topsites/data/rslock',
												'topsites/data/times',
												'topsites/data/variables',
												'topsites/data/pages/default',
												'topsites/data/pages/default.comp',
												'topsites/templates/admin_bannediplist.tpl',
												'topsites/templates/accounts_added.tpl',
												'topsites/templates/accounts_add.tpl',
												'topsites/templates/accounts_confirm.tpl',
												'topsites/templates/accounts_edited.tpl',
												'topsites/templates/accounts_edit.tpl',
												'topsites/templates/accounts_links.tpl',
												'topsites/templates/accounts_login.tpl',
												'topsites/templates/accounts_remind.tpl',
												'topsites/templates/accounts_statistics.tpl',
												'topsites/templates/admin_accountdetails.tpl',
												'topsites/templates/admin_accounts.js',
												'topsites/templates/admin_accounts.tpl',
												'topsites/templates/admin_bannediplist.tpl',
												'topsites/templates/admin_bannedips.tpl',
												'topsites/templates/admin_blacklist.tpl',
												'topsites/templates/admin_cheatlog.tpl',
												'topsites/templates/admin_cheattally.tpl',
												'topsites/templates/admin_createaccount.tpl',
												'topsites/templates/admin_editaccount.tpl',
												'topsites/templates/admin_editpage.tpl',
												'topsites/templates/admin_edittrigger.tpl',
												'topsites/templates/admin_emailmember.tpl',
												'topsites/templates/admin_error.tpl',
												'topsites/templates/admin_in_gateway.tpl',
												'topsites/templates/admin_main.tpl',
												'topsites/templates/admin_options.tpl',
												'topsites/templates/admin_popup.tpl',
												'topsites/templates/admin_progressbottom.tpl',
												'topsites/templates/admin_progresstop.tpl',
												'topsites/templates/admin_progress.tpl',
												'topsites/templates/admin_quickaccounts.tpl',
												'topsites/templates/admin_reviewedits.tpl',
												'topsites/templates/admin_statistics.tpl',
												'topsites/templates/admin_triggers.tpl',
												'topsites/templates/email_added.tpl',
												'topsites/templates/email_adminadd.tpl',
												'topsites/templates/email_adminedit.tpl',
												'topsites/templates/email_confirm.tpl',
												'topsites/templates/email_remind.tpl',
												'topsites/templates/email_review.tpl',
												'topsites/templates/.htaccess',
												'topsites/templates/in_gateway.tpl',
												'topsites/templates/new_main.tpl',
												'topsites/templates/user_error.tpl'
											);
											for($i = 0; $i < count($chmod666); $i++)
											{
												if (file_exists($chmod666[$i])) {
													echo "<li> <span style=\"color:";
													if (substr(sprintf('%o', fileperms($chmod666[$i])), -4) != "0666") 
													{
														echo "red"; 
														$enabled = FALSE;
													} else {
														echo "green";
														$enabled === TRUE;
													}
													echo "\">";
													echo $chmod666[$i]; 
													echo " (" . substr(sprintf('%o', fileperms($chmod666[$i])), -3);
													echo ")</span></li>";
												} else {
													echo "<li><span style=\"color:red\">Warning! The file \"" . $chmod666[$i] . "\" doesn't exist. Make sure you uploaded it.</span></li>";
												}
											}
									
									?>
									</div>
									</ul>
							    </ul>
						</li>

						<li class="indent">Be sure to create a MySQL Database and User before proceeding:</li>

					</ol>
					<br>
					<br>
					<form action="<?php echo $_SERVER['SCRIPT_URI']; ?>" method="POST">
						<table align="center" class="form">
							<tr>
								<td colspan="2"><h3>Site and Database Details: </h3></td>
							</tr>
							<tr>
								<td class="right"><label for="txtDocRoot">Document Root: </label></td>
								<td><input size="30" type="text" name="docRoot" id="txtDocRoot" value="<?php echo $_SERVER['DOCUMENT_ROOT']; ?>" readonly="readonly" /></td>
							</tr>
							<tr>
								<td class="right"><label for="txtBaseDir">Base Directory: </label></td>
<?php
	$tmpBaseDir = substr($_SERVER['DOCUMENT_ROOT'], 0, strrpos(rtrim($_SERVER['DOCUMENT_ROOT'], '/'), '/')); 
	if((function_exists('posix_getuid') === TRUE && posix_getuid() == fileowner($tmpBaseDir) && substr(sprintf('%o', fileperms($tmpBaseDir)), -3, 1) == '7') || (function_exists('posix_getuid') === TRUE && posix_getgid() == filegroup($tmpBaseDir) && substr(sprintf('%o', fileperms($tmpBaseDir)), -2, 1) == '7') || substr(sprintf('%o', fileperms($tmpBaseDir)), -1, 1) == '7')
	{
		$theBaseDir = $tmpBaseDir;
	}
	else
	{
		$theBaseDir = $_SERVER['DOCUMENT_ROOT'];
	}
?>
								<td><input size="30" type="text" name="baseDir" id="txtBaseDir" value="<?php echo $theBaseDir;?>" /></td>
							</tr>
							<tr>
								<td class="right"><label for="txtMySQLhost">MySQL Hostname: </label></td>
								<td><input size="30" type="text" name="MySQLhost" id="txtMySQLhost" value="localhost" /></td>
							</tr>
							<tr>
								<td class="right"><label for="txtMySQLdb">MySQL Database: </label></td>
								<td><input size="30" type="text" name="MySQLdb" id="txtMySQLdb" /></td>
							</tr>
							<tr>
								<td class="right"><label for="txtMySQLuser">MySQL Username: </label></td>
								<td><input size="30" type="text" name="MySQLuser" id="txtMySQLuser" /></td>
							</tr>
							<tr>
								<td class="right"><label for="txtMySQLpasswd">MySQL Password: </label></td>
								<td><input size="30" type="password" name="MySQLpasswd" id="txtMySQLpasswd" /></td>
							</tr>
							<tr>
								<td class="right"><label for="txtSiteName">Site Name: </label></td>
								<td><input size="30" type="text" name="siteName" id="txtSiteName" /> <small>Keep it simple! Eg: DDL Site</small></td>
							</tr>
							<tr>
								<td class="right"><label for="txtAdminEmail">Administrator E-mail: </label></td>
								<td><input size="30" type="text" name="adminEmail" id="txtAdminEmail" value="<?php echo $_SERVER['SERVER_ADMIN']; ?>" /></td>
							</tr>
							<tr>
								<td class="right"><input type="reset" /></td>
<?php
		if($enabled === TRUE)
		{
?>
								<td><input type="submit" value="Install" /></td>
<?php
		}
		else
		{
?>
								<td><input type="submit" disabled="disabled" value="Install" /></td>
<?php
		}
?>
							</tr>
						</table>
					</form>
					<p>Note that upon submission of this form, install-<?php echo SCRIPT_VERSION; ?>.php will be removed and unless there's any errors displayed or shown in the error log, the installation executed correctly.</p>
<?php
	}
?>
				</td>
			</tr>
		</table>
	</body>
</html>
Return current item: DDL CMS