Jump to content

Recommended Posts

Alrighty, so I am attempting to create a PHPNuke host script, and I've run into a problem with generating the config file. I'm so close to finishing, with just a few steps left, but I'm at a stand still because of this.

 

What I'm trying to do is create a file named: variable.php, which contains some variables for each specific installation of PHPNuke. Here is the error I receive:

Parse error: syntax error, unexpected T_STRING in /home2/depthhos/public_html/host/create.php on line 54

 

Now, here's my code. I've believe the problem exists somewhere under: //create config file

<?
//PHPNUKE AUTOINSTALLER

//Static Variables
$source ='/home2/depthhos/public_html/freshnuke/';
$destination = "/home2/depthhos/public_html/host/$subdomain/";

//Form Variables
$subdomain = $_POST["subdomain"];
$adminlogin = $_POST["adminlogin"];
$adminpass = $_POST["adminpass"];
$adminemail = $_POST["adminemail"];
$sitename = $_POST["sitename"];

//create subdomain folder
mkdir("/home2/depthhos/public_html/host/$subdomain/") or die ("Could not make directory");

//Copy Function
function full_copy( $source, $target ) {
if ( is_dir( $source ) ) {
	@mkdir( $target );
	$d = dir( $source );
	while ( FALSE !== ( $entry = $d->read() ) ) {
		if ( $entry == '.' || $entry == '..' ) {
			continue;
		}
		$Entry = $source . '/' . $entry; 
		if ( is_dir( $Entry ) ) {
			full_copy( $Entry, $target . '/' . $entry );
			continue;
		}
		copy( $Entry, $target . '/' . $entry );
	}

	$d->close();
}else {
	copy( $source, $target );
}
}

//Copy Nuke
full_copy($source, $destination);

//create file to contain variables
$ourFileName = realpath( $_SERVER['DOCUMENT_ROOT'] )."/host/$subdomain/variables.php";
$ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
fclose($ourFileHandle);

//create config file
$variables="
<?php
$prefix = "$subdomain";
$user_prefix = "nuke";
$dbtype = "MySQL";
$sitekey = "cPEnq15ZPmejnuKtzZMUHFH1bee9KLT9i5FfZBmI";
$subscription_url = "";
$admin_file = "admin";
?>";
$file = realpath( $_SERVER['DOCUMENT_ROOT'] )."/host/$subdomain/variables.php";
$fh = fopen($file, 'w') or die("can't open file");
fwrite($fh, $config);
fclose($fh);


//All Done 
?>

 

I'm still new to PHP, so any help (or better methods of accomplishing the same task) would be greatly appreciated.

Thanks!

-Devin

Link to comment
https://forums.phpfreaks.com/topic/148876-solved-error-generating-php-file/
Share on other sites

Actually, this whole section....

 

$variables="
<?php
$dbhost = "localhost";
$dbuname = "root";
$prefix = "$subdomain";
$user_prefix = "nuke";
$dbtype = "MySQL";
$sitekey = "cPEnq15ZPmejnuKtzZMUHFH1bee9KLT9i5FfZBmI";
$subscription_url = "";
$admin_file = "admin";
?>";

 

should be replaced with.....

 

[pre]

$variables="

<?php

\$dbhost = \"localhost\";

\$dbuname = \"root\";

\$prefix = \"$subdomain\";

\$user_prefix = \"nuke\";

\$dbtype = \"MySQL\";

\$sitekey = \"cPEnq15ZPmejnuKtzZMUHFH1bee9KLT9i5FfZBmI\";

\$subscription_url = \"\";

\$admin_file = \"admin\";

?>";

[/pre]

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.