php redirect question

 

Results 1 to 5 of 5
Hello guys, I have seen sometimes people use 'exit;' after the redirect, sometimes don't, can ...
  1. #1
    switch_2012's Avatar
    switch_2012 is offline Regular Member
    Join Date
    Feb 2010
    Location
    UK
    Posts
    497
    Thanks
    107
    Thanked 222 Times in 140 Posts

    Default php redirect question

    Hello guys,

    I have seen sometimes people use 'exit;' after the redirect, sometimes don't, can someone please explain the difference or the right way?




    <?php /* Redirect browser */
    header
    ("Location: http://mysite/");
    exit; ?>


    vs



    <?php
    /* Redirect browser */
    header
    ("Location: http://mysite/");
    ?>


    Many thanks

    Switch
    Last edited by switch_2012; 02-10-2013 at 06:46 AM.




  2. #2
    mrankin's Avatar
    mrankin is offline Quality US Proxy Provider
    Join Date
    Oct 2008
    Location
    Sydney, Australia
    Age
    41
    Posts
    913
    Thanks
    225
    Thanked 402 Times in 165 Posts

    Default Re: php redirect question

    exit; just terminates a php script. No need to use it, I don't.
    BHW - USAProxies.net - Quality US Private Exclusive and Shared Proxies
    Exclusive - $2.00/mth ea. Shared - $0.90/mth ea. Discounts apply | BHW Sales Thread | Bitcoins now accepted.

  3. The Following User Says Thank You to mrankin For This Useful Post:

    switch_2012 (02-10-2013)

  4. #3
    switch_2012's Avatar
    switch_2012 is offline Regular Member
    Join Date
    Feb 2010
    Location
    UK
    Posts
    497
    Thanks
    107
    Thanked 222 Times in 140 Posts

    Default Re: php redirect question

    thank you for the reply mrankin

  5. #4
    innozemec's Avatar
    innozemec is offline ★★ InstantLinkIndexer.com
    Join Date
    Aug 2011
    Location
    www.Indexification.com
    Posts
    4,926
    Thanks
    1,371
    Thanked 1,644 Times in 1,294 Posts
    Blog Entries
    4

    Default Re: php redirect question

    i am used to always use exit;

    there are certain cases and conditions if there's no exit the script either hangs or loops

  6. The Following User Says Thank You to innozemec For This Useful Post:

    switch_2012 (02-10-2013)

  7. #5
    wawidr is offline Newbies
    Join Date
    May 2010
    Posts
    33
    Thanks
    3
    Thanked 11 Times in 8 Posts

    Default Re: php redirect question

    i always use it everytime i am using php redirects as it stops executing codes below it. you can also benefit from using it because it cuts-off loading time since everything else below the exit() is ignored.

  8. The Following User Says Thank You to wawidr For This Useful Post:

    switch_2012 (02-10-2013)


Similar Threads

  1. Replies: 3
    Last Post: 08-18-2014, 02:50 PM
  2. Replies: 4
    Last Post: 11-06-2012, 05:57 PM
  3. PHP w/ Redirect w/ Header Question
    By UberNewb in forum Cloaking and Content Generators
    Replies: 16
    Last Post: 05-24-2012, 12:53 PM
  4. Need Help With PHP Redirect--Need To Redirect Users Only
    By hellohellosharp in forum General Programming Chat
    Replies: 1
    Last Post: 05-11-2011, 12:21 PM
  5. simple question with php redirect script
    By jaredakelly in forum Cloaking and Content Generators
    Replies: 4
    Last Post: 02-21-2010, 09:51 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




BlackHatWorld on Twitter BlackHatWorld on FaceBook


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108