Hallo, ich habe bei mir eine Dropdownliste erstellt, die mit zeitwerten gefüllt ist. wenn man dann den wert auswählt und bestätigt, sollte die liste eig für diese zeit gesperrt sein. das klappt aber nich so ganz. hier mal der code:
index.php mit liste:
test.php mit zugeordneten zeitwerten zur blocktime:
hoffe ihr endeckt meinen fehler
index.php mit liste:
HTML:
<p>
<form action="test.php" method="get"><input type="submit" /> <?php
if (!mysql_connect ("localhost", "root", ""))
echo mysql_error();
if (!mysql_select_db ("test"))
echo mysql_error();
if (!mysql_query("DELETE FROM `ips` WHERE'" .time()."' - `time` > `blocktime`"))
echo mysql_error();
if (!$result = mysql_query("SELECT * FROM `ips` WHERE `ip`='" . addslashes($_SERVER["REMOTE_ADDR"]) . "'"))
echo mysql_error();
if (!mysql_fetch_row($result))
{
?> <select name="zeit" size="1">
<?php
}
else
{
?>
<select disabled="disabled" name="zeit" size="1">
<?php
}
?>
<option><?php
if (!$result = mysql_query("SELECT * FROM `ips` WHERE `ip`='" . addslashes($_SERVER["REMOTE_ADDR"]) . "'"))
echo mysql_error();
if ($row = mysql_fetch_row($result))
echo date("i:s", ($row[1] + $row[2] - time()));
?></option>
<option value="10">10 Minuten</option>
<option value="20">20 Minuten</option>
<option value="30">30 Minuten</option>
<option value="40">40 Minuten</option>
<option value="50">50 Minuten</option>
<option value="60">60 Minuten</option>
</select></form>
</p>
test.php mit zugeordneten zeitwerten zur blocktime:
HTML:
<html>
<head>
<meta http-equiv="expires" content="0">
<title>test</title>
</head>
<body>
<?php
if (!mysql_connect ("localhost", "root", ""))
echo mysql_error();
if (!mysql_select_db ("test"))
echo mysql_error();
if ($_GET["zeit"]=="10")
$A=rand(0,250);
if (!mysql_query("INSERT INTO `ips` (ip, time, blocktime) VALUES ('" . addslashes($_SERVER["REMOTE_ADDR"]) . "', '" . time() . "', '600')"))
echo mysql_error();
if ($_GET["zeit"]=="20")
$A=rand(0,438);
if (!mysql_query("INSERT INTO `ips` (ip, time, blocktime) VALUES ('" . addslashes($_SERVER["REMOTE_ADDR"]) . "', '" . time() . "', '1200')"))
echo mysql_error();
if ($_GET["zeit"]=="30")
$A=rand(0,656);
if (!mysql_query("INSERT INTO `ips` (ip, time, blocktime) VALUES ('" . addslashes($_SERVER["REMOTE_ADDR"]) . "', '" . time() . "', '1800')"))
echo mysql_error();
if ($_GET["zeit"]=="40")
$A=rand(0,875);
if (!mysql_query("INSERT INTO `ips` (ip, time, blocktime) VALUES ('" . addslashes($_SERVER["REMOTE_ADDR"]) . "', '" . time() . "', '2400')"))
echo mysql_error();
if ($_GET["zeit"]=="50")
$A=rand(0,1094);
if (!mysql_query("INSERT INTO `ips` (ip, time, blocktime) VALUES ('" . addslashes($_SERVER["REMOTE_ADDR"]) . "', '" . time() . "', '3000')"))
echo mysql_error();
if ($_GET["zeit"]=="60")
$A=rand(0,1313);
if (!mysql_query("INSERT INTO `ips` (ip, time, blocktime) VALUES ('" . addslashes($_SERVER["REMOTE_ADDR"]) . "', '" . time() . "', '3600')"))
echo mysql_error();
if (!mysql_query("INSERT INTO `werte` (`werte`) VALUES ('$A')"))
echo mysql_error();
?>
</form>
</form>
</body>
</html>
hoffe ihr endeckt meinen fehler