2.) where do the files go when using the upload action? how to access them?
3.) i see validation is already integrated is it good to have other php validation?
Strictly speaking JavaScript validation isn't validation -- it's input assistance. Anyone can bypass JavaScript; it's an aid, not a gate.
Let’s talk about form validation. Here’s what I would class as the ideal validation system for a form in a web application:
The form is displayed; you fill it in.
You submit the form to the server.
If you missed something out or provided invalid input, the form is redisplayed pre-filled with the valid data you already entered.
The redisplayed form tells you what you got wrong. It also flags the fields that were incorrect.
Loop until you fill the form in correctly.
Fatal error: Call to undefined function: logbadrequest() in /htdocs/domainname/components/com_chronocontact/chronocontact.php(390) : eval()'d code on line 29
<?php
// First, make sure the form was posted from a browser.
// For basic web-forms, we don't care about anything
// other than requests from a browser:
if(!isset($_SERVER['HTTP_USER_AGENT'])){
die("Forbidden - You are not authorized to view this page"«»);
exit;
}
// Make sure the form was indeed POST'ed:
// (requires your html form to use: action="post"«»)
if(!$_SERVER['REQUEST_METHOD'] == "POST"«»){
die("Forbidden - You are not authorized to view this page"«»);
exit;
}
// Host names from where the form is authorized
// to be posted from:
$authHosts = array("domain.com", "domain2.com", "domain3.com"«»);
// Where have we been posted from?
$fromArray = parse_url(strtolower($_SERVER['HTTP_REFERER']));
// Test to see if the $fromArray used www to get here.
$wwwUsed = strpos($fromArray['host'], "www."«»);
// Make sure the form was posted from an approved host name.
if(!in_array(($wwwUsed === false ? $fromArray['host'] : substr(stristr($fromArray['host'], '.'), 1)), $authHosts)){
logBadRequest();
header("HTTP/1.0 403 Forbidden"«»);
exit;
}
// Attempt to defend against header injections:
$badStrings = array("Content-Type:",
"MIME-Version:",
"Content-Transfer-Encoding:",
"bcc:",
"cc:"«»);
// Loop through each POST'ed value and test if it contains
// one of the $badStrings:
foreach($_POST as $k => $v){
foreach($badStrings as $v2){
if(strpos($v, $v2) !== false){
logBadRequest();
header("HTTP/1.0 403 Forbidden"«»);
exit;
}
}
}
// Made it past spammer test, free up some memory
// and continue rest of script:
unset($k, $v, $v2, $badStrings, $authHosts, $fromArray, $wwwUsed);
?>
Any ideas?
<?php
if (eregi('http://*.', $comments))
die ("Sorry, no links allowed"«»);
if (eregi('www*.', $comments))
die ("Sorry, no links allowed"«»);
?>
function logBadRequest() {
@mail($admin, "Spammer Bot Attempt",$_SERVER['REMOTE_ADDR'],"From: Alert <alert@$domain>\r\n"«»);
}
You'd need to ensure that the variables $admin, $domain. etc. are defined or replaced with their Joomla equivalents.