Reece S Posted January 2, 2008 Share Posted January 2, 2008 I have only just got my head around on problem, now onto this, someone please tell me wht this keep redirecting to the login page (main.php) regardless of session status. <?php session_start(); ?> <? include("http://pcgenius.hyperphp.com/members/include/session.php"); ?> <?php if($session->logged_in) { header('Location:http://www.drivehq.com/file/df.aspx/shareID3045061/fileID118397778/PGC_v3.1.zip'); }else{ header('Location:http://pcgenius.hyperphp.com/members/main.php'); } ?> Thanks in Advance. Quote Link to comment https://forums.phpfreaks.com/topic/84047-another-failing-php-task-please-help-me/ Share on other sites More sharing options...
Daukan Posted January 2, 2008 Share Posted January 2, 2008 I don't think you can pass a url into include by default. Do you have error reporting on? Quote Link to comment https://forums.phpfreaks.com/topic/84047-another-failing-php-task-please-help-me/#findComment-427804 Share on other sites More sharing options...
The Little Guy Posted January 2, 2008 Share Posted January 2, 2008 Obviously $session->logged_in is returning FALSE we probably would need to see that class to help Quote Link to comment https://forums.phpfreaks.com/topic/84047-another-failing-php-task-please-help-me/#findComment-427805 Share on other sites More sharing options...
kratsg Posted January 2, 2008 Share Posted January 2, 2008 This belongs in the OOP section. Here's what anyone (and myself) will say that we need to see: (and I'm assuming this contains your class) include("http://pcgenius.hyperphp.com/members/include/session.php"); From what I understand, you're checking a variable inside an OOP class which you haven't even registered and thus always defaults to a false in the if/else statement. You need to start the class, so try this: Try this: <?php session_start(); include("http://pcgenius.hyperphp.com/members/include/session.php"); $session = new Class;//put the name of the class in for "Class" if($session->logged_in) { header('Location:http://www.drivehq.com/file/df.aspx/shareID3045061/fileID118397778/PGC_v3.1.zip'); }else{ header('Location:http://pcgenius.hyperphp.com/members/main.php'); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/84047-another-failing-php-task-please-help-me/#findComment-427806 Share on other sites More sharing options...
Reece S Posted January 2, 2008 Author Share Posted January 2, 2008 I don't think you can pass a url into include by default. Do you have error reporting on? This just goes to show how innexperienced I am. You sorted it, it was the direct URL, i used an internal link instead. But I still dont understand why it objects, they are practically. both the same. No, I dont have error reporting on, and I dont have them built into my scripting either, I wanted to save a fe KB, lol, my silly mistake. Thanks for your help, but I am still a bit stumped, but at least it works, I will hack further into the details later. Cheers M8 Quote Link to comment https://forums.phpfreaks.com/topic/84047-another-failing-php-task-please-help-me/#findComment-427810 Share on other sites More sharing options...
kratsg Posted January 2, 2008 Share Posted January 2, 2008 Think about why we cannot use full urls... That means you can put any other website's url in to a php file, include it, and get information off it... That's a "no-no" in security world. It's set to be relative urls for security reasons. Quote Link to comment https://forums.phpfreaks.com/topic/84047-another-failing-php-task-please-help-me/#findComment-427813 Share on other sites More sharing options...
Reece S Posted January 2, 2008 Author Share Posted January 2, 2008 Think about why we cannot use full urls... That means you can put any other website's url in to a php file, include it, and get information off it... That's a "no-no" in security world. It's set to be relative urls for security reasons. Very true, That is very useful. I come to expect a more technical reason behind the power of PHP, but then, when you stop, and slow down enough to think, it was designed by humans, and since when have they ever been the type to trust, or indeed, be trust-worthy? Thanks for the Info, and thanks for your quick replies. Quote Link to comment https://forums.phpfreaks.com/topic/84047-another-failing-php-task-please-help-me/#findComment-427817 Share on other sites More sharing options...
chronister Posted January 2, 2008 Share Posted January 2, 2008 here is kind of an aside... if you need to use a root based relative path, use include($_SERVER['DOCUMENT_ROOT'].'/path/to/your/file'); to make this include path universal. Quote Link to comment https://forums.phpfreaks.com/topic/84047-another-failing-php-task-please-help-me/#findComment-427819 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.