我试图作两点发言。 如果一个变量是NOT的现存和安放,NOT与“Good2go”一词相对应,而另一个可以核查确保“人”变数。 我试图在此传递错误信息。 这里是我掌握的,也是我所尝试的,看来没有任何工作。
if (stripos($_POST[ check ], good2go ) == FALSE && $_POST[ body ]) {
$error = true; }
if (!$_POST[ check ] == good2go && $_POST[ body ]) {
$error = true; }
if (!stripos($_POST[ check ], good2go ) && $_POST[ body ]) {
$error = true; }
if ((!stripos($_POST[ check ], good2go )) && $_POST[ body ]) {
$error = true; }
我如何做到这一点?
页: 1 php有审定代码和电子邮件代码。
$error = false;
if (isset($_GET[ action ]) && ($_GET[ action ] == send )) {
// Winnie the pooh check
//$t = tep_db_prepare_input($_POST[ verify ]);
if (!isset($_POST[ check ]) && !$_POST[ check ]== good2go && isset($_POST[ body ])) {
$error = true;
} else { // Winnie the pooh Check
$name = tep_db_prepare_input($_POST[ name ]);
$email_address = tep_db_prepare_input($_POST[ email ]);
//IP recorder start
$ipaddress = $_SERVER["REMOTE_ADDR"];
$ip = "
IP: " . $ipaddress;
$content = "
Name: ".$name."
Comments: ".$_POST[ enquiry ];
$product = tep_db_prepare_input($_POST[ product ]);
if ($product) {
$product_text = "
Product Interest: ".$product; }
$content_ip = $content . $product_text. $ip;
$enquiry = tep_db_prepare_input($content_ip);
//IP recorder end
}
// BOF: Remove blank emails
// if (tep_validate_email($email_address)) {
// tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address);
// tep_redirect(tep_href_link(FILENAME_CONTACT_US, action=success ));
// } else {
// $error = true;
// $messageStack->add( contact , ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
if (! tep_validate_email($email_address)) {
$error = true;
$messageStack->add( contact , ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
}
if ($enquiry == ) {
$error = true;
$messageStack->add( contact , ENTRY_EMAIL_CONTENT_CHECK_ERROR);
}
if ($error == false) {
tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address);
tep_redirect(tep_href_link(FILENAME_CONTACT_US, action=success ));
// EOF: Remove blank emails
}
}