Jump to content

trying to hide a link front end?


Baby Jai

Recommended Posts

<?php
if(isset($_SERVER['PHP_AUTH_USER'])) {
   echo "<a href='schedule.php'>Request A Skype Session</a>";
   }
?>

 

works great for someone that islogged in my htpasswd, however, I would like to hide

 

<a href="/members/index.php">Login</a>

if they are logged in, how do i go about doing the opposite of the first code i linked...sorry if it sounds complicated

Link to comment
Share on other sites

Try this:

<?php
if(!isset($_SERVER['PHP_AUTH_USER'])) {
   echo "<a href='schedule.php'>Request A Skype Session</a>";
   }
?>

that is the same exact one i have and that works great but i would like to hide that second code box if they are logged in, that is only hiding the link if THEY arent logged in
Link to comment
Share on other sites

<?php
if(!isset($_SERVER['PHP_AUTH_USER'])) {
   echo "<a href=\"/members/index.php\">Login</a>";
   }
else
{
echo "";
}
?>

 

I wasn't giving you the exact code. Just backslash the quotes like I did.

 

ALL star bro, I have been everywhere and NO ONE could help me with it like you just did, phenominal man, you are all star

Link to comment
Share on other sites

Yup. The backslashes are basically just "skipping" over the quotations marks since you need those whenever you pull <a href="hello.php">

 

But you could just do this:

 

echo "<a href='hello.php'>Hello</a>";

 

I just find it easier to escape them. (:

And thanks!

lol ok so sorry ABOUT the bombardment but what about adding a target new to this

 

<?php
if(!isset($_SERVER['PHP_AUTH_USER'])) {
   echo "<a href=\"whatever.php\">Register</a>";
   }
else {
echo "";
}
?>

i tried just adding a target="_new" to it with nO luck, sorry but im so new to php its all baffling me

Link to comment
Share on other sites

Why are you trying to add a target field? What is the purpose for it?

And no problem! (: I was in your spot when I first started too.

well its for an adult site :) and basically the register brings you to another page that you can fill out your information, OR i can use a rel and have it open in an overlay of the webpage which is what i was doing from the front line, for instance one of the links is this

 

rel="shadowbox;height=148;width=600"

 

and im confused how to add that into the backslashed links

Link to comment
Share on other sites

I'm still confused on what you are wanting.

To backslash this link.. although I don't understand how it's a link since it's not a web page:

 

rel=\"shadowbox;height=148;width=600\"

ok basically the link right now, the register one that shows when they are NOT logged in opens on the top of the current page, I want it to open in a new window, thats all lol
Link to comment
Share on other sites

also i have one more question, i have a .me and .com linked to the same directory, basically showing the same page, the only difference is the actual URL, now here is the tricky question, when using your methods that are pristine, work great on the .me but ARE not working on the .com, almost like the cache on the server is not as clean as the .me, is this natural?

Link to comment
Share on other sites

Can you show them to me?

 

And to open a new window, you would want:

target="_blank" when they click on the link.

 

So it would be:

echo "<a href=\"home.php\" target=\"blank\">Home</a>";

yeah i just used the ' instead of the " and that fixed the issues as far as me showing them to you, can i link adult sites here or do i have to message them to you
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.