gillmich Posted April 24, 2011 Share Posted April 24, 2011 I feel like I was 75% there, and now I'm only 25% there. I'm trying to put my links onto my page. http://thingsihateaboutyou.net/michelle is my testing page. So I have register (register.php), login (login.php), logout (logout.php), and the members area. The members area is going to be their username.php, so I assumed this would be $username.php like I have it in the redirect link from the point where you login to the point where you see your client page. This works fine. The part I'm having trouble with is the visibility of the links on my page to these, AND adding a PHP variable ($username) into the "members area" tag. When you click on members area, it should send you to http://thingsihateaboutyou.net/michelle/*whatever you are logged in as*.php As for the visibility, if you are not logged in I obviously don't want you to see a link called "log out" or a link called "members area," and vise versa. It's been like 5 hours now, and I keep getting further and further away. I had to bail on my Wordpress so I don't have a Content Management System in place. All of this DID work and it worked excellent, but after I made the switch earlier today it kind of blew up in my face. I am attaching a ZIP file with everything included... in desperate need of an answer. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/234569-client-login/ Share on other sites More sharing options...
gillmich Posted April 24, 2011 Author Share Posted April 24, 2011 By the way, I decided to COMPLETELY just stop what I was doing. So the index file is now butchered. Quote Link to comment https://forums.phpfreaks.com/topic/234569-client-login/#findComment-1205475 Share on other sites More sharing options...
spiderwell Posted April 24, 2011 Share Posted April 24, 2011 so where does this leave you? are you after assistance or not? Quote Link to comment https://forums.phpfreaks.com/topic/234569-client-login/#findComment-1205493 Share on other sites More sharing options...
gillmich Posted April 24, 2011 Author Share Posted April 24, 2011 Yes... Quote Link to comment https://forums.phpfreaks.com/topic/234569-client-login/#findComment-1205533 Share on other sites More sharing options...
spiderwell Posted April 24, 2011 Share Posted April 24, 2011 im lost to what help you are after now, as you stated you have stopped completely with it, and so im not sure what you are trying to do any more! Quote Link to comment https://forums.phpfreaks.com/topic/234569-client-login/#findComment-1205616 Share on other sites More sharing options...
gillmich Posted April 24, 2011 Author Share Posted April 24, 2011 No, I was just saying I've stopped editing the index then and there. That's why it may looked mangled or is showing errors. I was just more or less apologizing for that since I know it's there and just don't know how to fix it, so I wasn't about to make it worse by messing with it more. Quote Link to comment https://forums.phpfreaks.com/topic/234569-client-login/#findComment-1205633 Share on other sites More sharing options...
wildteen88 Posted April 24, 2011 Share Posted April 24, 2011 I assume you're setting the username session variable when a user is successfully logged in? But you unset this variable when they are not logged in. If that is the case then you can easily change the visibility of your links with this block of code <?php if (!isset($_SESSION['username'])): display links for users that are not logged in <?php else: ?> display links for users that are logged in <?php endif; ?> AND adding a PHP variable ($username) into the "members area" tag. When you click on members area, it should send you to http://thingsihateaboutyou.net/michelle/*whatever you are logged in as*.php So if the user signs in as bob you want the user to go to bob.php? Why are you creating separate php files for each logged in user? Quote Link to comment https://forums.phpfreaks.com/topic/234569-client-login/#findComment-1205636 Share on other sites More sharing options...
gillmich Posted April 24, 2011 Author Share Posted April 24, 2011 Because I don't know? The script it is using directs you to a members area but it's the same members area everyone who is logged in sees. the "members.php" is this area, so I just cut that out and rename is /$username.php in the redirect script. Since my "members area" is actually a "client area," I only want them to see what they individually need to see. Should this be different? I am getting the feeling that I'm making this way more complicated than it has to be. Quote Link to comment https://forums.phpfreaks.com/topic/234569-client-login/#findComment-1205639 Share on other sites More sharing options...
wildteen88 Posted April 24, 2011 Share Posted April 24, 2011 Yeah you're making this more complicated than needs to be. Set the link to the members area back to memebers.php As it is members.php only displays the contactname for the user that is logged in. What are you trying to do in members.php? Quote Link to comment https://forums.phpfreaks.com/topic/234569-client-login/#findComment-1205643 Share on other sites More sharing options...
gillmich Posted April 24, 2011 Author Share Posted April 24, 2011 members.php was going to be an area where you could view progress, screen shots of your project, any updates or sidenotes... But there was nothing there to separate one client from the other. Quote Link to comment https://forums.phpfreaks.com/topic/234569-client-login/#findComment-1205691 Share on other sites More sharing options...
gillmich Posted April 24, 2011 Author Share Posted April 24, 2011 I assume you're setting the username session variable when a user is successfully logged in? But you unset this variable when they are not logged in. If that is the case then you can easily change the visibility of your links with this block of code <?php if (!isset($_SESSION['username'])): display links for users that are not logged in <?php else: ?> display links for users that are logged in <?php endif; ?> AND adding a PHP variable ($username) into the "members area" tag. When you click on members area, it should send you to http://thingsihateaboutyou.net/michelle/*whatever you are logged in as*.php So if the user signs in as bob you want the user to go to bob.php? Why are you creating separate php files for each logged in user? I tried this, and it only displays the links for users who are not logged in, and it displays them whether you're logged in or not. It does not show the other links no matter what. Quote Link to comment https://forums.phpfreaks.com/topic/234569-client-login/#findComment-1205692 Share on other sites More sharing options...
gillmich Posted April 25, 2011 Author Share Posted April 25, 2011 I've made great progress with this code: <?php include 'http://thingsihateaboutyou.net/michelle/membersgear/config/config.php'; session_start(); ?> <? if (isset($_SESSION['username'])) {?> <p>Logged as <?echo $_SESSION['username']; ?> | <a href="http://thingsihateaboutyou.net/michelle/membersgear/user_default_page.php">Client Area</a> | <a href="http://www.thingsihateaboutyou.net/michelle/membersgear/member/user_logout.php">Logout</a> </p> <? } else {?> <p> <a href="http://thingsihateaboutyou.net/michelle/membersgear/user_login.php">Login</a> </p> <? } ?> My logged in users see their links and my users who are not logged in, do not. But there is a whole strain of errors just before all the links now. Quote Link to comment https://forums.phpfreaks.com/topic/234569-client-login/#findComment-1205718 Share on other sites More sharing options...
gillmich Posted April 25, 2011 Author Share Posted April 25, 2011 Solved it! HAPPY EASTER INDEED! Here is the code for anyone who finds this. <? if (isset($_SESSION['username'])) {?> <p>Logged as <?echo $_SESSION['username']; ?> | <a href="http://thingsihateaboutyou.net/michelle/membersgear/user_default_page.php">Client Area</a> | <a href="http://www.thingsihateaboutyou.net/michelle/membersgear/member/user_logout.php">Logout</a> </p> <? } else {?> <p> <a href="http://thingsihateaboutyou.net/michelle/membersgear/user_login.php">Login</a> </p> <? } ?> Quote Link to comment https://forums.phpfreaks.com/topic/234569-client-login/#findComment-1205719 Share on other sites More sharing options...
wildteen88 Posted April 25, 2011 Share Posted April 25, 2011 Umm.... Isn't that basically the same as the code I posted earlier! <?php if (!isset($_SESSION['username'])): display links for users that are not logged in <?php else: ?> display links for users that are logged in <?php endif; ?> Did you know includes behave differently when using a url as the path rather than a local file system path. include 'http://thingsihateaboutyou.net/michelle/membersgear/config/config.php'; If you have variables in config.php that you may want to use in members.php then they won't be accessible. That is because when using a url with incude it will only return the output of that script rather than the source code. Quote Link to comment https://forums.phpfreaks.com/topic/234569-client-login/#findComment-1205810 Share on other sites More sharing options...
gillmich Posted April 25, 2011 Author Share Posted April 25, 2011 It is, but your code earlier wouldn't work. And actually the "I SOLVED IT" code isn't correct, and I cut out the config because it didn't make sense (my URL's haven't been working on this particular subfolder unless I spell it all out, by the way.) Whatever I did in the index actually DISABLED all my member links. If you want to see what I'm talking about: http://thingsihateaboutyou.net/michelle -- Login produces a blank page, members area, etc. I can't even get into the admin portion of it. Quote Link to comment https://forums.phpfreaks.com/topic/234569-client-login/#findComment-1205968 Share on other sites More sharing options...
wildteen88 Posted April 25, 2011 Share Posted April 25, 2011 if you're getting blank pages then you have an error somewhere. Check your servers error log. Or add these lines to the top of your php pages (user_login.php, members.php etc) <?php error_reporting(E_ALL); ini_set('display_errors', 'on'); ?> As for why my code I posted earlier didn't work I forgot to add ?> to the end of this line <?php if (!isset($_SESSION['username'])): Quote Link to comment https://forums.phpfreaks.com/topic/234569-client-login/#findComment-1205999 Share on other sites More sharing options...
gillmich Posted April 25, 2011 Author Share Posted April 25, 2011 I added the ?> to the end of that part, it was actually the rest of the code below that which was reporting errors. <?php else: ?> That part reported the first error and it was a domino effect after that. As for the pages, they are still blank. The "support" for the members area (where I got the script) said it could be because my server isn't meeting all the requirements. This can't be because it was working fine before I spent two days messing with my index.php trying to add the links. I didn't alter the other files, in fact I reuploaded them all just to make double sure that they were just the same as when I first uploaded them. Quote Link to comment https://forums.phpfreaks.com/topic/234569-client-login/#findComment-1206005 Share on other sites More sharing options...
gillmich Posted April 25, 2011 Author Share Posted April 25, 2011 I basically just verified what I said above. I removed ALL files regarding the members area, then replaced ALL files. They work fine, as before. As soon as I visited my index.php, ALL files show up blank again. At this point I'm thinking about making it a "Secret" client area. They can guess what the login link is themself! Quote Link to comment https://forums.phpfreaks.com/topic/234569-client-login/#findComment-1206019 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.