break;
case "add":
if (!empty($_POST)) {
if (isset($_POST["vname"])) {
$vname = $_POST["vname"];
if (strlen($vname) > 70) $vname = substr($vname,0,70);
}
if (isset($_POST["vemail"])) {
$vemail = $_POST["vemail"];
if (strlen($vemail) > 100) $vemail = substr($vemail,0,100);
}
if (isset($_POST["vurl"])) {
$vurl = $_POST["vurl"];
if (strlen($vurl) > 150) $vurl = substr($vurl,0,150);
}
if (isset($_POST["vcountry"])) {
$vcountry = $_POST["vcountry"];
if (strlen($vcountry) > 50) $vcountry = substr($vcountry,0,50);
}
if (isset($_POST["vcomment"])) $vcomment = $_POST["vcomment"];
} else if (!empty($HTTP_POST_VARS)) {
if (isset($HTTP_POST_VARS["vname"])) {
$vname = $HTTP_POST_VARS["vname"];
if (strlen($vname) > 70) $vname = substr($vname,0,70);
}
if (isset($HTTP_POST_VARS["vemail"])) {
$vemail = $HTTP_POST_VARS["vemail"];
if (strlen($vemail) > 100) $vemail = substr($vemail,0,100);
}
if (isset($HTTP_POST_VARS["vurl"])) {
$vurl = $HTTP_POST_VARS["vurl"];
if (strlen($vurl) > 150) $vurl = substr($vurl,0,150);
}
if (isset($HTTP_POST_VARS["vcountry"])) {
$vcountry = $HTTP_POST_VARS["vcountry"];
if (strlen($vcountry) > 50) $vcountry = substr($vcountry,0,50);
}
if (isset($HTTP_POST_VARS["vcomment"])) $vcomment = $HTTP_POST_VARS["vcomment"];
}
if (trim($vname)=="" or trim($vcountry)=="" or trim($vcomment)=="") {
echo "
Error !
You may left some fields. Please click here and try again.";
exit;
}
if (trim($vemail)!="" and !preg_match("/([\w\.\-]+)(\@[\w\.\-]+)(\.[a-z]{2,4})+/i", $vemail)) {
echo "
Error !
Invalid email address. Please click here and try again.";
exit;
}
if (trim($vurl) <> "") {
if (strtolower(trim($vurl)) <> "http://") {
if (!preg_match ("#^http://[_a-z0-9-]+\\.[_a-z0-9-]+#i", $vurl)) {
echo "
Error !
Website Invalid URL format. Please click here and try again.";
exit;
}
}
}
$test_comment = explode(" ",$vcomment);
$jmltest = count($test_comment);
for ($t=0; $t<$jmltest; $t++) {
if (strlen(trim($test_comment[$t])) > 35) {
echo "