Page 1 of 1

Simple case statement question

Posted: Thu Jan 12, 2006 6:12 am
by mhouldridge
Hi,

I have the following case statement which checks the user level variable as follows;

Code: Select all

switch ($i) {
	case "1":
   	header("Location: http://www.somewhere.com");
   	break;
	case "2":
  	header("Location: http://www.somewhere.com");
  	break;
	case "3":
   	// User allowed
   	break;
	}
I would like case 3 to give the user access without outputting anything. Will this automatically let them in, or do I need some code to do something. I know this sounds like a stupid question but I cant quite get my head round what to do here.

All I want is for case 3 to allow the user to access the page that the code is on.


thanks

Posted: Thu Jan 12, 2006 7:26 am
by shiznatix
well 1st of all, after your header() make sure you do die(); before the break. if this code is on the same page the switch statement is on then just leave out the case "3" part and let the code execute.

Posted: Thu Jan 12, 2006 8:48 am
by mhouldridge
Sorted!, Thanks for this,

Everything is working correctly now.