Strange error in a very simple PHP file
Hi there
In a very simple .php file where you're basically supposed to enter a
password to then log-on to the backend of a site, I'm getting a very strange
error:
Parse error: syntax error, unexpected $end in
C:\wamp\www\blindza\admin\index.php on line 43
Line 43 actually only has the text "</html>" on it (without the quotes).
In the rest of that file, there's literally just a small bit of code that
basically starts a session right at the top of the code/scripting, checks to
see if you've entered the correct password into the relevant field (if
you've actually submitted the form at all), and then basically tries to do a
redirect of sorts, but the page won't even display any of the HTML, let
alone let you try to actually submit the form since the first time I even
try to load/view the page, all it spits out is that error message.
Any thoughts on this?
FWIW, I'm running the WAMP server, and have tried editing that file using
the PHP coder IDE, TextPal, Notepad++, Notepad etc. etc. to see if there was
maybe some sort of invalid character somewhere, but I haven't found anything
yet even if I tell one or two of the editors to as such display 'all'
characters.
Thanks in advance
Jacob Kruger
Blind Biker
Skype: BlindZA
'...Fate had broken his body, but not his spirit...'
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Strange error in a very simple PHP file
In my experience, it probably means that you're missing a closing brace
or the semicolon on the very last line of PHP code.
Jacob Kruger wrote:
> In a very simple .php file where you're basically supposed to enter a
> password to then log-on to the backend of a site, I'm getting a very
> strange error:
> Parse error: syntax error, unexpected $end in
> C:\wamp\www\blindza\admin\index.php on line 43
>
> Line 43 actually only has the text "</html>" on it (without the quotes).
>
<snip>
--
Jarrett M. T. Meyer
jmtmeyer [at] yahoo.com
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Strange error in a very simple PHP file
Well, 'looked' through the file, and haven't found anything like a missing ;
or ?> so I dunno.
Here's the full source thereof (maybe I'm actually 'missing' something due
to my screenreader not 'seeing' it or something - LOL!)
---start of source---
<?php session_start(); ?>
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title>Backend</title>
<?php
if (array_key_exists("btnGo", $_POST))
{
//echo "here you go...";
if ($_POST("admPass")=="adminpassword")
{
$_SESSION["admin"] = "true";
// echo "<script
type=\"text/javascript\">window.location=\"main.php\";</script>";
RedirectURL("main.php");
}
function RedirectURL($url)
{ // This calls javascript
$redir = "<script
language=\"javascript\">location.href=\"$url\"</script>\n";
return $redir;
}
?>
</head>
<body>
<form method="post" action="index.php" enctype="multipart/form-data"
name="form1">
<table align="center" border="0">
<tr>
<th align="center" colspan="2">
Log-in
</th>
</tr>
<tr>
<th align="right">Password</th>
<td><input type="password" name="admPass" size="50" /></td>
</tr>
<tr>
<th align="center" colspan="2"><input type="submit" name="btnGo"
value="Go" /></th>
</tr>
</table>
</form>
</body>
</html>
---end of source---
Like I said, the line it seems to reckon the problem is on is that very last
line, but it makes sense that the PHP renderer engine thinks it's just
missing something by then - who knows...
Thanks in advance
Jacob Kruger
Blind Biker
Skype: BlindZA
'...Fate had broken his body, but not his spirit...'
----- Original Message -----
From: "Jarrett Meyer" <jmtmeyer [at] yahoo.com>
To: "Jacob Kruger" <jacobk [at] cknet.co.za>
Cc: <php-windows [at] lists.php.net>
Sent: Thursday, January 10, 2008 4:10 PM
Subject: Re: [PHP-WIN] Strange error in a very simple PHP file
> In my experience, it probably means that you're missing a closing brace or
> the semicolon on the very last line of PHP code.
>
> Jacob Kruger wrote:
>> In a very simple .php file where you're basically supposed to enter a
>> password to then log-on to the backend of a site, I'm getting a very
>> strange error:
>> Parse error: syntax error, unexpected $end in
>> C:\wamp\www\blindza\admin\index.php on line 43
>>
>> Line 43 actually only has the text "</html>" on it (without the quotes).
>>
> <snip>
>
> --
> Jarrett M. T. Meyer
> jmtmeyer [at] yahoo.com
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Strange error in a very simple PHP file
No matching "}" for segment started on line 8...
Jacob Kruger wrote:
> Well, 'looked' through the file, and haven't found anything like a
> missing ; or ?> so I dunno.
>
> Here's the full source thereof (maybe I'm actually 'missing' something
> due to my screenreader not 'seeing' it or something - LOL!)
> ---start of source---
> <?php session_start(); ?>
> <!doctype html public "-//W3C//DTD HTML 4.0 //EN">
> <html>
> <head>
> <title>Backend</title>
> <?php
> if (array_key_exists("btnGo", $_POST))
> {
> //echo "here you go...";
> if ($_POST("admPass")=="adminpassword")
> {
> $_SESSION["admin"] = "true";
> // echo "<script
> type=\"text/javascript\">window.location=\"main.php\";</script>";
> RedirectURL("main.php");
>
> }
> function RedirectURL($url)
> { // This calls javascript
> $redir = "<script
> language=\"javascript\">location.href=\"$url\"</script>\n";
> return $redir;
> }
>
> ?>
> </head>
> <body>
> <form method="post" action="index.php" enctype="multipart/form-data"
> name="form1">
> <table align="center" border="0">
> <tr>
> <th align="center" colspan="2">
> Log-in
> </th>
> </tr>
> <tr>
> <th align="right">Password</th>
> <td><input type="password" name="admPass" size="50" /></td>
> </tr>
> <tr>
> <th align="center" colspan="2"><input type="submit"
> name="btnGo" value="Go" /></th>
> </tr>
> </table>
> </form>
> </body>
> </html>
> ---end of source---
>
> Like I said, the line it seems to reckon the problem is on is that
> very last line, but it makes sense that the PHP renderer engine thinks
> it's just missing something by then - who knows...
>
> Thanks in advance
>
> Jacob Kruger
> Blind Biker
> Skype: BlindZA
> '...Fate had broken his body, but not his spirit...'
>
> ----- Original Message ----- From: "Jarrett Meyer" <jmtmeyer [at] yahoo.com>
> To: "Jacob Kruger" <jacobk [at] cknet.co.za>
> Cc: <php-windows [at] lists.php.net>
> Sent: Thursday, January 10, 2008 4:10 PM
> Subject: Re: [PHP-WIN] Strange error in a very simple PHP file
>
>
>> In my experience, it probably means that you're missing a closing
>> brace or the semicolon on the very last line of PHP code.
>>
>> Jacob Kruger wrote:
>>> In a very simple .php file where you're basically supposed to enter
>>> a password to then log-on to the backend of a site, I'm getting a
>>> very strange error:
>>> Parse error: syntax error, unexpected $end in
>>> C:\wamp\www\blindza\admin\index.php on line 43
>>>
>>> Line 43 actually only has the text "</html>" on it (without the
>>> quotes).
>>>
>> <snip>
>>
>> --
>> Jarrett M. T. Meyer
>> jmtmeyer [at] yahoo.com
>>
>> --
>> PHP Windows Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
--
Jarrett M. T. Meyer
jmtmeyer [at] yahoo.com
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Strange error in a very simple PHP file
Ok.
Thanks.
Funny enough one of my first stuff-ups was that I didn't initially realise
that all three different types of parentheses, brackets, and braces were
being used since I was sort of listening for cues as opposed to listening to
specific details, and I suppose this is pretty much related.
I know that one or two of the editing programs I use can in fact sort of do
'matches' for opening and closeing braces {}, and maybe they can then also
double-check for ones that then don't having matching ones or something.
Anyway, thanks again - will fix it and go on from there...
Stay well
Jacob Kruger
Blind Biker
Skype: BlindZA
'...Fate had broken his body, but not his spirit...'
----- Original Message -----
From: "Jarrett Meyer" <
jmtmeyer [at] yahoo.com>
To: "Jacob Kruger" <
jacobk [at] cknet.co.za>
Cc: <
php-windows [at] lists.php.net>
Sent: Thursday, January 10, 2008 4:59 PM
Subject: Re: [PHP-WIN] Strange error in a very simple PHP file
> No matching "}" for segment started on line 8...
>
> Jacob Kruger wrote:
>> Well, 'looked' through the file, and haven't found anything like a
>> missing ; or ?> so I dunno.
>>
>> Here's the full source thereof (maybe I'm actually 'missing' something
>> due to my screenreader not 'seeing' it or something - LOL!)
>> ---start of source---
>> <?php session_start(); ?>
>> <!doctype html public "-//W3C//DTD HTML 4.0 //EN">
>> <html>
>> <head>
>> <title>Backend</title>
>> <?php
>> if (array_key_exists("btnGo", $_POST))
>> {
>> //echo "here you go...";
>> if ($_POST("admPass")=="adminpassword")
>> {
>> $_SESSION["admin"] = "true";
>> // echo "<script
>> type=\"text/javascript\">window.location=\"main.php\";</script>";
>> RedirectURL("main.php");
>>
>> }
>> function RedirectURL($url)
>> { // This calls javascript
>> $redir = "<script
>> language=\"javascript\">location.href=\"$url\"</script>\n";
>> return $redir;
>> }
>>
>> ?>
>> </head>
>> <body>
>> <form method="post" action="index.php" enctype="multipart/form-data"
>> name="form1">
>> <table align="center" border="0">
>> <tr>
>> <th align="center" colspan="2">
>> Log-in
>> </th>
>> </tr>
>> <tr>
>> <th align="right">Password</th>
>> <td><input type="password" name="admPass" size="50" /></td>
>> </tr>
>> <tr>
>> <th align="center" colspan="2"><input type="submit" name="btnGo"
>> value="Go" /></th>
>> </tr>
>> </table>
>> </form>
>> </body>
>> </html>
>> ---end of source---
>>
>> Like I said, the line it seems to reckon the problem is on is that very
>> last line, but it makes sense that the PHP renderer engine thinks it's
>> just missing something by then - who knows...
>>
>> Thanks in advance
>>
>> Jacob Kruger
>> Blind Biker
>> Skype: BlindZA
>> '...Fate had broken his body, but not his spirit...'
>>
>> ----- Original Message ----- From: "Jarrett Meyer" <
jmtmeyer [at] yahoo.com>
>> To: "Jacob Kruger" <
jacobk [at] cknet.co.za>
>> Cc: <
php-windows [at] lists.php.net>
>> Sent: Thursday, January 10, 2008 4:10 PM
>> Subject: Re: [PHP-WIN] Strange error in a very simple PHP file
>>
>>
>>> In my experience, it probably means that you're missing a closing brace
>>> or the semicolon on the very last line of PHP code.
>>>
>>> Jacob Kruger wrote:
>>>> In a very simple .php file where you're basically supposed to enter a
>>>> password to then log-on to the backend of a site, I'm getting a very
>>>> strange error:
>>>> Parse error: syntax error, unexpected $end in
>>>> C:\wamp\www\blindza\admin\index.php on line 43
>>>>
>>>> Line 43 actually only has the text "</html>" on it (without the
>>>> quotes).
>>>>
>>> <snip>
>>>
>>> --
>>> Jarrett M. T. Meyer
>>>
jmtmeyer [at] yahoo.com
>>>
>>> --
>>> PHP Windows Mailing List (
http://www.php.net/)
>>> To unsubscribe, visit:
http://www.php.net/unsub.php
>>>
>>>
>>
>
>
> --
> Jarrett M. T. Meyer
>
jmtmeyer [at] yahoo.com
>
>
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php