Jump to content

[SOLVED] Really annoying PHP errors


havenomercy3

Recommended Posts

Here is the code:

<?php
////////////////////////////////
//Check for config, then include
////////////////////////////////
$filename0 = 'config.php';
if (file_exists($filename0))
{
include 'config.php';
} else {
echo "The configuration file could not be loaded";
exit();
}
////////////////////////////////
//Show Page?
////////////////////////////////
if ($enabld="2")
{
echo "Sorry! The system administrator has chosen to disable the system";
exit();
}
////////////////////////////////
//Set Varriables
////////////////////////////////
$version = "1.0";
////////////////////////////////
//Show content
////////////////////////////////

//Set title
$title = "Alien School - " + $titlec + "";

//Construct Copyright
$copyshow = "Alien School $version by <A HREF='http://www.alienproductionsonline.com'>Alien 

Productions</A><BR>Licensed to: $name<BR>$cline";

//Header
echo "<HTML><HEAD><TITLE>$title</TITLE></HEAD>";

//body tag
echo "<BODY>";

//Skip lines
echo "<BR><BR><BR><BR><BR><BR>";

//Center Everything
echo "<CENTER>";

//If enabled, Define Form
if ($enabld = "1"){
}
else
{
echo "<FORM NAME='CFForm_1' ACTION='###URL HIDDEN FOR PRIVACY###' METHOD=POST>";
}
;
//Define table
;
echo "<table width=225 border=1 cellpadding=3>";
echo "<tr><td colspan=2><center><font size='+2'><b><IMG SRC="logo.gif"></b></font></center></td></tr>";
;
//Decide if enabled
if ($enabld = "1"){
//Username Block
echo "<tr><td><H2>Sorry, Login is disabled</H1></td></tr>";
}
else
{
//Username Block
echo "<tr><td>$usernm:</td><td><INPUT TYPE='Text' NAME='Username' SIZE='12' MAXLENGTH='10' VALUE=''></td></tr>";
//Password block
echo "<tr><td>$passwd:</td><td><INPUT TYPE='password' NAME='Password' SIZE='12' MAXLENGTH='10'></td></tr>";
//Submit Block
echo "<tr><td colspan=2 align=center><input type='Submit' name='Login' value='Enter'></td></tr>";
}
//end
echo "</table></form>";
//Skip lines
echo "<BR><BR><BR>";

//Add Copyright
echo " $copyshow ";

//End page
echo "</BODY></HTML>";


?>

 

It's a simple login script. When I try to open the page on my website I get:

 

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /www/hostbot.com/a/l/i/alien/htdocs/hosted90/index.php on line 58

 

No matter what I do NOTHING FIXES IT!!

*Please note that I am a novice PHP user but I have knowledge in other similar scripting languages

Link to comment
https://forums.phpfreaks.com/topic/125393-solved-really-annoying-php-errors/
Share on other sites

Go to line 58. Why do you have the ; there? And above and below it. What purpose are they serving? (Do they throw errors?)

Also take a look at line 60, I think. You open the string with double quotes then you have wrapped the image src in double quotes. That will throw an error as well.

Thank you that really helped. But! I have another question

 

What is a T_VARRIABLE as in

 

Parse error: syntax error, unexpected T_VARIABLE in /www/hostbot.com/a/l/i/alien/htdocs/hosted90/config.php on line 48

 

From my config file:

<?php


//***********************************
//*PLEASE CHMOD THIS FILE TO 644 !!!*
//***********************************


//===========================================================================
//* --    ~~               Alien Software               ~~    -- *
//===========================================================================
// URL: http://www.alienproductionsonline.com/ 
// Copyright (C) 2008 Alien Productions
// --------------------------------------------------------------------------
// THIS IS THE CONFIGURATION FILE FOR ALIEN
// --------------------------------------------------------------------------
// NOTICE: Do NOT remove the copyright and/or license information any files. 
//         doing so will automatically terminate your rights to use program.
//         
//	   YOU MAY ONLY EDIT THIS FILE BELOW THIS INFORMATION BLOCK!!!
//        
// --------------------------------------------------------------------------
// LICENSE:
//     This program is free software; you can not redistribute it and/or
//     modify it (Except for this page) under the terms of the License
//     Agreement as published by the Alien Productions; 
//     This program is distributed in the hope that it will be useful,
//     but WITHOUT ANY WARRANTY; without even the implied warranty of
//     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
//===========================================================================


