Jump to content

Recommended Posts

Hello,
 
The below is the code i have i want to track down the ipaddress of the people who ever subscribed to my list. I am beginner in php kindly do the needful. Thanks a lot in advance.
 
<!-- Subscribe form -->
<form action="subscribe/NLprocess.php" method="post">
 
      <h6 class=footer-widget-heading>Enter your email:</h6> 
      
 
      <div class="input">
        <input type="text" class="button" name="email" placeholder="Email address">
<input type="submit" class="button" id="submit" value="Subscribe">
      </div>
    </form>
<!-- End subscribe form -->
 
The processing file NLprocess.php ----
 
$emailmanager = 'smallstamps@gmail.com';
 
// SECOND:
// save this file, and close it. Thank you!
 
error_reporting(0);
 
$email = trim($_POST['email']);
 
 
$Ok = ereg("^([a-zA-Z0-9_\.-]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$", $email);
if ($Ok) {
mail($emailmanager,'Subscribe','','From: '.$email);
 
if(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$",$UNameFrm))
{
 
?>
 
 
<script language = 'javascript'>
alert('Thank you, Now you Subcribed to smallstamps.com Updates');
history.go(-1);
</script>
<?
exit();
}
 
else {
if(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$",$UNameFrm))
{
 
 
?>
<script language = 'javascript'>
alert('Sorry, please provide a valid Email address.');
history.go(-1);
</script>
<?
exit();
}
}
?>
 
 
Kindly let me know what i have to do to track the ip address.
 

 

Link to comment
https://forums.phpfreaks.com/topic/302598-track-ip-for-subscription-form/
Share on other sites

You can get the IP address with

$ipaddr = (isset($_SERVER["HTTP_X_FORWARDED_FOR"]) ? /* proxy */ $_SERVER["HTTP_X_FORWARDED_FOR"] : $_SERVER["REMOTE_ADDR"]);
Put that into the body of the email however you want.

I am so sorry, If i had IP script i would may done that as well :tease-01: , I felt some of the beginners like me in php could able to help me out if they have complete code where to insert the real code :confused: .

Sorry to take you to the (ancient world  ::) )

Kindly do the needful.

 

This is not a code-for-free service. requinix provided the relevant data, now it's your job to do some basic research and integrate the feature into your code.

 

Of course we can help you with specific questions. But if you expect us to do the work for you, that won't happen, no matter how kindly you ask for it.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.