How to save user ip when posting a php form? Please help me!

Discussion in 'PHP' started by cincin, Feb 7, 2009.

Thread Status:
Not open for further replies.
  1. #1
    I'm using a php photo upload script but I want to save the user ip when uploading the photo..I could not do it.. can someone help me about t

    here is the code which is posting the title and extra info of the photo inserted in the form

    if ($uploader->fetchMedia($file)) {

    if (!$uploader->upload()) {
    echo $uploader->getErrors();
    } else {
    $extra = isset($_POST['photo_extra']) ? $_POST['photo_extra'] : "";
    $photoStatus = $photoHandler->addLocalPhoto($catId,$upl...
    $ip = $_SERVER['REMOTE_ADDR']


    I'm getting user ip with this code $ip = $_SERVER['REMOTE_ADDR'];
    but dont konw how to wrte it to the db
    I have created a field called IP in the same table as photo_extra and photo_title
     
    cincin, Feb 7, 2009 IP
  2. steelaz

    steelaz Peon

    Messages:
    47
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It's not clear from the code you pasted, but you might want to modify "addLocalPhoto" function in "photoHandler" class.
     
    steelaz, Feb 7, 2009 IP
  3. Syndrom

    Syndrom Peon

    Messages:
    89
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You need to modify the function above $ip...

    pm me your msn and i wil fix it for you
     
    Syndrom, Feb 7, 2009 IP
  4. buldozerceto

    buldozerceto Active Member

    Messages:
    1,137
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    88
    #4
    find addlocalfoto function and post it here.
     
    buldozerceto, Feb 7, 2009 IP
  5. Crazy-T

    Crazy-T Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Yeah could all so insert it into a table you could make called `ip_logs` then ips ect easy stuff too do
     
    Crazy-T, Feb 7, 2009 IP
  6. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #6
    you want to store a data inside a database?
     
    bartolay13, Feb 8, 2009 IP
Thread Status:
Not open for further replies.