php redirect question

High Society   HostWinds

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 online now Regular Member
    Join Date
    Feb 2010
    Location
    UK
    Posts
    369
    Reputation
    34
    Thanks
    71
    Thanked 152 Times in 99 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
    39
    Posts
    703
    Reputation
    121
    Thanks
    179
    Thanked 274 Times in 105 Posts

    Default Re: php redirect question

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

  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 online now Regular Member
    Join Date
    Feb 2010
    Location
    UK
    Posts
    369
    Reputation
    34
    Thanks
    71
    Thanked 152 Times in 99 Posts

    Default Re: php redirect question

    thank you for the reply mrankin

  5. #4
    innozemec's Avatar
    innozemec is online now ★★★ InnoCoders.com ★★★
    Join Date
    Aug 2011
    Location
    www.MightyContentLocker.com
    Posts
    2,246
    Reputation
    688
    Thanks
    376
    Thanked 580 Times in 472 Posts
    Blog Entries
    2

    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
    3
    Reputation
    10
    Thanks
    0
    Thanked 1 Time in 1 Post

    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)

Digi Partners


Hide My Ass

Similar Threads

  1. Replies: 4
    Last Post: 11-06-2012, 05:57 PM
  2. Replies: 0
    Last Post: 06-08-2012, 02:25 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