Jump to content
xisto Community
Sign in to follow this  
electriic ink

Parse: Error Unexpected T_lnumber php parse error when running script

Recommended Posts

Hi. I've just created a php script. The main object of the script is to delete some old files and replace it with a new file with some new content, effectively moving the contents from one file to another.

 

These are the first 50 lines of the file:

 


 

$a_stream = fopen($a_B . ".cmat", "w+");

fwrite($a_stream, $new_page_contents);

fclose($a_stream);

 

/* Calculate For The "B" Group - The Group Of The Games UniQue Numbers */

 

 

$b_1 = file_get_contents("/home/cmatcme/public_html/games/b_1.dat");

$b_2 = file_get_contents("/home/cmatcme/public_html/games/b_2.dat");

$b_3 = file_get_contents("/home/cmatcme/public_html/games/b_3.dat");

[highlight=yellow]$b_4 = file_get_contents("/home/cmatcme/public_html/games/b_4.dat");[/highlight]

$b_5 = file_get_contents("/home/cmatcme/public_html/games/b_5.dat");

 

unlink("/home/cmatcme/public_html/games/b_6.dat");

 

$b6_stream = fopen("/home/cmatcme/public_html/games/b_6.dat", "w+");

fwrite($6_stream, $b_1);

fclose($6_stream);

 

unlink("/home/cmatcme/public_html/games/b_5.dat");

 

$b5_stream = fopen("/home/cmatcme/public_html/games/b_5.dat", "w+");

fwrite($5_stream, $b_2);

fclose($5_stream);

 

unlink("/home/cmatcme/public_html/games/b_4.dat");

 

$b4_stream = fopen("/home/cmatcme/public_html/games/b_4.dat", "w+");

fwrite($4_stream, $b_3);

fclose($4_stream);

 

unlink("/home/cmatcme/public_html/games/b_3.dat");

 

$b3_stream = fopen("/home/cmatcme/public_html/games/b_3.dat", "w+");

fwrite($3_stream, $b_4);

fclose($3_stream); linenums:0'><? /* Calculate For The "A" Group - The Latest Games ID */ $a_B = 002; while(file_exists("a_" . $a_B . ".dat")) { $a_B++; } $new_page_contents = " <? $title = \"" . $_POST["new_name"] . "\"; include \"/home/cmatcme/public_html/header.php\"; echo = \"<h3>" . $_POST["new_name"] . "</h3> " . $_POST["new_desc"] . " <object> <embed src='" . $_POST["new_game_url"] . "'> </object> include \"/home/cmatcme/public_html/footer.php\"; ?> "; $a_stream = fopen($a_B . ".cmat", "w+"); fwrite($a_stream, $new_page_contents); fclose($a_stream); /* Calculate For The "B" Group - The Group Of The Games UniQue Numbers */ $b_1 = file_get_contents("/home/cmatcme/public_html/games/b_1.dat"); $b_2 = file_get_contents("/home/cmatcme/public_html/games/b_2.dat"); $b_3 = file_get_contents("/home/cmatcme/public_html/games/b_3.dat"); [highlight=yellow]$b_4 = file_get_contents("/home/cmatcme/public_html/games/b_4.dat");[/highlight] $b_5 = file_get_contents("/home/cmatcme/public_html/games/b_5.dat"); unlink("/home/cmatcme/public_html/games/b_6.dat"); $b6_stream = fopen("/home/cmatcme/public_html/games/b_6.dat", "w+"); fwrite($6_stream, $b_1); fclose($6_stream); unlink("/home/cmatcme/public_html/games/b_5.dat"); $b5_stream = fopen("/home/cmatcme/public_html/games/b_5.dat", "w+"); fwrite($5_stream, $b_2); fclose($5_stream); unlink("/home/cmatcme/public_html/games/b_4.dat"); $b4_stream = fopen("/home/cmatcme/public_html/games/b_4.dat", "w+"); fwrite($4_stream, $b_3); fclose($4_stream); unlink("/home/cmatcme/public_html/games/b_3.dat"); $b3_stream = fopen("/home/cmatcme/public_html/games/b_3.dat", "w+"); fwrite($3_stream, $b_4); fclose($3_stream);


Line 31 has been highlighed in red as that is where the error apparently is. This is the error:

 

Parse error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /home/cmatcme/public_html/games/XXXXX.cmat on line 31

That line is no different to any of the others surrounding it, so why that line?

Share this post


Link to post
Share on other sites

Are you sure that the file exists? If it doesn't then you've effectively got code which says: $b_4 =

It may seem simple, but it's often the simple things that people miss ;)

However, when I counted down I got the 31st line as the one which says:

fwrite($6_stream, $b_1);

I don't see anywhere in the code where you set a value for $6_stream, so you are creating a file with a blank name.

Just another thought. PHP is very temperamental.

Share this post