///////////////////////////////////
//YOU MAY EDIT BELOW THIS LINE
///////////////////////////////////

//Options

//Your name. Will appear: 'Licensed to: <NAME>'
//Can be anything

	$myname = "Someone"

//Username Text
//Will appear: <TEXT>: <LOGIN BOX>

	$usernam = "Username"

//Password Text
//Will Appear: <TEXT>: <PASSWORD BOX>

	$passwd = "Password"

//Custom Copyright Line
//Adds a custom copyright line under the default copyright
//To enable or disable, change enable1 to
//0=disable
//1=enable

	$enable1 = "0"

	$cline = "COPYRIGHT"

//Enable System???
//0=enabled
//1=login disable
//2=full disable

	$enabld = "0"

//Page title
//will appear: Alien - <TITLE>

	$titlec = "by Alien Productions"

?>

 

Please note that the &#160; is not in my code

to explain the issue, you can't use double quotes in print or echo, unless you escape it (example: \")

So, to do it right, you can either single quote it, or escape the double quote.

<?php
////////////////////////////////
//Check for config, then include
////////////////////////////////
$filename0 = 'config.php';
if (file_exists($filename0))
{
include 'config.php';
} else {
echo "The configuration file could not be loaded";
exit();
}
////////////////////////////////
//Show Page?
////////////////////////////////
if ($enabld="2")
{
echo "Sorry! The system administrator has chosen to disable the system";
exit();
}
////////////////////////////////
//Set Varriables
////////////////////////////////
$version = "1.0";
////////////////////////////////
//Show content
////////////////////////////////

//Set title
$title = "Alien School - " + $titlec + "";

//Construct Copyright
$copyshow = "Alien School $version by <A HREF='http://www.alienproductionsonline.com'>Alien

Productions</A><BR>Licensed to: $name<BR>$cline";

//Header
echo "<HTML><HEAD><TITLE>$title</TITLE></HEAD>";

//body tag
echo "<BODY>";

//Skip lines
echo "<BR><BR><BR><BR><BR><BR>";

//Center Everything
echo "<CENTER>";

//If enabled, Define Form
if ($enabld = "1"){
}
else
{
echo "<FORM NAME='CFForm_1' ACTION='###URL HIDDEN FOR PRIVACY###' METHOD=POST>";
}
;
//Define table
;
echo "<table width=225 border=1 cellpadding=3>";
echo "<tr><td colspan=2><center><font size='+2'><b><IMG SRC='logo.gif'></b></font></center></td></tr>";
;
//Decide if enabled
if ($enabld = "1"){
//Username Block
echo "<tr><td><H2>Sorry, Login is disabled</H1></td></tr>";
}
else
{
//Username Block
echo "<tr><td>$usernm:</td><td><INPUT TYPE='Text' NAME='Username' SIZE='12' MAXLENGTH='10' VALUE=''></td></tr>";
//Password block
echo "<tr><td>$passwd:</td><td><INPUT TYPE='password' NAME='Password' SIZE='12' MAXLENGTH='10'></td></tr>";
//Submit Block
echo "<tr><td colspan=2 align=center><input type='Submit' name='Login' value='Enter'></td></tr>";
}
//end
echo "</table></form>";
//Skip lines
echo "<BR><BR><BR>";

//Add Copyright
echo " $copyshow ";

//End page
echo "</BODY></HTML>";


?>

////////////////////////////////

//Show Page?

////////////////////////////////

if ($enabld="2")

 

it needs to == signs

 

should be

 

if ($enabld=="2")

 

edit

everywhere you have an iff statement you need to fix it like i said

make it so it has == instead of =

Ok, so I need to change all my = to == and add ; to the and of variables.

 

Then I need to get rid of the quotes around echo, but that doesn't make sense to me.

 

Take a look at this quote from the php.net manual:

<?php
$filename = '/path/to/foo.txt';

if (file_exists($filename)) {
    echo "The file $filename exists";
} else {
    echo "The file $filename does not exist";
}
?>

There are quotes around all the echo statements

 

The above script works, I tried it myself

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.