Jump to content

[SOLVED] Offline Function, variables with no data in them


dual_alliance

Recommended Posts

Hey,

 

I've been trying to figure this out for a while, the function returns a result but its not the result l want.  I've tried to debug the function and it seems that $groupid and $status aren't being set as when l echo'ed them out they both had no data in them.

 

If l set the variables data inside the function the code executes perfectly, so l cant understand why it isnt working.

 

What l need the code to do is check to see if the member logging in is an admin (group id 8) or a root admin (group id 9) and if the game is offline (status 1) to only only admin and root admin.  However is the game is offline but status is set to 2, then only root admin can login.  If the game is offline, normal members are not allowed to login.

 

Clearance is there so l can check to see whether or not to allow them pass or stop them from logging in.

 

My code is as follows:

 

function offlineCheck($groupid,$status) {

	if($status > 0){
		if($groupid > 7){
			return $clearance = 0;
		}else{
			return $clearance = 1;
	        }
	}elseif($status > 1){
		if($groupid > {
			return $clearance = 0;
		}else{
			return $clearance = 1;
	        }
	}else{
			return $clearance = 0;
	}
}

 

And what l have currently checking it is:

 

if(offlineCheck(4,2) > 0){
	echo "it worked!";
	die();
}

 

Your help is greatly appreciated,

 

dual_alliance

Link to comment
Share on other sites

If this...

 

offlineCheck(4,2)

 

is how your calling the function then they do have the values 4 and 2.

 

Add this to debugg.

 

function offlineCheck($groupid,$status) {
  // add this line.
  die($groupid.$status);

Link to comment
Share on other sites

I did as you said and this is where it gets really weird.

 

Because the result returns nothing at all.

 

Just to make sure, l did:

 

echo "test1";
// add this line.
	die($groupid.$status);
echo "test2";

 

Result: test1

 

Another test to make sure

 

echo "test1";
// add this line.
	die("test3"."test4");
echo "test2";

 

Result: test1test3test4

 

So the die is defiantly working, l just cant understand why $groupid and $status have no data in them!

Link to comment
Share on other sites

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.