0

Can Someone Tell Me how to make a auto posting form .
I need theat form for automatic pots ip on sql db,
Please Help Thx.

Edited by dan1992: n/a

2
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by scaiferw
0

I think we'd need more information on just what it is you're trying to do, and clarification on your second sentence, in order to help.

0

Can Someone Tell Me how to make a auto posting form .
I need theat form for automatic pots ip on sql db,
Please Help Thx.

Error file

<?php 
$ip = getenv("REMOTE_ADDR") ;
print_r($_POST['ip']);
?>
<form name="form1" method="post" action="ip ban.php">
<input type="submit" name="ip" id="ip" value="<?php echo $ip ;?>">
</form>

Post File

<?php 
include "sec/db.php";
if (isset($_POST['ip'])) {$ip = $_POST['ip']; if ($ip == ''){unset($ip);}}
?>
<?php
if (
isset($ip)
)
{
$date = date("Y-m-d-H-m-s");
$result = mysql_query ("INSERT INTO ip (ip,date) VALUES ('$ip','$date')");}
?>
<?php
$url="index.php";
$timeout_minutes = 0;
$timeout_seconds = 1;
sleep($timeout_seconds + $timeout_minutes * 60);
exit;
?>
0

And i need theat te $ip to be posted automaticli (sry Bad englesh)

0

Do you even need a form? It looks like you're just wanting log the ip address of the visitor.

Is there any reason not to just go ahead and run the query to insert it?

If that's all you're trying to do, it could be done in just a couple of lines of code, and the date could be formatted right in the sql query rather than in PHP.

Let me know and if that's it I can help.

0

I think this is what you want:

mysql_query ("INSERT INTO ip (ip,date) VALUES ('".$_SERVER["REMOTE_ADDR"]."',NOW()") or die(mysql_error());

Search Google on "mysql now()" for further information if you what to modify the date format used.

Edited by scaiferw: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.