Link to post
Share on other sites

* Changes Code *Oh yeah. ;) Makes you wonder how you can miss something like that even after trying to figure it out for about 1/2hr.Thanks for your help, rvalkass!/~* Locked

Share this post


Link to post
Share on other sites

Hope you can answer my question

Parse: Error Unexpected T_lnumber

 

I have an annoying php problem. I am a Newbie and cannot sleep because of this.

 

Parse error: parse error, unexpected T_LNUMBER

 

Below is the php script:

 

 

<?PHP

//Modify your data in this section

//----------------------------------------------------------------------------------

$username = "goddy"; // Admin username

$password = "kennel"; // Admin password

//----------------------------------------------------------------------------------

 

//----------------------------------------------------------------------------------

 

//First, define the modules you want to be displayed : Google, Yahoo, Amazon and the number of news displayed

$show_google = "1"; // Show google ads ?

$show_yahoo ="0"; //Show yahoo ads? WARNING : Be sure not to have both show_google and show_yahoo enabled

$show_amazon = "1"; // Show Amazon feed ?

$_numResults ="5"; // Number of news displayed in each page

$_linksResults = "5"; // Number of links on links pages

$use_privacy_policy = "1"; // Enable privacy policy page?

$use_terms_of_service = "1"; // Enable TOS page?

$use_contact_page = "1"; // Enable contact page?

$use_top_links = "1"; // Enable links page?

$use_products = "1"; // Enable recommended products?

$use_image_rotation = "1"; // Enable image rotation?

 

//-----------------------------------------------------------------------------------

 

// Configuration of your local installation and personal site definitions

$templatefoldername="includes"; //folder where templates are installed relative to the DocumentRoot.

$mysitename = "biggydaddy"; //name for your site

$mainkeyword = "biggydaddy"; //primary site keyword

 

//-----------------------------------------------------------------------------------

 

// your personnal affiliate ID in the following programs

$adsense_pub = "pub-56156429875626"; //your adsense publisher code

$adsense_channel = ""; // adsense channel

$yahoo_pub =""; // your Yahoo Publisher code YPN

$yahoo_channel=""; // your Yahoo channel

$Aassociates_id=array(

'uk' => 'INVALID' , // <-- replace INVALID with your amazon.Co.Uk associate ID

'us' => 'some-20' ,// <-- replace INVALID with your amazon.Com associate ID

);

$num_amazon = "5"; //Max number of amazon products to return

//-------------------------------------------------------------------------------------

 

?>

 

-reply by Julien

Share this post


Link to post
Share on other sites

Did I do something wrong?

Parse: Error Unexpected T_lnumber

 

I sent an question and no one replied to me. Did I do something wrong by posting a question about my problem? or do you take a long time to answer the posts?

 

Thanks.. Just tired of trying to get my site up

 

 

Below is the php script:

 

 

<?PHP

//Modify your data in this section

//----------------------------------------------------------------------------------

$username = "goddy"; // Admin username

$password = "kennel"; // Admin password

//----------------------------------------------------------------------------------

 

//----------------------------------------------------------------------------------

 

//First, define the modules you want to be displayed : Google, Yahoo, Amazon and the number of news displayed

$show_google = "1"; // Show google ads ?

$show_yahoo ="0"; //Show yahoo ads? WARNING : Be sure not to have both show_google and show_yahoo enabled

$show_amazon = "1"; // Show Amazon feed ?

$_numResults ="5"; // Number of news displayed in each page

$_linksResults = "5"; // Number of links on links pages

$use_privacy_policy = "1"; // Enable privacy policy page?

$use_terms_of_service = "1"; // Enable TOS page?

$use_contact_page = "1"; // Enable contact page?

$use_top_links = "1"; // Enable links page?

$use_products = "1"; // Enable recommended products?

$use_image_rotation = "1"; // Enable image rotation?

 

//-----------------------------------------------------------------------------------

 

// Configuration of your local installation and personal site definitions

$templatefoldername="includes"; //folder where templates are installed relative to the DocumentRoot.

$mysitename = "biggydaddy"; //name for your site

$mainkeyword = "biggydaddy"; //primary site keyword

 

//-----------------------------------------------------------------------------------

 

// your personnal affiliate ID in the following programs

$adsense_pub = "pub-56156429875626"; //your adsense publisher code

$adsense_channel = ""; // adsense channel

$yahoo_pub =""; // your Yahoo Publisher code YPN

$yahoo_channel=""; // your Yahoo channel

$Aassociates_id=array(

'uk' => 'INVALID' , // <-- replace INVALID with your amazon.Co.Uk associate ID

'us' => 'some-20' ,// <-- replace INVALID with your amazon.Com associate ID

);

$num_amazon = "5"; //Max number of amazon products to return

//-------------------------------------------------------------------------------------

 

?>

 

 

-question by jULIEN

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.