astaracheetah
01-23-2004, 04:52 AM
I need a PHP code to put into my PHP file that my form uses, so that when somebody fills out the form and sends it to me, it shows me their IP address. This is to prevent (or to HELP prevent) people from making 1,000,000,000 memberships. I found this on a site:
<?
$ip = getenv('REMOTE_ADDR');
PRINT("Your Ip $ip Has Been Logged!");
?>
But I have no idea of where in the PHP file that I'm supposed to put it, or if it even works! Help? :crying:
It would entirely depend on how your form works (I'm assuming you already have a PHP form in place)
If your script creates an e-mail, then you should add a line just before the e-mail is sent. It's difficult to help without seeing the PHP you are using.
astaracheetah
01-23-2004, 08:00 PM
The URL to the form is http://www.simple-desires.org/wkc and here is the code from the PHP file that the form uses:
<?
require "template.inc";
my_siteTop ("WKC Owner Registration");
?>
<?
//Message//
$message = "Hello!\n
Below is the contents of the form that ".$PreferredName." submitted on ".date("jS F Y").".\n
Preferred User Name: ".$PreferredName."\n
Prefixes: ".$Prefixes."\n
Site Name: ".$SiteName."\n
Site URL: ".$URL."\n
Password: ".$Password."\n
E-mail: ".$email."\n";
//Headers//
$subject = "$subject\n";
$from = "From: ".$email."\n";
$replyto = "Reply-To: ".$email."\n";
$cc = "CC: ".$email."\n";
$additional_headers = $from.$replyto.$cc;
//Send the Email//
@ $mailed = mail("reg@cheetahkennelz.com", $subject, $message, $additional_headers);
if ($mailed) {
echo "<p><center>Your message has been sent and a copy has been CCed to ".$email.". You will be notified when you are officially registered.</center></p>";
}
else {
echo "<p><center>There has been an error sending your message. Please contact <a href='mailto:astara@cheetahkennelz.com'>Cheetah</a> immediately.</center></p>";
}
?>
<?
my_siteBottom ();
?>
edit: And for some reason, it won't let me read your post in thew forum! Luckily, I got it in e-mail form.
astaracheetah
01-23-2004, 08:02 PM
And for some reason, it won't let me read your post in thew forum! Luckily, I got it in e-mail form.
jtchange
01-25-2004, 07:22 PM
what you could do is get the user ip from them by using:
<?php
$ip = $REMOTE_ADDR;
?>
OR by making a hiden field on ur form page:
<input type="hidden" name="ip" value="<?php $REMOTE_ADDR; ?>">
and then sending it in the email with everything else
//Message//
$message = "Hello!\n
Below is the contents of the form that ".$PreferredName." submitted on ".date("jS F Y").".\n
Preferred User Name: ".$PreferredName."\n
Prefixes: ".$Prefixes."\n
Site Name: ".$SiteName."\n
Site URL: ".$URL."\n
Password: ".$Password."\n
E-mail: ".$email."\n";
IP Address: ".$ip."\n;
i hope that help
astaracheetah
01-25-2004, 09:40 PM
That sortof worked, except that when I recieved the form, the IP part was blank. Not good.. lol
zapzappys
01-30-2004, 12:17 AM
My idea is very good seeing I'm advanced in php.
Create that table which will hold your info.
CREATE TABLE `ip` (
`ip` varchar(15) NOT NULL default '000.000.000.000'
) TYPE=MyISAM;
Then put this on your page and it will send your info out to your table.
<?
$ip = getenv('REMOTE_ADDR');
PRINT("Your Ip $ip Has Been Logged!");
$sql = mysql_query("INSERT INTO ip (ip)
VALUES('$ip'");
?>