help with logging ip address during registration
Moderator: General Moderators
help with logging ip address during registration
Hello,
I would like to log the ip address of people that register on my site. I have created the database table for this but need the php code to get it logged. On the registration page I have a form that posts the data from each field to the db. I am new to php so the simplest terms would be appreciated.
Thanks in advance
I would like to log the ip address of people that register on my site. I have created the database table for this but need the php code to get it logged. On the registration page I have a form that posts the data from each field to the db. I am new to php so the simplest terms would be appreciated.
Thanks in advance
Re: help with logging ip address during registration
Code: Select all
echo $_SERVER["REMOTE_ADDR"]; // Should print the client's IP addressRe: help with logging ip address during registration
thanks for the quick reply. I want something that will post the ip address in the database table "ip". Any ideas on how to do this?
Re: help with logging ip address during registration
How is your database structured? Otherwise, check this link:
http://www.tizag.com/mysqlTutorial/mysqlinsert.php
http://www.tizag.com/mysqlTutorial/mysqlinsert.php
Re: help with logging ip address during registration
this would be the db query but i just used the mysql wizard to create the table
one post on another site looks about right but I always get errors when I insert that code into my form.
Code: Select all
CREATE TABLE `ip` (
`id` int(5) NOT NULL auto_increment,
`ip` varchar(50) NOT NULL default ”,
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;Code: Select all
<?php
$ip = $_SERVER['REMOTE_ADDR'];
$sql = “INSERT INTO `ip` ( `id` , `ip` ) VALUES ( ”, ‘$ip’)”;
$query = mysql_query($sql);
print “Logged: $ip”;
?>Re: help with logging ip address during registration
ok I figured out how to log the ip address. Now I have two other things to figure out for my login system. First I need to know how to replace the password that people type to Astrix ***** instead of showing the actual password. Also I need to add "verify email" and "verify password" fields and have them compare to each other. Again, I appreciate any help that you can offer.
Re: help with logging ip address during registration
starring the password is done client-side:
As for comparing, submit on post something like "pass1" and "pass2" and and just use PHP's comparator to see if they're the same, otherwise, reload the page, and display a warning that they did not match.
Code: Select all
<input type="password" size="30" />Re: help with logging ip address during registration
I don't understand how it's done on the client side. I have had the login system up and running and it doesn't star the password. I've checked it from several computers and still the same result. Can you explain in more detail how to compare the password, confirm password? Thanks in advance.
Re: help with logging ip address during registration
Wow what a worthless comment. It speaks to your character that you would take the time to register just to post an insulting comment. Thank you to everyone else that has been helpful.
Re: help with logging ip address during registration
Code: Select all
<input type="password" name="passwordFieldName">to compare that the passwords match, you need two HTML fields for entering the passwords.
Code: Select all
<p>Password: <input type="password" name="password" /><br />
Confirm Password: <input type="password" name="passwordConfirm" /></p>Code: Select all
if ($_POST['password'] != $_POST['passwordConfirm'])
{
die('Your passwords do not match.');
}Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Re: help with logging ip address during registration
Many thanks Scottayy, that's exactly what I was looking for.
Re: help with logging ip address during registration
I do second baoky's opinion!rxpghost wrote:Wow what a worthless comment.
All of your simple questions in your thread are "google answerable".
You should start "learn & think", instead of "copy & pasting"
There are 10 types of people in this world, those who understand binary and those who don't
