Jump to content

Parse error by declaring a var


Go to solution Solved by Jacques1,

Recommended Posts

i tried to declare a var and it throw out following:

Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in D:\XAMPPmm\htdocs\***\USM\Help.php on line 17
 

  $msg = "Your Blocked for this service <?php echo $userRow['UzRI']; ?>, <br>why dont you check on your emails and see the reason why; for taking some further aktions and getting around, faced to this fact? <br>or maybe you contact us via email at: support@(NAME_).com for some help to get arround this problem.";

any suggestions ?

 

Link to comment
https://forums.phpfreaks.com/topic/301776-parse-error-by-declaring-a-var/
Share on other sites

This doesn't make any sense. You cannot switch into PHP mode within a string, because a string isn't a script. It's a bunch of text. You can theoretically insert variables into strings, but then you'll quickly end up with cross-site scripting vulnerabilities (or in less technical terms: people will inject malicious JavaScript code into your page).

 

Use HTML-escaping and string concatenation:

<?php

function html_escape($raw_input, $encoding)
{
    return htmlspecialchars($raw_input, ENT_QUOTES | ENT_SUBSTITUTE, $encoding);
}



$name = 'Joe';
$msg = 'Hello '.html_escape($name, 'UTF-8').', welcome to my site.';

echo $msg;
  • Like 1
$msg = "Your Blocked for this service " . $userRow['UzRI'] . " <br>why dont you check on your emails and see the reason why; for taking some further aktions and getting around, faced to this fact? <br>or maybe you contact us via email at: support@(NAME_).com for some help to get arround this problem."; 

Like this ? or is this still vurn ?

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.