Baby Jai Posted June 1, 2011 Share Posted June 1, 2011 <?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 Quote Link to comment https://forums.phpfreaks.com/topic/238152-trying-to-hide-a-link-front-end/ Share on other sites More sharing options...
Tenaciousmug Posted June 1, 2011 Share Posted June 1, 2011 Try this: <?php if(!isset($_SERVER['PHP_AUTH_USER'])) { echo "<a href="/members/index.php">Login</a>"; } else { echo ""; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/238152-trying-to-hide-a-link-front-end/#findComment-1223793 Share on other sites More sharing options...
Baby Jai Posted June 1, 2011 Author Share Posted June 1, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/238152-trying-to-hide-a-link-front-end/#findComment-1223795 Share on other sites More sharing options...
Baby Jai Posted June 1, 2011 Author Share Posted June 1, 2011 Try this: <?php if(!isset($_SERVER['PHP_AUTH_USER'])) { echo "<a href="/members/index.php">Login</a>"; } else { echo ""; } ?> Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in Quote Link to comment https://forums.phpfreaks.com/topic/238152-trying-to-hide-a-link-front-end/#findComment-1223798 Share on other sites More sharing options...
Tenaciousmug Posted June 1, 2011 Share Posted June 1, 2011 <?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. Quote Link to comment https://forums.phpfreaks.com/topic/238152-trying-to-hide-a-link-front-end/#findComment-1223800 Share on other sites More sharing options...
Baby Jai Posted June 1, 2011 Author Share Posted June 1, 2011 <?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 Quote Link to comment https://forums.phpfreaks.com/topic/238152-trying-to-hide-a-link-front-end/#findComment-1223802 Share on other sites More sharing options...
Baby Jai Posted June 1, 2011 Author Share Posted June 1, 2011 one more thing in the blank echo, if i wanted it to turn into something else, lets say happy.html would i still use the backslashes in the link Quote Link to comment https://forums.phpfreaks.com/topic/238152-trying-to-hide-a-link-front-end/#findComment-1223803 Share on other sites More sharing options...
Tenaciousmug Posted June 1, 2011 Share Posted June 1, 2011 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! Quote Link to comment https://forums.phpfreaks.com/topic/238152-trying-to-hide-a-link-front-end/#findComment-1223806 Share on other sites More sharing options...
Baby Jai Posted June 1, 2011 Author Share Posted June 1, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/238152-trying-to-hide-a-link-front-end/#findComment-1223807 Share on other sites More sharing options...
Tenaciousmug Posted June 1, 2011 Share Posted June 1, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/238152-trying-to-hide-a-link-front-end/#findComment-1223808 Share on other sites More sharing options...
Baby Jai Posted June 1, 2011 Author Share Posted June 1, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/238152-trying-to-hide-a-link-front-end/#findComment-1223810 Share on other sites More sharing options...
Tenaciousmug Posted June 1, 2011 Share Posted June 1, 2011 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\" Quote Link to comment https://forums.phpfreaks.com/topic/238152-trying-to-hide-a-link-front-end/#findComment-1223813 Share on other sites More sharing options...
Baby Jai Posted June 2, 2011 Author Share Posted June 2, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/238152-trying-to-hide-a-link-front-end/#findComment-1223814 Share on other sites More sharing options...
Baby Jai Posted June 2, 2011 Author Share Posted June 2, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/238152-trying-to-hide-a-link-front-end/#findComment-1223819 Share on other sites More sharing options...
Tenaciousmug Posted June 2, 2011 Share Posted June 2, 2011 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>"; Quote Link to comment https://forums.phpfreaks.com/topic/238152-trying-to-hide-a-link-front-end/#findComment-1223824 Share on other sites More sharing options...
Baby Jai Posted June 2, 2011 Author Share Posted June 2, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/238152-trying-to-hide-a-link-front-end/#findComment-1223826 Share on other sites More sharing options...
Tenaciousmug Posted June 2, 2011 Share Posted June 2, 2011 Well you're probably backslashing the quotes wrong then. I don't see why you can't link them here. You gave a warning to those that they are adult sites. I'm not sure. You can message me if you want. Quote Link to comment https://forums.phpfreaks.com/topic/238152-trying-to-hide-a-link-front-end/#findComment-1223831 Share on other sites More sharing options...
Baby Jai Posted June 2, 2011 Author Share Posted June 2, 2011 check messages Quote Link to comment https://forums.phpfreaks.com/topic/238152-trying-to-hide-a-link-front-end/#findComment-1223833 Share on other sites More sharing options...
Baby Jai Posted June 2, 2011 Author Share Posted June 2, 2011 ok so, i found out that a .me saves the variable globally and a .com only works on the actual members logged in page, im trying really hard to figure this out Quote Link to comment https://forums.phpfreaks.com/topic/238152-trying-to-hide-a-link-front-end/#findComment-1223896 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.