Results 1 to 2 of 2

Thread: Call script on button?

  1. #1

    Thread Starter
    Lively Member Marthz's Avatar
    Join Date
    Nov 2009
    Posts
    115

    Call script on button?

    Im making this thing on my site. A contact form. I want it so that when they press submit it logs the ip and stores it into a mysql db. I want it on submit though, just not any ip logged, because I want it logged so that if someone does something stupid or so I can ban them.

    I found this script on the web for the ip logging

    Code:
    <head>
    <meta  http-equiv="Content-Language" content="en-us">
    </head>
    
    <?
    
    $ip  = $_SERVER['REMOTE_ADDR'];
    
    $date = date('l jS \of F Y h:i:s A');
    
    ?>
    
    <?php
    
    include('config.php');
    
    $sql="INSERT  INTO request (ip, date)
    VALUES
    ('$ip','$date')";
    
    if  (!mysql_query($sql,$con))
      {
      die('Error: ' . mysql_error());
       }
    echo "";
    
    mysql_close($con)
    ?>
    However that is just to log the ips. I need it to log them when they press submit.

  2. #2
    Frenzied Member
    Join Date
    Apr 2009
    Location
    CA, USA
    Posts
    1,516

    Re: Call script on button?

    Create a form, set its "action" attribute to a page which contains the code you've found (in addition to any other form processing).

Posting Permissions

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



Click Here to Expand Forum to Full Width