Reply
unexpected $end
Old 11-14-2007, 05:54 PM unexpected $end
Experienced Talker

Posts: 33
Name: matt
I get
PHP Code:
Parse errorsyntax errorunexpected $end in /home/--------/public_html/adminutil/install.php on line 119 
My Script is:
PHP Code:
<!-- Begin Install Fyle -->
<html> 
<head> 
<style type="text/css"> 
.tbl1 

background: url('back.jpg'); 
background-repeat: no-repeat; 

</style> 
<title>MediaWiki Admin Utility - Installer</title>
</head> 
<body bgcolor="#FFFFFF" link="#CC0000" vlink="#CC0000" >
<table border="0" cellpadding="0" cellspacing="0" class="tbl1" width="647">
  <tr> 
    <td colspan="4"><img src="single_pixel.gif" width="740" height="1" border="0"></td>
  </tr>
  <tr valign="top"> 
    <td width="60%" height="91">
    <img border="0" src="images/back.jpg" width="782" height="159"></td>
    <td width="40%" height="91" colspan="3" valign="top" align="center"> 

    </td>
  </tr>
  <tr> 
    <td colspan="3"  > 
  <tr> 
    <td valign="top" colspan="4"> 
      <table width="100%" border="0" cellspacing="15">
        <tr>
          <td width="18%" valign="top">
            <p style="margin-top: 0; margin-bottom: 0"><img src="single_pixel.gif" width="140" height="1"><br>
            <b><a href=http://troop439md.net/>Home</a></b><br />
            <b><a href=http://troop439md.net/admin.php>Utility Home</a></b>

          <td width="76%"> 
            <h2>Install Utility</h2>
<?
$installfile 
'installconfig.php';

