SandySynaptik Posted October 11, 2011 Share Posted October 11, 2011 I want a webpage that whenever a user visits that webpage it track/store its IP address and the time of the visit to the database. I think emailing the whole thing would be more easier than storing into database. Link to comment Share on other sites More sharing options...
Don E Posted October 11, 2011 Share Posted October 11, 2011 Hmm, well easy storing into a database too. You can make a table with columns like id, ip_address, time and store each visitors ip and time in those columns. To make it more simple, and if you're wondering what data type to use for ip_address column, you can use varchar. You can use the $_SERVER['REMOTE_ADDR']; and the now() function in MySQL when inserting(querying) into a database each time a user visits. If you want, you can also email it to you too along with storing into a database/table. Link to comment Share on other sites More sharing options...
Ingolme Posted October 11, 2011 Share Posted October 11, 2011 I think it would be kind of annoying to get an e-mail for every single visit to your site. Imagine getting 50 visits a day (which isn't that much)Databases are made to manage these things, e-mail was intended for communication. Link to comment Share on other sites More sharing options...
SandySynaptik Posted October 11, 2011 Author Share Posted October 11, 2011 And what should be the length/value of that varchar of that field? Link to comment Share on other sites More sharing options...
Don E Posted October 11, 2011 Share Posted October 11, 2011 Well since there's really not too much going into that field(ip address), just give it a length that you'll know it'll be okay, like anywhere between15-25. Link to comment Share on other sites More sharing options...
Ingolme Posted October 11, 2011 Share Posted October 11, 2011 15 characters is the maximum you'll get for an IPv4, but IPv6 has more (I don't know the exact format, you'll have to look it up) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.