Jump to content

Help, please!


rpope904

Recommended Posts

I am trying to write a php script, that writes a php file.. all is going good until line 180.. Here's the error:

 

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/rpope904/public_html/x10chat/signup_2.php on line 180

 

Here's the code:

 

LINE 176> $stringData = "<param name=\"CABINETS\" value=\"irc.cab,securedirc.cab,pixx.cab\">\n";

LINE 177> fwrite ($fh, $stringData);

LINE 178> $stringData = "<?\n";

LINE 179> fwrite ($fh, $stringData);

LINE 180> $stringData = "$ni = $_POST[\'nickname\']; \n";

LINE 181> fwrite ($fh, $stringData);

LINE 182> $stringData = "echo \"<param name=nick value=\".$ni.\"_xC\">\n";

LINE 183> fwrite ($fh, $stringData);

LINE 184> $stringData = "?>\n";

 

Basically, what I need it to write to the file is:

<?

$ni = $_POST['nickname'];  LINE 180

echo "<param name=nick value=".$ni."_xC>\n"; LINE 182

?>

Link to comment
Share on other sites

this would fix your problem

$stringData = "$ni = {$_POST['nickname']}; \n";

 

but if you're generating a php file, wouldn't you want to literally write that string to the file, as in

$stringData = '$ni = $_POST["nickname"];'."\n";

 

Otherwise your generated php file will contain the value of $ni rather than literally $ni.

 

Try echoing out both the statements I've shown to see the difference.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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