php logging

Discussion in 'Software' started by SportsNut, Aug 12, 2004.

  1. SportsNut

    SportsNut Corporal

    I have a page that I have set up using php with a name/password entry.

    Is there a way to set up some kind of logging to record when someone uses it? I would like to know as much info as I can when any of the names/passwords are used. Also would like to know if anyone is trying to get past it like guessing at names and passwords.
     
  2. Wookie

    Wookie Sergeant Major

    Not to tough, you would have to either write data to a text file or some sort of database. Just put in your code when the user logs in, the time, get their IP address. the name and password they attempted to used. Have it write all that to a database or text file and write some code so you can read it back all pretty.

    Heres an example to get the IP address

    Code:
    <?php print "My ip is: $REMOTE_ADDR"; ?>
    
     
  3. goldfish

    goldfish Lt. Sushi.DC

    Make a "logins" table, and have it log the username, password, IP, maybe even browser/OS version.

    The fully variable is $_SERVER['REMOTE_ADDR'] I belive... which is what you should use as its the most portable :)
     
  4. SportsNut

    SportsNut Corporal

    Thanks guys

    I'm still rather new to php so I appreciate the tips.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds