Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/84047-another-failing-php-task-please-help-me/
Share on other sites

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');
}
?>

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 ;)

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.  ;D

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.