This is a discussion on variable http referrers $http_referrer = getenv( "HTTP_REFERER" ); within the alt.comp.lang.php forums, part of the PHP Programming Forums category; I have made next sendmail.php (modification from varius free internet scripts) and I want to add the variable to ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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)) { ?> <html> <head><title>Σφάλμα</title></head> <body> <center><h1>Σφάλμα</h1></center> <p><center> Ουουπς, ξεχάσατε να συμπληρώσετε είτε την email address σας είτε κάποιο άλλο πεδίο. <br> Παρακαλούμε πατήστε το πλήκτρο BACK του προγράμματος περιήγησης <br>και δοκιμάστε ξανά. </center></p> </body> </html> <? } else { mail( "webmaster@test.gr", "Αίτηση για πρόσβαση στη σελίδα της νομοθεσίας", "$message\nΑπό πού πληροφορηθήκατε για το σιτέ μας? $whosentyou\n\nΑπό πού δεν πληροφορηθήκατε για το σιτέ μας? $whodontsentyou\n", "From: $name <$email>" ); header( "Location: http://www.test.gr/eyxaristoume.htm" ); } ?> |
|
|||
|
"station" <station@gamebox.net> wrote in message
news:bff5a0$4cc$1@nic.grnet.gr... > 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)) { > ?> > > <html> > <head><title>Σφάλμα</title></head> > <body> > <center><h1>Σφάλμα</h1></center> > <p><center> > Ουουπς, ξεχάσατε να συμπληρώσετε είτε την email address σας είτε κάποιο άλλο > πεδίο. <br> > Παρακαλούμε πατήστε το πλήκτρο BACK του προγράμματος περιήγησης <br>και > δοκιμάστε ξανά. > </center></p> > </body> > </html> > > <? > } > else { > mail( "webmaster@test.gr", "Αίτηση για πρόσβαση στη σελίδα της νομοθεσίας", > "$message\nΑπό πού πληροφορηθήκατε για το σιτέ μας? $whosentyou\n\nΑπό πού δεν > πληροφορηθήκατε για το σιτέ μας? $whodontsentyou\n", > "From: $name <$email>" ); > header( "Location: http://www.test.gr/eyxaristoume.htm" ); > } > ?> > Hi Station $_SERVER['REMOTE_ADDR'] is what you need for the client IP address HTTP_REFERER returns the name of the webpage that the user came from to reach your current page. ( a page with your link on) If the variable is empty it means they typed in the URL themselves or the link was made by a JavaScript function or similar that defeats the referer variable. Cheers Ron |