1

With some if/else PHP statement, I can show or hide some divs depending on if the profile page being checked out by a user belongs to that user or not.

For instance,

$id = $_SESSION['id'];
if ($uid == $id)
{
?>
<div id="block_user"></div>
<?php }
else { ?>
<div id="block_user" style="display:none"></div>
<?php
}  ?>

The issue is even if the profile I'm checking out doesn't belong to me, if I inspect the element with Google webmaster tool, and remove

style="display:none"

the div becomes visible again.

How could I prevent that?

3 Answers 3

3

just remove the else part

<?php
if ($uid == $id) {
?>
<div id="block_user"></div>
<?php } ?>
Sign up to request clarification or add additional context in comments.

1 Comment

I will, i have to wait 10 minutes though
1

If you want to hide stuff for real you have to dynamically create it within the PHP code... Such as :

<php

    if ($uid == $id){
     echo '<div id="block_user"></div>';
    }

?>

which I guess you already are doing but simply dont print it out if you dont want to show it.

Comments

1

instead of hiding the div, remove the div element which you don't want to show.

$id = $_SESSION['id'];
if ($uid == $id)
 {
  ?>
  <div id="block_user"></div>
<?php } ?>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.