Jump to content

Problem with functions


gilgimech

Recommended Posts

I have this function that checks if a user is logged in. If they aren't it redirects them to the front page.

 

If I have it directly on each page like this.

 

if ($context['user']['is_guest']) {
header('Location:http://www.netgamegurus.com/index.php');
}

 

It works fine, but if I put it in a function on an external page it won't execute. This is the function code

 


function loggin_check() {
if ($context['user']['is_guest']) {
	header('Location:http://www.netgamegurus.com/index.php');
}
}

 

And I call like this

 


loggin_check();

 

I just don't understand why it won't work.

 

Link to comment
https://forums.phpfreaks.com/topic/198003-problem-with-functions/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.