Parse error: parse error, unexpected $end in
Posted: Sun Aug 13, 2006 7:31 pm
hi im sorry if i posted this in the wrong forum please forgive im so new to php and im having a problem installing a website on my server. im running an apache server on my computer and when i go to install my website i get this error
Parse error: parse error, unexpected $end in D:\wamp\www\MegloPlanet\install.php on line 264
and when i go to that line its a blank line there is nothing there. here is code
please tell me what i need to do or tell me what to add or what to fix
Parse error: parse error, unexpected $end in D:\wamp\www\MegloPlanet\install.php on line 264
and when i go to that line its a blank line there is nothing there. here is code
Code: Select all
<?php
/* $Id: install.php,v 1.0 2005-12-12 19:43:58-08 brian Exp brian $ */
// vim: expandtab sw=4 ts=4 sts=4:
########################################################################
## Built2Go PHP Movie Review v1.0 ##
## ---------------------------------------------------------------- ##
## Copyright © Big Resources, Inc. All Rights Reserved. ##
## This software must be used in accordance with its licensing ##
## terms and conditions at: http://www.built2go.com/faq.php ##
## ##
## This file may not be redistributed in whole or significant part. ##
## ---------------- BUILT2GO IS NOT FREE SOFTWARE ----------------- ##
########################################################################
require ("config.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 transitional//EN" "http://www.w3.org/tr/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" dir="ltr">
<head>
<title><?php echo $name_of_site ?></title>
<link href="<?php echo $siteurl?>/templates/admin/install.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?php echo $siteurl?>/templates/admin/install.js"></script>
</head>
<body>
<h2 style="margin-left:auto; margin-right:auto; width:75%; text-align:center"><?php echo $name_of_site ?> Install</h2>
<?php
if (file_exists("adminpanel/".TABLE_PREFIX."db.php")){
$db = "<div class=\"error\">".TABLE_PREFIX."db.php exits! You will be overwriting this file once you click continue.</div>";
$Connection = TRUE;
} else {
$db = "<div class=\"error\">".TABLE_PREFIX."db.php does not exits!</div>";
$Connection = FALSE;
}
$level = (isset($_POST['level']))?$_POST['level']:"";
if ($level == ""){
?>
<div class="raised" style="text-align:center; margin-right:auto; margin-left:auto"><b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>
<div class="boxcontent" style="padding:3px">
Welcome to the <?php echo $name_of_site ?> install. In order for you to install this product, you will need to
follow the steps in the next few screens. <hr />
<div class="raised" style="margin-top:5px; width:130px; height:50px; text-align:center; margin-left:75%">
<b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>
<div class="boxcontent"><form action="install.php" method="post"><input type="hidden" name="level" value="1" /><input class="button" type="submit" name="next" value="Continue to Step 1" /></form></div>
<b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b>
</div>
</div><b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b></div>
<?
}
if ($level == "1"){
?>
<h3 style="margin-left:auto; margin-right:auto; width:75%; text-align:center">Step #1, MySql Connection Info</h3>
<div class="raised" style="width:75%; text-align:center; margin-right:auto; margin-left:auto"><b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>
<div class="boxcontent" style="padding:3px">
<?
if ($Connection){ echo $db; }
?>
<form method="post" action="install.php" onsubmit="return valid_dbf(this)">
<p align="center">This information is generally given to you by your host. It is important to have this for the script to work.
<p align="center">Hostname : <input errortext="You have must enter a 'host'" type="text" name="hostname" size="20" value="localhost" />(often localhost)</p>
<p align="center">DB Username : <input errortext="You must enter a 'Username'" type="text" name="db_username" size="20" /></p>
<p align="center">DB Password : <input errortext="You have must enter a 'Password'" type="text" name="db_password" size="20" /></p>
<p align="center">Database Name: <input errortext="You have must enter a 'Database Name'" type="text" name="db_name" size="20" /></p>
<div class="raised" style="width:130px; height:50px; text-align:center; margin-left:75%">
<b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>
<div class="boxcontent">
<input type="hidden" name="level" value="2" /><input class="button" type="submit" name="next" value="Continue to Step 2" /></form></div>
<b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b>
</div>
</div><b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b></div>
<?
}
if ($level == "2"){
if (file_exists("$full_path/adminpanel/".TABLE_PREFIX."db.php")){
unlink ("$full_path/adminpanel/".TABLE_PREFIX."db.php");
}
$fd = fopen( "$full_path/adminpanel/".TABLE_PREFIX."db.php", "w+" ) or die("<div class=\"error\">Unable to create ".TABLE_PREFIX."db.php in adminpanel. Please chmod this folder to 777 and press refresh on this page.</div>");
$str_gen = "<?php\n mysql_connect (\"{$_POST['hostname']}\",\"{$_POST['db_username']}\",\"{$_POST['db_password']}\");\nmysql_select_db (\"{$_POST['db_name']}\");\n?>";
$len_gen = strlen( $str_gen );
fwrite( $fd, $str_gen, $len_gen );
fclose( $fd );
?>
<h3 style="margin-left:auto; margin-right:auto; width:75%; text-align:center">Step #2, Connection Info Saved</h3>
<div class="raised" style="width:75%; text-align:center; margin-right:auto; margin-left:auto"><b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>
<div class="boxcontent" style="padding:3px">
<div class="error"><?php echo TABLE_PREFIX ?>db.php has been wrtten to adminpanel succesfully.</div>
<p align="center">The next step will create the mysql tables for you so the script can function properly.</p>
<div class="raised" style="width:130px; height:50px; text-align:center; margin-left:75%">
<b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>
<div class="boxcontent">
<form method="post" action="install.php">
<input type="hidden" name="level" value="3" /><input class="button" type="submit" name="next" value="Continue to Step 3" /></form></div>
<b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b>
</div>
</div><b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b></div>
<?
}
if ($level == "3"){
if ($Connection){
include("$full_path/adminpanel/sql.php");
if ($result){
$GetResult = "<div class=\"error\">Tables have been created successfully.</div>";
$GetResult .= "<p align=\"center\">If you are wanting to create password protection for your adminpanel, Continue to the next step. Otherwise
click here to login to your Admin Panel to add products to your New $name_of_site Script.<br /><br />
<a href='adminpanel/index.php'>Login to Your Admin</a></p>
<p align=\"center\">Thank you for the Installing The $name_of_site Script. It is required to Delete this install script once done.</p>\n";
$submitbtn = "<input class=\"button\" type=\"submit\" name=\"next\" value=\"Continue to Step 4\" />\n";
$go = "4";
} else {
$GetResult = "<div class=\"error\">Table creation failed. Error below: <br /><br />".mysql_error()."</div>";
$submitbtn = "<input class=\"button\" type=\"submit\" name=\"next\" value=\"Redo Step 3\" />\n";
$go = "3";
}
} else {
$GetResult = "<div class=\"error\">".TABLE_PREFIX."db.php is not found. No Connection to mysql can be established. Please go back to setp 1 to create this file.</div>";
$submitbtn = "<input class=\"button\" type=\"submit\" name=\"next\" value=\"Back to Step 1\" />\n";
$go = "1";
}
?>
<h3 style="margin-left:auto; margin-right:auto; width:75%; text-align:center">Step #3, Mysql Table Creation</h3>
<div class="raised" style="width:75%; text-align:center; margin-right:auto; margin-left:auto"><b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>
<div class="boxcontent" style="padding:3px">
<form method="post" action="install.php">
<?php echo $GetResult ?>
<div class="raised" style="width:130px; height:50px; text-align:center; margin-left:75%">
<b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>
<div class="boxcontent">
<input type="hidden" name="level" value="<?php echo $go ?>" /><?php echo $submitbtn ?></form></div>
<b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b>
</div>
</div><b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b></div>
<?
// End of level 3...
}
if ($level == "4"){
?>
<h3 style="margin-left:auto; margin-right:auto; width:75%; text-align:center">Step #4, Password Protect The Admin</h3>
<div class="raised" style="width:75%; text-align:center; margin-right:auto; margin-left:auto"><b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>
<div class="boxcontent" style="padding:3px">
<p>You can now password protect your admin directory. By pushing the submit button,
.htaccess and .htpasswd file in the admin dir will be deleted, and recreated with
information given below. </p>
<p>You might get an error message when trying to set the protection. If this happens
to you, do the following: Log into Telnet, go to your admin dir, and type
<b>chmod 755 adminpanel</b>, and then do the below (this can also be done with cuteftp
by rightclicking the admin catalog, choosing CHMOD, and typing in 777 in the box).</p>
<p>Afterwards, remember to set the permission back to default. Often by doing this in Telnet:
chmod 755 adminpanel. Be sure to set $logintype["http"] equal to '1' in the config file or this htaccess file will not work.</p>
<p>Your .htaccess and .htpasswd files will be created in <br /><b><? echo "$full_path/adminpanel/"; ?></b><br />
according to your config.php file.</p>
<?
if (file_exists("$full_path/adminpanel/.htaccess")) {
$filemodtime = filemtime ("$full_path/adminpanel/.htaccess");
$last_mod_hta = date("d.m.Y - H:i:s", $filemodtime);
echo"Your existing htaccess file was last modified $last_mod_hta<br />";
} else {
echo"No .htaccess file exists<br />";
}
if (file_exists("$full_path/adminpanel/.htpasswd")) {
$filemodtime = filemtime ("$full_path/adminpanel/.htpasswd");
$last_mod_htp = date("d.m.Y - H:i:s", $filemodtime);
echo"Your existing htpasswd file was last modified $last_mod_htp<br />";
} else {
echo" No .htpasswd file exists";
}
?>
<p> </p>
<form method="post" action="install.php">
<p align="center">Username : <input type="text" name="username" size="20" /></p>
<p align="center">Password : <input type="text" name="password" size="20" /></p>
<div class="raised" style="width:130px; height:50px; text-align:center; margin-left:75%">
<b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>
<div class="boxcontent">
<input type="hidden" name="level" value="5" /><input class="button" type="submit" name="next" value="Continue to Step 5" /></form></div>
<b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b>
</div>
</div><b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b></div>
<?
}
if ($level == "5"){
if (file_exists("$full_path/adminpanel/.htaccess")){
unlink ("$full_path/adminpanel/.htaccess");
}
if (file_exists("$full_path/adminpanel/.htpasswd")){
unlink ("$full_path/adminpanel/.htpasswd");
}
if ($_POST['username'] AND $_POST['password']) {
$usernamenew = $_POST['username'];
$passwordnew = crypt ($_POST['password']);
$fd = @fopen( "$full_path/adminpanel/.htaccess", "w+" ) or die("<div class=\"error\">Unable to create .htaccess file in adminpanel. Please chmod this folder to 777 and press refresh on this page.</div>");
$fd2 = @fopen( "$full_path/adminpanel/.htpasswd", "w+" ) or die("<div class=\"error\">Unable to create .htpasswd file in adminpanel. Please chmod this folder to 777 and press refresh on this page.</div>");
$str = "$usernamenew:$passwordnew";
$len = strlen( $str );
$str_gen = "AuthUserFile $full_path/adminpanel/.htpasswd\nAuthGroupFile /dev/null\nAuthName \"$name_of_site\"\nAuthType Basic\n<Limit GET>\nrequire user $usernamenew\n</Limit>";
$len_gen = strlen( $str_gen );
fwrite($fd, $str_gen, $len_gen);
fwrite($fd2, $str, $len);
fclose($fd);
fclose($fd2);
$GetResult ="If you did not recieve any errors, NICE...files have be written.<p align=\"center\">Click here to login to the your Admin Panel to add products to your New $name_of_site Script.<br /><br />
<a href='adminpanel/index.php'>Login to Your Admin</a><br /><br />Thank you for the Installing The $name_of_site Script.</p>";
} else {
$GetResult ="No username and/or password given....<br />";
}
?>
<h3 style="margin-left:auto; margin-right:auto; width:75%; text-align:center">Step #5, htacces File Creation</h3>
<div class="raised" style="width:75%; text-align:center; margin-right:auto; margin-left:auto"><b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>
<div class="boxcontent" style="padding:3px">
<?php echo $GetResult ?>
<div class="raised" style="width:130px; height:50px; text-align:center; margin-left:75%">
<b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>
<div class="boxcontent">Finished</div>
<b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b>
</div>
</div><b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b></div>
<?
}
?>
<div class="copyright"><div style="display: inline;"><?php echo $name_of_site ?> <?php echo VERSION ?></div><div style="text-align:right; display: inline; width:200px"> © BIG RESOURCES, INC.</div>
</body>
</html>