Jump to content

syntax error


Go to solution Solved by Maq,

Recommended Posts

Hi,

 I m tring to run a script during install i got an error:

Parse error: syntax error, unexpected end of file in C:\Program Files\EasyPHP-12.1\www\car2\install.php on line 218

here is code:

 

 

<?php

require_once ("config.php");
require_once ("admincp/install_cls.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>My Car Site <?php echo $name_of_site ?></title>

<link href="<?php echo SITE_URL ?>/templates/admin/install.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?php echo SITE_URL ?>/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
define('VERSION', '1.0.8'); // version of script

if (file_exists(FULL_PATH . "/admincp/" . 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>
<?php
}

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">
    <?php
                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>
   <div style="margin:auto; text-align:center; width:70%">
   <p align="left">Hostname  : <input errortext="You have must enter a 'host'" type="text" name="hostname" size="20" value="localhost" />(often localhost)</p>
   <p align="left">DB Username : <input errortext="You must enter a 'Username'" type="text" name="db_username" size="20" /></p>
   <p align="left">DB Password : <input errortext="You have must enter a 'Password'" type="text" name="db_password" size="20" /></p>
   <p align="left">Database Name: <input errortext="You have must enter a 'Database Name'" type="text" name="db_name" size="20" /></p>
   </div>
    <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>
   <?php


}
if ($level == "2")
{
                if (file_exists(FULL_PATH . "/admincp/" . TABLE_PREFIX . "db.php"))
                {
                                unlink(FULL_PATH . "/admincp/" . TABLE_PREFIX . "db.php");
                }

                $fd = fopen(FULL_PATH . "/admincp/" . TABLE_PREFIX . "db.php", "w+") or die("<div class=\"error\">Unable to create " . TABLE_PREFIX . "db.php in admincp. Please chmod this folder to 777 and press refresh on this page.</div>");
                $str_gen = "<?php\n\n
    // " . date("M d, Y G:i:s") . " \n\ndefine(\"HOSTNAME\", \"{$_POST['localhost']}\");
define(\"USER\", \"{$_POST['root']}\");
define(\"PASS\", \"{$_POST['']}\");
define(\"DBNAME\", \"{$_POST['car2']}\");\r\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 written to admincp 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>
    <?php

}

if ($level == "3")
{
                if ($Connection)
                {

                                include (FULL_PATH . "/admincp/sql.php");
                                $DBc = new DBM;
                                $DBc->connect();
                                foreach ($CarDealer_Query['Create'] AS $query)
                                {
                                                $DBc->query($query);
                                }

                                foreach ($CarDealer_Query['Insert'] AS $query)
                                {
                                                $DBc->query($query);
                                }
                                if (!$DBc->errdesc)
                                {
                                                $GetResult = "<div class=\"error\">Tables have been created successfully.</div>";
                                                $GetResult .= "<p align=\"center\">Next step will install the scripts templates. Please continue to the next step. <br /><br />";
                                                $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 />" . $DBc->errdesc . "</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...
}
<?php
if ($level == "4")
{

                $Install = new INSTALL();
                $Install->INSTALLS();
                if ($Install->InstallError)
                {
                                $GetResult = "<div class=\"error\">Style Import Failed. Error below: <br /><br />$Install->InstallError</div>";
                                $submitbtn = "<input type=\"hidden\" name=\"level\" value=\"4\" /><input class=\"button\" type=\"submit\" name=\"next\" value=\"Redo to Step 4\" /></form></div>\n";
                }
                else
                {
                                $GetResult = "<div class=\"error\">$Install->msg</div>";
                                $GetResult .= "<a href='admincp/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 = "<div class=\"boxcontent\">Finished</div></form>\n";

                }

?>
    <h3 style="margin-left:auto; margin-right:auto; width:75%; text-align:center">Step #4, Master Style Insertion</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 ?>
    <form method="post" action="install.php">
    <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>
      <?php echo $submitbtn ?>
      <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>
    <?php

}

?>
<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"> © My Car Site</div></div>
</body>
</html>
 

 


 

please help

Edited by KevinM1
Code tags
Link to comment
https://forums.phpfreaks.com/topic/276266-syntax-error/
Share on other sites

In the future, please place any code you post in code tags by pressing the <> button on the editor.  Also, it's highly unlikely that anyone will read through all that.  You should give us merely the line in question and 2-3 lines above and below it since it's just a parse error.

Link to comment
https://forums.phpfreaks.com/topic/276266-syntax-error/#findComment-1421607
Share on other sites

It took me few seconds to find the error.

 

Have you ever used some IDE?

 

<?php

require_once ("config.php");
require_once ("admincp/install_cls.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>My Car Site <?php echo $name_of_site ?></title>

<link href="<?php echo SITE_URL ?>/templates/admin/install.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?php echo SITE_URL ?>/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
define('VERSION', '1.0.8'); // version of script

if (file_exists(FULL_PATH . "/admincp/" . 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>
<?php
}

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">
    <?php
                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>
   <div style="margin:auto; text-align:center; width:70%">
   <p align="left">Hostname  : <input errortext="You have must enter a 'host'" type="text" name="hostname" size="20" value="localhost" />(often localhost)</p>
   <p align="left">DB Username : <input errortext="You must enter a 'Username'" type="text" name="db_username" size="20" /></p>
   <p align="left">DB Password : <input errortext="You have must enter a 'Password'" type="text" name="db_password" size="20" /></p>
   <p align="left">Database Name: <input errortext="You have must enter a 'Database Name'" type="text" name="db_name" size="20" /></p>
   </div>
    <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>
   <?php


}
if ($level == "2")
{
                if (file_exists(FULL_PATH . "/admincp/" . TABLE_PREFIX . "db.php"))
                {
                                unlink(FULL_PATH . "/admincp/" . TABLE_PREFIX . "db.php");
                }

                $fd = fopen(FULL_PATH . "/admincp/" . TABLE_PREFIX . "db.php", "w+") or die("<div class=\"error\">Unable to create " . TABLE_PREFIX . "db.php in admincp. Please chmod this folder to 777 and press refresh on this page.</div>");
                $str_gen = "<?php\n\n
    // " . date("M d, Y G:i:s") . " \n\ndefine(\"HOSTNAME\", \"{$_POST['localhost']}\");
define(\"USER\", \"{$_POST['root']}\");
define(\"PASS\", \"{$_POST['']}\");
define(\"DBNAME\", \"{$_POST['car2']}\");\r\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 written to admincp 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>
    <?php

}

if ($level == "3")
{
                if ($Connection)
                {

                                include (FULL_PATH . "/admincp/sql.php");
                                $DBc = new DBM;
                                $DBc->connect();
                                foreach ($CarDealer_Query['Create'] AS $query)
                                {
                                                $DBc->query($query);
                                }

                                foreach ($CarDealer_Query['Insert'] AS $query)
                                {
                                                $DBc->query($query);
                                }
                                if (!$DBc->errdesc)
                                {
                                                $GetResult = "<div class=\"error\">Tables have been created successfully.</div>";
                                                $GetResult .= "<p align=\"center\">Next step will install the scripts templates. Please continue to the next step. <br /><br />";
                                                $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 />" . $DBc->errdesc . "</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>
   
   <?php             // End of level 3...
}

if ($level == "4") {

                $Install = new INSTALL();
                $Install->INSTALLS();
                if ($Install->InstallError)
                {
                                $GetResult = "<div class=\"error\">Style Import Failed. Error below: <br /><br />$Install->InstallError</div>";
                                $submitbtn = "<input type=\"hidden\" name=\"level\" value=\"4\" /><input class=\"button\" type=\"submit\" name=\"next\" value=\"Redo to Step 4\" /></form></div>\n";
                }
                else
                {
                                $GetResult = "<div class=\"error\">$Install->msg</div>";
                                $GetResult .= "<a href='admincp/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 = "<div class=\"boxcontent\">Finished</div></form>\n";

                }

?>
    <h3 style="margin-left:auto; margin-right:auto; width:75%; text-align:center">Step #4, Master Style Insertion</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 ?>
    <form method="post" action="install.php">
    <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>
      <?php echo $submitbtn ?>
      <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>
    <?php

}

?>
<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"> © My Car Site</div></div>
</body>
</html>
 

 
Link to comment
https://forums.phpfreaks.com/topic/276266-syntax-error/#findComment-1421611
Share on other sites

In the future, please place any code you post in code tags by pressing the <> button on the editor.  Also, it's highly unlikely that anyone will read through all that.  You should give us merely the line in question and 2-3 lines above and below it since it's just a parse error.

sorry, i,ll remember in future

Link to comment
https://forums.phpfreaks.com/topic/276266-syntax-error/#findComment-1421772
Share on other sites

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.