Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    May 2003
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    IP logging script

    Is there a script that logs the ip's of visitors that go to the admin login page of my website??? SO i can see what IP's dont mach mine , and then I can ban them??? Something that saves all ip's to a.txt file or sends it by mail or something... Please help.

    Xanni

  • #2
    Regular Coder
    Join Date
    Jul 2003
    Location
    New Zealand
    Posts
    435
    Thanks
    1
    Thanked 0 Times in 0 Posts
    <?
    mysql_connect("localhost","username""pass");
    mysql_select_db("dbname");

    $ip = $_SERVER['REMOTE_ADDR'];
    mysql_query("INSERT INTO IpLogs (Ip) VALUES ('$ip')") or die(mysql_error());
    echo '<br>IP logged.';
    ?>

    this will log the visitor's ip address into a table named ip into a column named ip.

  • #3
    New Coder
    Join Date
    May 2003
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    thanx

    thank you very much , just what I needed!

    Xanni

  • #4
    Regular Coder
    Join Date
    Jul 2003
    Location
    New Zealand
    Posts
    435
    Thanks
    1
    Thanked 0 Times in 0 Posts
    yw

  • #5
    New to the CF scene
    Join Date
    Jul 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Scrowler View Post
    <?
    mysql_connect("localhost","username""pass");
    mysql_select_db("dbname");

    $ip = $_SERVER['REMOTE_ADDR'];
    mysql_query("INSERT INTO IpLogs (Ip) VALUES ('$ip')") or die(mysql_error());
    echo '<br>IP logged.';
    ?>

    this will log the visitor's ip address into a table named ip into a column named ip.







    do i put this into my webpage jest like that and save it and bam could someone explain -noob i guess

  • #6
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Your server needs to support php. You also need to have a mysql database available to you. Once you have that and have the login details to the database you can create the table you need to store them. This isn't easy for a beginner. I suggest you do some php/mysql tutorials if you want to use something like this.
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •