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

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.