Tell me more ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

I'm thinking about making a PHP app that would store the IP addresses of people currently visiting my website by keeping them in a database.

I was wondering if someone else has done it before, it's such a common thing that I think someone else has probably done it before.

share|improve this question
What is the problem? – Bibhas Jun 19 '12 at 4:55
What do you mean what is the problem, I'm looking for an app that would do this, do you know of any? – user893730 Jun 19 '12 at 6:05
Please review the FAQ. This is not a good question for this site. This site is for users of existing web apps. – Al Everett Jun 19 '12 at 13:24

closed as off topic by Eight Days of Malaise, Alex, Al Everett, ChrisF Jun 24 '12 at 11:20

Questions on Web Applications Stack Exchange are expected to relate to web applications within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

1 Answer

Very simple script, you can make it much better but this should do it.

<?php

// Make a MySQL Connection
mysql_connect("localhost", "sqluser", "sqlpass") or die(mysql_error());
mysql_select_db("test") or die(mysql_error());

// Insert a row of information into the table "example"
mysql_query("INSERT INTO example (IP) VALUES("."'".$_SERVER['REMOTE_ADDR']."'".") ")
or die(mysql_error());  

echo "Data Inserted!";

?>
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.