Napsal jsem si tenhle script:
<?php
include 'error.inc';
include 'db.inc';
$errorString = "";
foreach($HTTP_POST_VARS as $varname => $value)
$formVars[$varname] = trim(clean($value, 50));
if (empty($formVars["firstName"]))
$errorString .=
"\n<br>Name";
if (empty($formVars["surname"]))
$errorString .=
"\n<br>surname";
if (empty($formVars["address1"]))
$errorString .=
"\n<br>address";
if (empty($formVars["city"]))
$errorString .=
"\n<br>city";
if (empty($formVars["dob"]))
$errorString .=
"\n<br>dob";
elseif (!ereg("^([0-9]{2})/([0-9]{2})/([0-9]{4})$",
$formVars["dob"], $parts))
$errorString .=
"\n<br>narozeniny" .
"ve formatu ddmmrrrr";
if (empty($formVars["email"]))
$errorString .=
"\n<br>email";
if (!empty($errorString))
{
?>
<head><title>Chyby ve formulari!</title></head>
<body>
<font color="red">
<h1>CHYBY!</h1>
<?=$errorString?>
<br><a href="example.6-5.php"> Návrat </a>
</body>
<?php
exit;
}
if (!($connection = @ mysql_pconnect($hostName, $unsername, $password)))
die("Nemohu se připojit k databázi!");
if (!mysql_select_db($databeseName, $connection))
showerror();
$dob = " \"$parts[3]-$parts[2]-$parts[1]\"";
$query = "INSERT INTRO customer
set cust_id = NULL, " .
"surname = \"" . $formVars["surname"] . "\", " .
"firstname = \"" . $formVars["firstName"] . "\", " .
"addresslinel = \"" . $formVars["address1"] . "\", " .
"city = \"" . $formVars["city"] . "\", " .
"email = \"" . $formVars["email"] . "\", " .
"birth_date = $dob";
if (!(@ mysql_query ($query, $connection)))
showerror();
$custID = mysql_isert_id();
header("Location: customer_receipt.php?custID=?custID");
?>
a háže mi to error:
Fatal error: Call to undefined function: clean() in /3w/aktualne.cz/h/hackers/test/example.6-6.php on line 11
Už si stím nevím rady!
Prosím pomoc!