if (
file_exists($installfile)) { 
    print 
"It apears MediaWiki Admin Utilities are already installed!"
    exit;
} else { 
    print 
"The installation will now begin!"

$stage $_GET['install']; 
if ( 
$stage == "2" ) {
    
$dbloc=$_POST['dbloc'];
    
$dbname=$_POST['dbname'];
    
$dbuser=$_POST['dbuser'];
    
$dbpass=$_POST['dbpass'];
    
$dbprefix=$_POST['dbprefix'];
    
mysql_connect($dbloc,$$dbuser,$dbpass);
    @
mysql_select_db($dbname) or die( "Invalid Database Information!");
    echo 
'Connected To Database';
    
$sql 'ALTER TABLE `'$dbprefix 'user` ADD `undel` CHAR(1) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL;';
    
mysql_close(); 
    
$File "installconfig.php"
    
$Handle fopen($File'w');
    
$Data '$dbloc\n'
    
fwrite($Handle$Data); 
    
$Data '$dbname\n'
    
fwrite($Handle$Data);
    
$Data '$dbuser\n'
    
fwrite($Handle$Data); 
    
$Data '$dbpass\n'
    
fwrite($Handle$Data);
    
$Data '$dbprefix\n'
    
fwrite($Handle$Data);
    print 
"Executed MySQL Commands"
    
fclose($Handle); 
} elseif ( 
$stage == "3" ) {
    echo 
'Now We Need Site Information!<br />';
    echo <<<END
    <form action="install.php?install=4" method="post">
    Site Name: <input type="text" name="sitename" />
    Site Password: <input type="text" name="sitepass" />
    <input type="submit" />
    </form>
    END;
    echo '<center>The password allows entery to the admin utility</center>';
} elseif ( $stage == "4" ) {
    echo 'Making Config File:';
    $File = "installconfig.php"; 
    $Handle = fopen($File, 'a');
    $Data = "$sitename\n"; 
    fwrite($Handle, $Data); 
    $Data = "$sitepass\n"; 
    fwrite($Handle, $Data); 
    print "File Made"; 
    fclose($Handle); 
    echo 'Install Complete! Click <a href=index.php>here</a> to go to the Utility';
} else {
    echo "Step One<br />";
    echo <<<END
    <form action="install.php?install=2" method="post">
    Database location(localhost): <input type="text" name="dbloc" />
    Database name: <input type="text" name="dbname" />
    Database user: <input type="text" name="dbuser" />
    Database password: <input type="text" name="dbpass" />
    Database prefix: <input type="text" name="dbprefix" />
    <input type="submit" />
    </form>
    END;
}
echo 'Installer Version 4';
?>
</td>
        </tr>
      </table>
      <h2>&nbsp;</h2>
      </td>
  </tr>
</table> 
<div align="center"><br>
  &nbsp;</div>
</body> 
</html>
I've tried everything but can't get it to work?

thanks
melefire is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 11-14-2007, 06:08 PM Re: unexpected $end
NullPointer's Avatar
Will Code for Food

Posts: 502
Name: Matt
Location: Irvine, CA
My first guess is there is something wrong with your heredoc syntax. Can you mark line 119 please.
__________________
http://tinsology.com/ - Under construction
NullPointer is online now
Reply With Quote
View Public Profile
 
Old 11-14-2007, 06:18 PM Re: unexpected $end
Experienced Talker

Posts: 33
Name: matt
line 119 is the last line
melefire is offline
Reply With Quote
View Public Profile
 
Old 11-14-2007, 06:22 PM Re: unexpected $end
NullPointer's Avatar
Will Code for Food

Posts: 502
Name: Matt
Location: Irvine, CA
Try this code:

PHP Code:
<!-- Begin Install Fyle --> 
<html>  
<head>  
<style type="text/css">  
.tbl1  
{  
background: url('back.jpg');  
background-repeat: no-repeat;  
}  
</style>  
<title>MediaWiki Admin Utility - Installer</title> 
</head>  
<body bgcolor="#FFFFFF" link="#CC0000" vlink="#CC0000" > 
<table border="0" cellpadding="0" cellspacing="0" class="tbl1" width="647"> 
  <tr>  
    <td colspan="4"><img src="single_pixel.gif" width="740" height="1" border="0"></td> 
  </tr> 
  <tr valign="top">  
    <td width="60%" height="91"> 
    <img border="0" src="images/back.jpg" width="782" height="159"></td> 
    <td width="40%" height="91" colspan="3" valign="top" align="center">  

    </td> 
  </tr> 
  <tr>  
    <td colspan="3"  >  
  <tr>  
    <td valign="top" colspan="4">  
      <table width="100%" border="0" cellspacing="15"> 
        <tr> 
          <td width="18%" valign="top"> 
            <p style="margin-top: 0; margin-bottom: 0"><img src="single_pixel.gif" width="140" height="1"><br> 
            <b><a href=http://troop439md.net/>Home</a></b><br /> 
            <b><a href=http://troop439md.net/admin.php>Utility Home</a></b> 

          <td width="76%">  
            <h2>Install Utility</h2> 
<? 
$installfile 
'installconfig.php'

if (
file_exists($installfile)) {  
    print 
"It apears MediaWiki Admin Utilities are already installed!";  
    exit; 
} else {  
    print 
"The installation will now begin!";  
}  
$stage $_GET['install'];  
if ( 
$stage == "2" ) { 
    
$dbloc=$_POST['dbloc']; 
    
$dbname=$_POST['dbname']; 
    
$dbuser=$_POST['dbuser']; 
    
$dbpass=$_POST['dbpass']; 
    
$dbprefix=$_POST['dbprefix']; 
    
mysql_connect($dbloc,$$dbuser,$dbpass); 
    @
mysql_select_db($dbname) or die( "Invalid Database Information!"); 
    echo 
'Connected To Database'
    
$sql 'ALTER TABLE `'$dbprefix 'user` ADD `undel` CHAR(1) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL;'
    
mysql_close();  
    
$File "installconfig.php";  
    
$Handle fopen($File'w'); 
    
$Data '$dbloc\n';  
    
fwrite($Handle$Data);  
    
$Data '$dbname\n';  
    
fwrite($Handle$Data); 
    
$Data '$dbuser\n';  
    
fwrite($Handle$Data);  
    
$Data '$dbpass\n';  
    
fwrite($Handle$Data); 
    
$Data '$dbprefix\n';  
    
fwrite($Handle$Data); 
    print 
"Executed MySQL Commands";  
    
fclose($Handle);  
} elseif ( 
$stage == "3" ) { 
    echo 
'Now We Need Site Information!<br />'
    echo 
'<form action="install.php?install=4" method="post"> 
    Site Name: <input type="text" name="sitename" /> 
    Site Password: <input type="text" name="sitepass" /> 
    <input type="submit" /> 
    </form>'

    echo 
'<center>The password allows entery to the admin utility</center>'
} elseif ( 
$stage == "4" ) { 
    echo 
'Making Config File:'
    
$File "installconfig.php";  
    
$Handle fopen($File'a'); 
    
$Data "$sitename\n";  
    
fwrite($Handle$Data);  
    
$Data "$sitepass\n";  
    
fwrite($Handle$Data);  
    print 
"File Made";  
    
fclose($Handle);  
    echo 
'Install Complete! Click <a href=index.php>here</a> to go to the Utility'
} else { 
    echo 
"Step One<br />"
    echo 
'<form action="install.php?install=2" method="post"> 
    Database location(localhost): <input type="text" name="dbloc" /> 
    Database name: <input type="text" name="dbname" /> 
    Database user: <input type="text" name="dbuser" /> 
    Database password: <input type="text" name="dbpass" /> 
    Database prefix: <input type="text" name="dbprefix" /> 
    <input type="submit" /> 
    </form> '
;

echo 
'Installer Version 4'
?> 
</td> 
        </tr> 
      </table> 
      <h2>&nbsp;</h2> 
      </td> 
  </tr> 
</table>  
<div align="center"><br> 
  &nbsp;</div> 
</body>  
</html>
__________________
http://tinsology.com/ - Under construction
NullPointer is online now
Reply With Quote
View Public Profile
 
Old 11-14-2007, 06:38 PM Re: unexpected $end
Experienced Talker

Posts: 33
Name: matt
i can do the fist step, but when it comes to the second i get
Code:
Parse error: syntax error, unexpected $end in /home/********/public_html/adminutil/install.php on line 119
melefire is offline
Reply With Quote
View Public Profile
 
Old 11-14-2007, 07:03 PM Re: unexpected $end
NullPointer's Avatar
Will Code for Food

Posts: 502
Name: Matt
Location: Irvine, CA
http://www.mydigitallife.info/2006/0...nexpected-end/

Read that and see if you can fix it. Short open tags btw is the <? tag you are using. <?php is the long version. Short open tags are allowed by default in the php ini file but you may want to use long just to see if that's your problem (I doubt it).
__________________
http://tinsology.com/ - Under construction
NullPointer is online now
Reply With Quote
View Public Profile
 
Old 11-14-2007, 09:25 PM Re: unexpected $end
Extreme Talker

Posts: 235
Location: United States
From your original post, I see you are using the echo <<<END .... END; syntax. In order for that to work properly, the closing END; must be the first item on its line.

PHP Code:
// Invalid example:
echo <<<END
    Lorem
    Ipsum
    blah
    blah
    END;

// Valid example:
echo <<<END
    Lorem
    Ipsum
    blah
    blah
END; 
Remember that all of the spacing that you include in that echo statement will be written to the output.

If that doesn't fix the problem, then you may have an unclosed curly brace somewhere. I think I sometimes get your error when I forget the a closing brace in my scripts.

Also, I noticed something else that could be a typo in the code (but it wouldn't cause this problem.) You have a double $$ for $dbuser, and it doesn't look like it should be in this case:
PHP Code:
mysql_connect($dbloc,$$dbuser,$dbpass); 
__________________
The interlocking pieces of web development: usability, performance, accessibility, and standards.
frost is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to unexpected $end
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.14599 seconds with 12 queries