How do i do this?

Discussion in 'Programming' started by Theozard, Feb 11, 2007.

  1. #1
    I have tied up with a person wherein my site is hosting the files and he will be linking the downloads from his site. In return he's told me that this is what i can do-
    Make a page saying things about my site and then redirect it so thats after 3 seconds or so, it starts downloading
    I obviously can make the page but how exactly do i go about doing the redirection thing properly?

    Thanks :)
     
    Theozard, Feb 11, 2007 IP
  2. hashen27

    hashen27 Active Member

    Messages:
    665
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    70
    #2
    Here :) Replace the URL with the URL of your chouce :)

    
    <?php
    header("Refresh: 3; url=http://www.php.net");
    ?>
    
    Code (markup):
    The file that this is in needs to have the extension .php

    Source
     
    hashen27, Feb 11, 2007 IP
  3. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #3
    Or if you don't have the option of using php then :

    <meta http-equiv="refresh" content="2;url=http://php.net">

    In standard html will do the same thing, needs (won't validate if it's not) to be in the <head> section of the page.
     
    krakjoe, Feb 11, 2007 IP
    hashen27 likes this.
  4. rubin

    rubin Peon

    Messages:
    89
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    nice tips..it usefull for me
     
    rubin, Feb 11, 2007 IP
  5. hashen27

    hashen27 Active Member

    Messages:
    665
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    70
    #5
    Wow, Your a very knowlagable person :p I didnt know you could do it through meta tags :D

    Green rep added.
     
    hashen27, Feb 11, 2007 IP
  6. Theozard

    Theozard Active Member

    Messages:
    811
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    68
    #6
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <?php
    header("Refresh: 5; url=http://xxx.net/AFTERTASTE%20-%20OPERATION%20WATER.wmv");
    ?>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    <style type="text/css">
    <!--
    body {
    background-color: #000000;

    and this is the error i get
    Warning: Cannot modify header information - headers already sent by (output started at /home/xxx/public_html/hosted/index.php:3) in /home/xxx/public_html/hosted/index.php on line 4
     
    Theozard, Feb 11, 2007 IP
  7. Theozard

    Theozard Active Member

    Messages:
    811
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    68
    #7
    This is working! Respect man
     
    Theozard, Feb 11, 2007 IP
  8. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #8
    always a pleasure ... :)

    FYI : In php, it's good pratice, to put header() above any html output to the browser, as headers can't be sent to redirect if the static html headers have been output, the way to get around it would be using ob_start() at the beginning, but normally it's unecessary and bad practice.
     
    krakjoe, Feb 11, 2007 IP
    Theozard likes this.
  9. hashen27

    hashen27 Active Member

    Messages:
    665
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    70
    #9
    The html version would also be faster than outputting both php and html :)
     
    hashen27, Feb 11, 2007 IP
  10. proprod

    proprod Active Member

    Messages:
    216
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    90
    #10
    Is there a way to do this with some smarty and a <meta> statement? Like:

    {if url = /weather.php}
    <meta http-equiv="refresh" content="30;url=/weather.php">
    {/if}
    Code (markup):

    The thing is, I have a dynamic site, so only one header file... so I don't want all of the pages to refresh, just the one. The above is just a rough example as I'm not that great with smarty.

    Thanks in advance to anyone that can help.
     
    proprod, Feb 25, 2007 IP