Jump to content

Recommended Posts

Posted
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/deathea/public_html/khaleel/html/userarea.php on line 76

 

Line 76 Reads

 

><font face='Verdana' size='1'>Welcome Back <?php print $_SESSION['user']; 
     // Print out admin links
     if($_SESSION['permission'] > 1){
     <a href = 'modUser.php'>mod user</a>|<a href = 'delUser.php'>del user</a>|<?php
     }
     ?></font>

 

I need help with this, can anyone help me please?

Posted

Please read the fourm guidlines.

 

o Family Members may not bump threads.

 

Only 2 hours have past since you posted your question. Maybe someone who could help has not read the post yet.

 

I know you are looking for an answer and if someone knows the answer I am sure they will respond.

Posted

To be honest I think more info is needed.

like what script and a link

and when the error is displayed

 

the more info the better.

 

And remember most of the family here may be at work during the day.

Posted

I don't know about the error specifically, but right now the PHP has a second opening tag in the middle of it and the html within the brackets isn't set up to actually do anything--the PHP engine is trying to render it as PHP and not HTML, I think. Which could be enough to trigger that error.

 

Try:

 

><font face='Verdana' size='1'>Welcome Back <?php print $_SESSION['user'];

if ($_SESSION['permission'] > 1) {

echo "<a href='modUser.php'>mod user</a>|<a href='delUser.php'>del user</a>";

} ?>
</font>

 

One word of warning--the way it's set right now, it would be possible for someone to randomly set up a permission value of, say 1000, and it would print out this bit of menu. If you know the actual permission values of your admin users, it would be better to set up something like

 

>if ($_SESSION'permission'] == (1|2|3)) {

 

I'm not certain that's the exact syntax, but something like that would be more secure--look for an exact permissions match, instead of "any number greater than 1."

Posted

In your original code, you just missed the first closing PHP tag (right before the HTML string):

<font face='Verdana' size='1'>Welcome Back <?php print $_SESSION['user'];

    // Print out admin links

    if($_SESSION['permission'] > 1){

    ?>

    <a href = 'modUser.php'>mod user</a>|<a href = 'delUser.php'>del user</a>|<?php

    }

    ?></font>

Posted

Did not fix all of the code, problem was example

 

><?php
echo'<a href="page.asp?go=shop">Go the shop</a>';
// as you can see, the quotes are " and should be '
?>

 

It should be

 

><?php
echo"<a href='Page.aspx?Go=Shop'>Go the shop</a>";
// quotes are fine and work they should be '
?>

 

Done :) thanks all anyways

Posted
// as you can see, the quotes are " and should be '

Try putting a space between the "echo" and the first quote. Both the examples you gave should work just fine.

Posted

Actually, Kaz, changing the quotes from " to ' in your HTML is not correct, although it will work on many or perhaps most web browsers.

 

What you want to do is type in /" when you are typing a string to be output to the browser and need to have a quote. The backslash is the "escape code" -- it tells PHP "No, this isn't the end of my string; I want to put an ACTUAL quote mark INSIDE the string, please!"

 

><?php
echo "<a href=\"Page.aspx?Go=Shop\">Go the shop</a>";
?>

 

See this link for more complete info on how to format PHP strings: PHP Manual page on string data

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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