Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

variable http referrers $http_referrer = getenv( "HTTP_REFERER" );

station1975station1975 Posts: 2Member
I have made next sendmail.php (modification from varius free internet scripts)
and I want to add the variable to knw the visitor's ip address, but I dont know
how..
Could you help me anyone, whon knows to add this variable at next php sendmail
script?

Thank you very much
(I'm newbie at php and programming - and I ' m need more details :-))

With next contact script I am collect email + whosentyou+whodontsentyou+message
(and I want the http referrers)
----------------------------------
<?
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
if (!isset($_REQUEST['email'])) {
header( "Location: http://www.test.gr/members/sendmail.html" );
}
elseif (empty($email) || empty($whosentyou)) {
?>


Σφάλμα

Σφάλμα


Ουουπς, ξεχάσατε να συμπληρώσετε είτε την email address σας είτε κάποιο άλλο
πεδίο.

Παρακαλούμε πατήστε το πλήκτρο BACK του προγράμματος περιήγησης
και
δοκιμάστε ξανά.




<?
}
else {
mail( "webmaster@test.gr", "Αίτηση για πρόσβαση στη σελίδα της νομοθεσίας",
"$message
Από πού πληροφορηθήκατε για το σιτέ μας? $whosentyou

Από πού δεν
πληροφορηθήκατε για το σιτέ μας? $whodontsentyou
",
"From: $name <$email>" );
header( "Location: http://www.test.gr/eyxaristoume.htm" );
}
?>


Comments

  • JonathanJonathan Posts: 2,914Member
    Hi,

    Visitor's IP address is in the REMOTE_ADDR environment variable.

    [code]$ip = getenv ("REMOTE_ADDR");[/code]

    Please be very careful when writing a form mailing script that you don't open up any holes that SPAMmers can use. Yours looks OK though because you have hard coded the address to send mail to. :-)

    Hope this helps,

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

  • station1975station1975 Posts: 2Member
    1. Thanks
    2. Could you write all my script, because I don't know where and how add your code [$ip = getenv ("REMOTE_ADDR");]??

    Thanks again


    : Hi,
    :
    : Visitor's IP address is in the REMOTE_ADDR environment variable.
    :
    : [code]$ip = getenv ("REMOTE_ADDR");[/code]
    :
    : Please be very careful when writing a form mailing script that you don't open up any holes that SPAMmers can use. Yours looks OK though because you have hard coded the address to send mail to. :-)
    :
    : Hope this helps,
    :
    : Jonathan
    :
    : ###
    : for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    : (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    : /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");
    :
    :

  • JonathanJonathan Posts: 2,914Member
    : 1. Thanks
    : 2. Could you write all my script, because I don't know where and how
    : add your code [$ip = getenv ("REMOTE_ADDR");]??
    Sure, but what is that $whosentyou variable? Don't see where that's coming from..

    [code]<?
    $email = $_REQUEST['email'];
    $message = $_REQUEST['message'];
    $ip = getenv("REMOTE_ADDR");
    if (!isset($_REQUEST['email'])) {
    header( "Location: http://www.test.gr/members/sendmail.html" );
    }
    elseif (empty($email) || empty($whosentyou)) {
    ?>


    Σφάλμα

    Σφάλμα


    Ουουπς, ξεχάσατε να συμπληρώσετε είτε την email address σας είτε κάποιο άλλο
    πεδίο.

    Παρακαλούμε πατήστε το πλήκτρο BACK του προγράμματος περιήγησης
    και
    δοκιμάστε ξανά.




    <?
    }
    else {
    mail( "webmaster@test.gr", "Αίτηση για πρόσβαση στη σελίδα της νομοθεσίας",
    "$message
    Από πού πληροφορηθήκατε για το σιτέ μας? $whosentyou

    Από πού δεν
    πληροφορηθήκατε για το σιτέ μας? $whodontsentyou
    IP Address: $ip
    ",
    "From: $name <$email>" );
    header( "Location: http://www.test.gr/eyxaristoume.htm" );
    }
    ?>

    You need to put $ip somewhere in the email as you want it. BTW, PHP isn't really my thing, I'm a Perl programmer who can do some simple PHP stuff because of the similarities, so while I'm pretty sure what I've done there is OK, no promises. :-)

    Hope this helps,

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

Sign In or Register to comment.