Saving IP's - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Saving IP's

borering_guy89borering_guy89 Posts: 33Member
I have the PHP code to get the viewers IP address but i need some to save the ip adress to a text document. Can anyone help me with a link or anything?

Comments

  • tvientitvienti Posts: 230Member
    Your question confuses me a little. Let me suggest this:

    [code]
    // assuming you have their IP saved in $IP
    if ($fh = fopen('log_file', 'a')) // open for appending
    {
    fwrite ($IP);
    fclose ($fh);
    }
    [/code]

    That will save their IP to the file. Presumably, you want additional info like the time, and probably a line break at the end so it's actually readable.

    T

    : I have the PHP code to get the viewers IP address but i need some to save the ip adress to a text document. Can anyone help me with a link or anything?
    :

  • MEGAG3EKMEGAG3EK Posts: 10Member
    : Your question confuses me a little. Let me suggest this:
    :
    : [code]
    : if ($fh = fopen('log_file', 'a')) // open for appending
    : {
    : fwrite ([red]$fh, $_SERVER['REMOTE_ADDR']."
    "[/red]);
    : fclose ($fh);
    : }
    : [/code]
    :
    : That will save their IP to the file. Presumably, you want additional info like the time, and probably a line break at the end so it's actually readable.
    :
    : T
    :
    : : I have the PHP code to get the viewers IP address but i need some to save the ip adress to a text document. Can anyone help me with a link or anything?
    : :
    :
    :

    That's the way to se clients IP. And don't forget the handle :P


    [code][green] //MEGAG3EK
    //Homepage: hackers.doesntexist.com [/green]
    [blue]return[/blue] 0; [/code]

Sign In or Register to comment.