Need Help

Discussion in 'PHP' started by astrohope, Apr 2, 2009.

  1. #1
    Hello Every one
    i am new to digitalpoint this is vary gr8 forum, All of user doing good job for providing good information

    i Need help with this PHP Script
    <? $refurl = $_SERVER['HTTP_REFERER']; ?>
    <? print $refurl;?>
    This Script is working fine with Firefox but with IE it can not get the address i am using it for "send this page to friend" Page. so any 1 help me with this ?
     
    astrohope, Apr 2, 2009 IP
  2. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #2
    it has nothing to do with IE and Firefox its some mistake that is causing try this
    <?

    $refurl = $_SERVER['HTTP_REFERER'];
    echo $refurl;

    ?>

    This shd work

    Thanks

    Regards

    Alex
     
    kmap, Apr 2, 2009 IP
  3. ActiveFrost

    ActiveFrost Notable Member

    Messages:
    2,072
    Likes Received:
    63
    Best Answers:
    3
    Trophy Points:
    245
    #3
    <?php
    $ref = $_SERVER['HTTP_REFERER'];
    print($ref);
    ?>
    PHP:
     
    ActiveFrost, Apr 2, 2009 IP
  4. SmallPotatoes

    SmallPotatoes Peon

    Messages:
    1,321
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    0
    #4
    So far two people have given you code that is functionally identical to what you already had (assuming we can trust the "last edited" timestamp); not sure what that's about.

    Anyway, I doubt your problem has to do with Firefox vs IE, probably more to do with the means in which you are testing.

    HTTP_REFERER is an extremely fragile mechanism and I would say that depending on it for anything is a big mistake.

    You can better handle email-this-page by including an intercept function at the head of your template code, so that any time a page sees GET argument email_this_page=1 it will branch off to the email form.
     
    SmallPotatoes, Apr 2, 2009 IP
  5. Protvino

    Protvino Peon

    Messages:
    37
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    $_SERVER['HTTP_REFERER'] not work in IE. I don't remember at 100% but try to use getenv() function...
     
    Protvino, Apr 2, 2009 IP
  6. ActiveFrost

    ActiveFrost Notable Member

    Messages:
    2,072
    Likes Received:
    63
    Best Answers:
    3
    Trophy Points:
    245
    #6
    [​IMG]
     
    ActiveFrost, Apr 2, 2009 IP
  7. ads2help

    ads2help Peon

    Messages:
    2,142
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    0
    #7
    PHP is server-side so it works in all browser.

    - ads2help
     
    ads2help, Apr 2, 2009 IP
  8. astrohope

    astrohope Peon

    Messages:
    108
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    with this script i get same Result it work with Firefox but nothing on IE
    <?

    $refurl = $_SERVER['HTTP_REFERER'];
    echo $refurl;

    ?>
    and with this
    <?

    $refurl = $_SERVER['HTTP_REFERER'];
    echo $refurl;

    ?>
    i get nothing on Firefox & IE

    well this is the full script i am using
    on form page
    <tr valign="top">
    <td valign="middle" align="center">&nbsp;
    <? $refurl = $_SERVER['HTTP_REFERER']; ?>
    <? print $refurl;?>
    <form name="tellafriend" action="tellafriend.php" method="post" onSubmit="return checkfields()">
    <div align="center">
    <center>
    <table border="0" cellpadding="10" cellspacing="0">
    <tr>
    <td><span class="main">آپكا نام</span></td>
    <td>
    <input size="30" name="name" maxlength="45">
    </td>
    </tr>
    <tr>
    <td><span class="main">آپكا ای میل</span></td>
    <td>
    <input size="30" name="email" maxlength="45">
    </td>
    </tr>

    <tr>
    <td><span class="main">دوست كا ای میل</span></td>
    <td>
    <input size="30" name="fmail1" maxlength="50">
    </td>
    </tr>
    <tr>
    <td><span class="main">دوست كا ای میل</span></td>
    <td>
    <input size="30" name="fmail2" maxlength="50">
    </td>
    </tr>
    <tr>
    <td><span class="main">دوست كا ای میل</span></td>
    <td>
    <input size="30" name="fmail3" maxlength="50">
    </td>
    </tr>
    <tr>
    <td colspan="2" align="center">
    <span class="main"> پیغام (اگر ہے تو)</span></td>
    </tr>
    <tr>
    <td colspan="2" align="center">
    <textarea name="txtcoments" cols="50" rows="8"></textarea>
    </td>
    </tr>
    <tr>
    <td colspan="2">
    <p align="center">
    <input onClick="validate();" type="button" value="Send">
    <input type=hidden name=refurl value="<? print $refurl;?>">
    </td>
    </tr>
    and on PHP page
    <?php

    if(count($_POST)) {

    foreach(array('fmail1','fmail2','fmail3','email','name','txtcoments') as $key) $_POST[$key] = strip_tags($_POST[$key]);
    if(!is_secure($_POST)) { die("Hackers begone");}


    $emailto = "info@astrohope.com";
    $esubject = "Astro Hope Page Recommendation";

    $emailtext = "
    $_POST[name] has used your recommendation form using an email address of $_POST
     
    astrohope, Apr 3, 2009 IP
  9. Protvino

    Protvino Peon

    Messages:
    37
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Of course I forgot... this method not work in IE on autoredirection! Sorry
     
    Protvino, Apr 3, 2009 IP
  10. astrohope

    astrohope Peon

    Messages:
    108
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    is there any other script = to this that i can use??
     
    astrohope, Apr 4, 2009 IP