Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

IP logging @ Contact.php

Asked Modified Viewed 3,153 times
E
Enymizer
E
  • Junior Member, joined since
  • Contributed 49 posts on the community forums.
  • Started 17 threads in the forums
  • Started this discussions
asked
Junior Member

Is it possible to have IP logging in contact.php?

In that case, can some one help me?
0 replies

2 posts

E
Enymizer
E
  • Junior Member, joined since
  • Contributed 49 posts on the community forums.
  • Started 17 threads in the forums
  • Started this discussions
answered
Junior Member

nice! :-)

*Spank You (L)*
0 replies
T
tiido
T
tiido 10
  • Newbie, joined since
  • Contributed 9 posts on the community forums.
answered
Newbie

my contact.php file - works very well

<?php
/*---------------------------------------------------+
| PHPFusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2006 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
require_once "maincore.php";
require_once "subheader.php";
require_once "side_left.php";
include LOCALE.LOCALESET."contact.php";

[b]//record ip ::: START
if ($_SERVER['HTTP_X_FORWARD_FOR']) {
$sender_ip = $_SERVER['HTTP_X_FORWARD_FOR'];
} else {
$sender_ip = $_SERVER['REMOTE_ADDR'];
}
//record ip ::: END[/b]


if (isset($_POST['sendmessage'])) {
   $mailname = substr(stripinput(trim($_POST['mailname'])),0,50);
   $email = substr(stripinput(trim($_POST['email'])),0,100);
   $subject = substr(str_replace(array("\r","\n","@"), "", descript(stripslash(trim($_POST['subject'])))),0,50);
   [b]$message = descript(stripslash(trim($_POST['message']."

Sender IP: ".$_POST['sender_ip'])));[/b]
   if ($mailname == "") {
      $error .= "· <span class='alt'>".$locale['420']."</span><br>\n";
   }
   if ($email == "" || !preg_match("/^[-0-9A-Z_\.]{1,50}@([-0-9A-Z_\.]+\.){1,50}([0-9A-Z]){2,4}$/i", $email)) {
      $error .= "· <span class='alt'>".$locale['421']."</span><br>\n";
   }
   if ($subject == "") {
      $error .= "· <span class='alt'>".$locale['422']."</span><br>\n";
   }
   if ($message == "") {
      $error .= "· <span class='alt'>".$locale['423']."</span><br>\n";
   }
   echo $subject;
   if (!$error) {
      require_once INCLUDES."sendmail_include.php";
      sendemail($settings['siteusername'],$settings['siteemail'],$mailname,$email,$subject,$message);
      opentable($locale['400']);
      echo "<center><br>\n".$locale['440']."<br><br>\n".$locale['441']."</center><br>\n";
      closetable();
   } else {
      opentable($locale['400']);
      echo "<center><br>\n".$locale['442']."<br><br>\n$error<br>\n".$locale['443']."</center><br>\n";
      closetable();
   }
} else {
   opentable($locale['400']);
   echo $locale['401']."<br><br>
<form name='userform' method='post' action='".FUSION_SELF."'>
<table align='center' cellpadding='0' cellspacing='0' class='tbl'>
<tr>
<td width='100'>".$locale['402']."</td>
<td><input type='text' name='mailname' maxlength='50' class='textbox' style='width: 200px;'></td>
</tr>
<tr>
<td width='100'>".$locale['403']."</td>
<td><input type='text' name='email' maxlength='100' class='textbox' style='width: 200px;'></td>
</tr>
<tr>
<td width='100'>".$locale['404']."</td>
<td><input type='text' name='subject' maxlength='50' class='textbox' style='width: 200px;'></td>
</tr>
<tr><td valign='top' width='90'>".$locale['405']."</td>
<td><textarea name='message' rows='10' class='textbox' style='width: 320px'></textarea></td>
</tr>
<tr>
<td align='center' colspan='2'>
<input type='submit' name='sendmessage' value='".$locale['406']."' class='button'>
[b]IP recorded: <b>".$sender_ip."</b>
<input type='hidden' name='sender_ip' value='".$sender_ip."'>[/b]
</td>
</tr>
</table>
</form>\n";
   closetable();
}

require_once "side_right.php";
require_once "footer.php";
?>
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 2 posts
  • Votes 0 votes
  • Topic users 2 members

0 participants

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet