add-memberalign-toparrow-leftarrow-rightbellblockcalendarcamerachatchevron-leftchevron-rightchevron-small-downchevron-upcircle-with-crosscomposecrossfacebookflagfolderglobegoogleimagesinstagramkeylocation-pinmedalmoremuplabelShape 3 + Rectangle 1pagepersonpluspollsImported LayersImported LayersImported LayersshieldstartwitterwinbackClosewinbackCompletewinbackDiscountyahoo

Is it bad practice to die 'inside' a class?

From: David M.
Sent on: Tuesday, September 15, 2009 12:23 PM
Not sure if I can word this well, so please ask for clarification as needed...

Hypothetical example of the concept (that is, I'm not looking for a better way to do this particular task, just using it as a simplified example):

���� <? php
���� include ('theClass.php');
���� $newUser = new theClass();
���� $newUser->checkIP;
���� echo "Welcome...";
���� ...
���� ?>

���� ...������������������������������������ // setup-stuff
���� function chekIP() {
�������������� if ($_SERVER['REMOTE_ADDR'] != '[masked]') {
������������������������������ include ('aDifferentLoginPage.php');���������������������� //�� THIS LINE!!
�� �� �� �� �� �� �� �� die();
�������������� }
������ }

Roughly, if the user is not at[masked], then they are bounced out to a different page BY THE CLASS!!

1) Is this a bad idea or is it okay practice?
2) does this lead to memory-leak or other wasted RAM/processing issues?


Our Sponsors

  • TUNE

    Meeting space and food

  • PluralSight

    PluralSight subscriptions for developer training

  • Siteground

    Information coming Soon

  • O'Reilly

    Disc Code: PCBW is good for 40% off print and 50% off ebooks and videos

  • JetBrains PhpStorm

    Occasional free licenses to raffle off at meetups

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy