Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 3 123 LastLast
Results 1 to 10 of 22
  1. #1
    Join Date
    Dec 2007
    Posts
    1,683
    Tokens
    0

    Latest Awards:

    Default PHP Redirect script [Tutorial I guess..]

    PHP Code:
    <?php 

    $time 
    = ("3");

     if(
    $_GET['url'] == "yourhomepage.whatever") { 
     echo(
    "You will be redirected to the homepage in "$time ." seconds."); 
     }
     else { 
     print(
    "You will be redirected too "$_GET['url'] ." in "$time ." seconds.");
     }
     
    ?>
    <meta http-equiv="refresh" content="<?php echo $time?>;url=<?php echo $_GET['url']; ?>"/>
    Doubt this well help anyone, but it's a redirection script I quickly made for newbies..

    Create a page.. something like redirect.php, then visit redirect.php?url=websiteyouwishtogoto

    Change yourpage.whatever too the URL of your homepage or something..

    This is probably more like a tutorial, but for some reason I couldn't post there, hope this code helps somebody..

    Also, change the value of $time if you wish for it too be quicker or slower, it goes by seconds if you did not know.

  2. #2
    Join Date
    Dec 2006
    Posts
    3,970
    Tokens
    0

    Latest Awards:

    Default

    They both redirect to the same place so shouldnt you just do this :S

    header ("location: homepage.php");
    Lets set the stage on fire, and hollywood will be jealous.

  3. #3
    Join Date
    Dec 2007
    Posts
    1,683
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Tom743 View Post
    They both redirect to the same place so shouldnt you just do this :S

    header ("location: homepage.php");
    That's an instant redirection, I wanted to warn the user that they was about to leave the page.

    & It just has diffrent text

    You will be redirected to the homepage in ". $time ." seconds.
    You will be redirected too ". $_GET['url'] ." in ". $time ." seconds.

  4. #4
    Join Date
    Dec 2006
    Posts
    3,970
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Minor View Post
    That's an instant redirection, I wanted to warn the user that they was about to leave the page.

    & It just has diffrent text

    You will be redirected to the homepage in ". $time ." seconds.
    You will be redirected too ". $_GET['url'] ." in ". $time ." seconds.
    I dont see the point in different text though, as they both go to the same page.
    Lets set the stage on fire, and hollywood will be jealous.

  5. #5
    Join Date
    Dec 2007
    Posts
    1,683
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Tom743 View Post
    I dont see the point in different text though, as they both go to the same page.
    It's just more friendly I guess.. lolol

  6. #6
    Join Date
    Oct 2006
    Location
    Peterborough, UK
    Posts
    3,855
    Tokens
    216

    Latest Awards:

    Default

    Quote Originally Posted by Minor View Post
    PHP Code:
    <?php 

    $time 
    = ("3");

     if(
    $_GET['url'] == "yourhomepage.whatever") { 
     echo(
    "You will be redirected to the homepage in "$time ." seconds."); 
     }
     else { 
     print(
    "You will be redirected too "$_GET['url'] ." in "$time ." seconds.");
     }
     
    ?>
    <meta http-equiv="refresh" content="<?php echo $time?>;url=<?php echo $_GET['url']; ?>"/>
    Doubt this well help anyone, but it's a redirection script I quickly made for newbies..

    Create a page.. something like redirect.php, then visit redirect.php?url=websiteyouwishtogoto

    Change yourpage.whatever too the URL of your homepage or something..

    This is probably more like a tutorial, but for some reason I couldn't post there, hope this code helps somebody..

    Also, change the value of $time if you wish for it too be quicker or slower, it goes by seconds if you did not know.
    3 things:
    1) stop using "" to echo stuff when you don't need it.
    2) stop using print, it's slower and I doubt you need to get the integer it returns.
    3) stop using == on $_GET or $_POST they always come through as strings so use === (=== is the same thing and the same type)


    visit my internet web site on the internet
    http://dong.engineer/
    it is just videos by bill wurtz videos you have been warned

  7. #7
    Join Date
    Dec 2007
    Posts
    1,683
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Jewish Bear View Post
    3 things:
    1) stop using "" to echo stuff when you don't need it.
    2) stop using print, it's slower and I doubt you need to get the integer it returns.
    3) stop using == on $_GET or $_POST they always come through as strings so use === (=== is the same thing and the same type)
    Using print is a habbit, and ty for the === thing..

    You learn something new everyday

    Code update.. (if your interested )

    PHP Code:
    <?php 
     
    $time 
    = ("3");
     
     if(
    $_GET['url'] === "yourhomepage.whatever") { 
     echo(
    "You will be redirected to the homepage in "$time ." seconds."); 
     }
     else { 
     echo(
    "You will be redirected too "$_GET['url'] ." in "$time ." seconds.");
     }
     
    ?>
    <meta http-equiv="refresh" content="<?php echo $time?>;url=<?php echo $_GET['url']; ?>"/>

    Edited by Hayd93(Forum Super Moderator): Posts merged due to forum lag .
    Last edited by Hayd93; 15-06-2008 at 01:53 PM.

  8. #8
    Join Date
    Apr 2008
    Location
    England.
    Posts
    1,324
    Tokens
    0

    Latest Awards:

    Default

    Nice little script but as Jew pointed out, stop using print, echo is faster.

  9. #9
    Join Date
    Jun 2005
    Posts
    2,688
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    <?php
    function redirect($url,$time=0){

    if(!
    headers_sent()){
    header("Location: ".$url);
    }else{
    echo 
    '<meta http-equiv="refresh" content="'.$time.';url='.$url.'" />';
    }

    }
    ?>

  10. #10
    Join Date
    Dec 2007
    Posts
    1,683
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Excellent View Post
    Nice little script but as Jew pointed out, stop using print, echo is faster.
    I know, it's a habbit, although I've stopped now
    ^^


Page 1 of 3 123 LastLast

Posting Permissions

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