Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error on line 37, HELP!!!

Status
Not open for further replies.

clodhoppers18

Programmer
Mar 22, 2007
6
0
0
US
I am getting this error:
Parse error: syntax error, unexpected T_LOGICAL_OR in /mounted-storage/home50a/sub005/sc34114-DSXR/fsfilelib.info/uploader.php on line 37
I am using this HTML form:

Code:
<form action="uploader.php" method="post" enctype="multipart/form-data">
  <div align="left">
    <h4><span class="style10"><strong>Name of File </strong>
        <input type="text" name="name" size="42"/>
        <br />
        <br />
        <strong>Type</strong>
        <select name="type">
          <option value="none">------</option>
          <option value="Aircraft">Aircraft</option>
          <option value="Scenery">Scenery</option>
          <option value="Sound">Sound</option>
          <option value="Utilities">Utilities</option>
          <option value="AI">AI Stuff</option>
          <option value="Panels">Panels</option>
          <option value="ATC">ATC Utilities</option>
          <option value="Demos">Demos</option>
          <option value="Other">Other</option>
        </select>
        <br />
        <br />
        <strong>Description:</strong><br />
        <textarea name="desc" cols="54" rows="4">Enter Long Description Here</textarea>
        <br />
        <br />
        <strong>File:</strong><br />
        <input type="file" name="file" size="45"/><br />
    </span>          
      <input type="reset" name="Submit2" value="Reset" />
      <span class="style10">
      <input type="submit" name="Submit" value="Submit" />
      </span></h4>
  </div>
</form>
to report to this PHP script:
Code:
<?PHP
define("legitrequest", 1);
# setting.php contain MySQL database setting and other setting it contain also the FSP UNIT SETTING
require ("connect/setting.php");
# common.php do the connexion to MySQL the value $databaseconnexion is set to true if the connexion is okay
require ("connect/common.php");
// the value "$databaseconnexion" is set to true in common.php if the connexion is ok
if ($databaseconnexion == false)
{
    echo "Error - unable to connect to mySQL database;";
    return;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

$type = stripslashes($POST['type']);
$name = stripslashes($POST['name']);
$desc = stripslashes($POST['desc']);
$loc = "uploads/$type/{$_FILES['upload'] ['name']}";
if ($_FILES['file']['name'] != "")
{
    if (move_uploaded_file($_FILES['upload']['tmp_name'], "uploads/$type/{$_FILES['upload'] ['name']}"))
    {
        if ($uploaded_size > 3500000)
        {
            die "Your file is too large.<br>";
            $ok = 0;
        }
        else
        {
            $sql = "INSERT INTO `filelist` (id,datestamp,type,name,desc,filetype,location) VALUES ('',now(),$type,$name,$desc,$filetype,$loc);";
            $sql_update = @mysql_query($sql);

            echo '<p>Your File was uploaded successful, please allow up to 48 hours for your download to be processed.</p>';
        }
    }
    else
    {
        die ("Could Not Copy File");
    }
}
else
{
    die ("No File Specified");
}
?>
I am trying to have this upload a file to the web space, and report details to a MySQL database.
I cannot figure out why on line 37 it says "unexpected T_LOGICAL_OR" error. I have moved things around and I still get this error. PLEASE HELP.

Many Thanks in Advance,
Dustin
 
I cannot reproduce your error. however the script will still fail the parser test. you need to change line 25 as follows
Code:
            die [red]([/red]"Your file is too large.<br>"[red])[/red];	//CHANGED TO INCLUDE BRACKETS
 
Is the file above the uploader.php file mentioned in the error message, or is that another include somewhere else?
Which line is 37? When I pasted the bove code into an editor I came up with a curly brace as line 37 :p

 
Code:
36|    else
37|    {
38|        die ("Could Not Copy File");
39|    }
40|}
41|else

I changed the
die ("Your file is too large.<br>");
and I still get the same error. there are no includes, etc.

I have no clue why I get the error.
 
I can't see your entire code and I'm only a beginner but do you have any OR statements in your code? I read an article somewhere about a T_Logical error being defined in the error such as T_Logical_OR or another example is a T_Logical_If

Not sure if that will help or not but I'm trying to contribute.
 
According to Appendix R of the PHP online manual (link), "T_LOGICAL_OR" refers specifically to the operator "OR". The "||" operator is listed as "T_BOOLEAN_OR". The "|" bitwise or-operator is not listed in the table.

I only see the string "or" appear in the posted script in two places, neither seems significant.



Want the best answers? Ask the best questions! TANSTAAFL!
 
According to Appendix R of the PHP online manual (link), "T_LOGICAL_OR" refers specifically to the operator "OR". The "||" operator is listed as "T_BOOLEAN_OR". The "|" bitwise or-operator is not listed in the table.

I only see the string "or" appear in the posted script in two places, neither seems significant.
and what is this supposed to mean?
 
it means that sleipnir214 has gone to the trouble of checking the manual for you and ascertained what php means when it complains about T_LOGICAL_OR.

he has then checked the code for you and has found two instances of "or" neither or which, in his opinion, are the source of your error.

I also cannot see anything in your code that would produce the error that you quote. i've recreated your code on my servers and cannot reproduce the error. it is very difficult to assist if we cannot reproduce the error.
 
Yeah. Are you sure that the script you posted is the one PHP is complaining about?

Is what you posted the entire script, or just a snippet?



Want the best answers? Ask the best questions! TANSTAAFL!
 
I got it working, it seems as though it was being a random pain. my entire code posted is all the code i have minus the database connection but that is proven to work because I have several other scripts that use it just fine.

Thank you all for trying, and I didnt do anything to the code and it started working all of the sudden.

Thanks,
Dustin
 
yes, but if it is "Randomly" working now, what will stop it from "randomly" not working when you put it into production?
I don't think this would be giving you a logical error, but I noticed an extra space on two lines (might just be TT reformatting):
Code:
$loc = "uploads/$type/{$_FILES['upload'][highlight] [/highlight]['name']}";
if ($_FILES['file']['name'] != "")
{
    if (move_uploaded_file($_FILES['upload']['tmp_name'], "uploads/$type/{$_FILES['upload'][highlight] [/highlight]['name']}"))
    {

If those two are in your code you should be getting an error. I've done those enough myself to know that it should be complaining about expecting an ending brace :p

 
Yeah, I hate code that magically fixes itself.

I noticed those spaces, too. But PHP seems to be whitespace-agnostic.

On my system the following:

Code:
<?php
$a = array('a' => array ('c', 'd', 'e'));

print $a['a']          [0];
//           1234567890
?>

outputs:

[tt]c[/tt]





Want the best answers? Ask the best questions! TANSTAAFL!
 
Odd, I could have sworn I tried that this morning (inside a string) and it failed on me as I expected to...
I just tried it on my two desktops at work (windows and linux) and it worked. I think I am losing my mind (or using a very old version of PHP on one of my machines at home maybe).

Unfortunately that was the only thing I saw that looked odd.

 
i think js burps when you try it something similar though.
 
i was surmising as to why Tarwn may have thought that php objected to such treatment.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top