本文整理汇总了PHP中died函数的典型用法代码示例。如果您正苦于以下问题:PHP died函数的具体用法?PHP died怎么用?PHP died使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了died函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendEmail
function sendEmail()
{
if (isset($_POST['email'])) {
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "thesportsage16@gmail.com";
$email_subject = "Website Inquiry : ";
function died($error)
{
// your error code can go here
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error . "<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die;
}
// validation expected data exists
if (!isset($_POST['name']) || !isset($_POST['email']) || !isset($_POST['subject']) || !isset($_POST['message'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$name = $_POST['name'];
// required
$email = $_POST['email'];
// required
$subject = $_POST['subject'];
// required
$message = $_POST['message'];
// required
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}$/';
if (!preg_match($email_exp, $email)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
$string_exp = "/^[A-Za-z .'-]+\$/";
if (!preg_match($string_exp, $name)) {
$error_message .= 'The Name you entered does not appear to be valid.<br />';
}
if (strlen($message) < 2) {
$error_message .= 'The Comments you entered do not appear to be valid.<br />';
}
if (strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Form details below.\n\n";
function clean_string($string)
{
$bad = array("content-type", "bcc:", "to:", "cc:", "href");
return str_replace($bad, "", $string);
}
$email_message .= "Name: " . clean_string($name) . "\n";
$email_message .= "Email: " . clean_string($email) . "\n";
$email_message .= "Subject: " . clean_string($subject) . "\n";
$email_message .= "Message: " . clean_string($message) . "\n";
// create email headers
$headers = 'From: ' . $email . "\r\n" . 'Reply-To: ' . $email . "\r\n" . 'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
}
}
示例2: died
<?php
if (isset($_POST['emailphp'])) {
if (!isset($_POST['nombrephp']) || !isset($_POST['asuntophp']) || !isset($_POST['mensajephp'])) {
died('Asegurese de haber llenado todos los campos.');
}
$name = json_decode($_POST['nombrephp']);
$email = json_decode($_POST['emailphp']);
$asunto = json_decode($_POST['asuntophp']);
$mensaje = json_decode($_POST['mensajephp']);
$email_to = "network.experts.solution@gmail.com";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}$/';
if (!preg_match($email_exp, $email)) {
died('La dirección de correo proporcionada no es válida.');
}
$mensaje_final = "Mensaje enviado de: " . $name . PHP_EOL . PHP_EOL . $mensaje;
$headers = 'From: ' . $email . "\r\n" . 'Reply-To: ' . $email . "\r\n" . 'X-Mailer: PHP/' . phpversion();
@mail($email_to, $asunto, $mensaje_final, $headers);
echo "Su mensaje fue recibido con exito. Nos pondremos en contacto con usted a la brevedad posible";
}
function died($error)
{
echo "Lo sentimos, hubo un error en sus datos y el formulario no puede ser enviado en este momento. ";
echo "Detalle de los errores." . PHP_EOL . PHP_EOL;
echo $error . PHP_EOL . PHP_EOL;
echo "Porfavor corrija estos errores e inténtelo de nuevo." . PHP_EOL . PHP_EOL;
die;
}
示例3: died
if (isset($_POST['email'])) {
$email_to = "amzaid92@gmail.com";
$email_subject = "Website Contact";
function died($error)
{
// your error code can go here
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error . "<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die;
}
// validation expected data exists
if (!isset($_POST['name']) || !isset($_POST['email']) || !isset($_POST['message'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$email_message = "Form details below.\n\n";
function clean_string($string)
{
$bad = array("content-type", "bcc:", "to:", "cc:", "href");
return str_replace($bad, "", $string);
}
$email_message .= "Name: " . clean_string($name) . "\n";
$email_message .= "Email: " . clean_string($email) . "\n";
$email_message .= "Message: " . clean_string($message) . "\n";
// create email headers
$headers = 'From: ' . $email . "\r\n" . 'Reply-To: ' . $email . "\r\n" . 'X-Mailer: PHP/' . phpversion();
示例4: died
must be given in your project.
It should not be used to sell or make money out of it, for selling
licence contact authur
Copyright 2016 - All Rights Reserved - Prateek Mathapati
*/
/*Getting User Input from form and assigning it to variable*/
$uname = $_POST['uname'];
$uemail = $_POST['uemail'];
$uphone = $_POST['uphone'];
$umessage = $_POST['umessage'];
$email_to = "<your-mail-id@dragneel.com>";
//Your Mail Id
$email_subject = "Customer Contact Details";
/*Validation Function for Empty Fields*/
if (empty($_POST["uname"]) || empty($_POST["uemail"]) || empty($_POST["uphone"]) || empty($_POST["umessage"])) {
died('please fill the form before submitting');
exit;
}
$email2 = "<noreply@dragneel.com>";
/*Clean String for appending the text to body*/
function clean_string($string)
{
$bad = array("content-type", "bcc:", "to:", "cc:", "href");
return str_replace($bad, "", $string);
}
/*Adding text which we got from user form to mail body*/
$email_message = "Customer Contact Details.<br><br>";
$email_message .= "Name: " . clean_string($uname) . "<br><br>";
$email_message .= "Email: " . clean_string($uemail) . "<br><br>";
$email_message .= "Phone No: " . clean_string($uphone) . "<br><br>";
$email_message .= "Message: " . clean_string($umessage) . "<br><br>";
开发者ID:officialprateek,项目名称:Super-Awesome-Clean-Simple-Easy-Contact-us-Form-using-HTML5-CSS3-Bootstrap,代码行数:31,代码来源:sendmail.php
示例5: array
$comments = $_POST['comments'];
// required
$error_messages = array();
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}$/';
if (!preg_match($email_exp, $email_from)) {
array_push($error_messages, 'invalid email address');
}
$string_exp = "/^[A-Za-z .'-]+\$/";
if (!preg_match($string_exp, $name)) {
array_push($error_messages, 'invalid name');
}
if (strlen($comments) < 2) {
array_push($error_messages, 'invalid comments');
}
if (count($error_messages) > 0) {
died($error_messages);
}
$email_message = "Form details below.\n\n";
function clean_string($string)
{
$bad = array("content-type", "bcc:", "to:", "cc:", "href");
return str_replace($bad, "", $string);
}
$email_message .= "Name: " . clean_string($name) . "\n";
$email_message .= "Email: " . clean_string($email_from) . "\n";
$email_message .= "Telephone: " . clean_string($telephone) . "\n";
$email_message .= "Comments: " . clean_string($comments) . "\n";
// create email headers
$headers = 'From: ' . $email_from . "\r\n" . 'Reply-To: ' . $email_from . "\r\n" . 'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
示例6: sidstr
echo "<form action=javascript:window.opener.location.href='classified.php?" . sidstr() . "status=7';window.close(); METHOD=POST><input type=submit value={$close}></form>\n";
} else {
echo "<form action=javascript:window.opener.location.reload();window.close(); METHOD=POST><input type=submit value={$close}></form>\n";
}
echo "</div>\n";
} else {
died("FATAL Error !!!");
}
} elseif ($adid) {
// Ask for sure
$result = mysql_query("SELECT * FROM " . $prefix . "ads WHERE id={$adid}");
$db = mysql_fetch_array($result);
if ($db[userid] == $_SESSION[suserid] || $_SESSION[susermod]) {
echo "<div class=\"mainheader\">{$admydel_head}</div>\n";
echo "<br>\n";
echo "<form action=\"classified_my_del.php\" METHOD=\"POST\">\n";
echo "<div class=\"smsubmit\">{$admydel_msg}<br><br>{$db['header']}\n";
echo "<input type=\"hidden\" name=\"adid\" value=\"{$adid}\">\n";
echo "<input type=\"hidden\" name=\"confirm\" value=\"true\">\n";
echo "<br><br><input type=submit value={$admydel_submit}>\n";
echo "</div></form>\n";
} else {
died("FATAL Error !!!");
}
} else {
// Error
died("FATAL Error !!!");
}
}
//
window_footer();
示例7: _exists
function _exists($path)
{
needsLoggedIn();
$path = formatPath($path);
died(file_exists($path) ? 'true' : 'false');
}
示例8: died
die;
}
// If any fields were filled out inproperly this this function (above) will work
// as a kill switch and return the errors that need to be fixed
$errorMessage = "";
// empty string where all the error messages will be concated.
if ($firstName == "") {
$errorMessage .= "Please fill out \" First: \" field.<br>";
}
if ($lastName == "") {
$errorMessage .= "Please fill out \" Last: \" field.<br>";
}
if ($email == "") {
$errorMessage .= "Please fill out \" Email: \" field.<br>";
}
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$errorMessage .= "Invalid email format";
}
if ($message == "") {
$errorMessage .= "Please write a message.<br>";
}
if (strlen($errorMessage) > 0) {
died($errorMessage);
} else {
mail($mailTo, $subject, $message, $phpformsite);
echo "Youre message has been sent.<br>";
echo "Thankyou for contacting up<br>";
}
?>
示例9: inquiry_send
function inquiry_send()
{
$email_address = $_POST['email_address'];
if ($email_address) {
$your_name = $_POST['your_name'];
$inquiry_parts = $_POST['inquiry_parts'];
$product_inquiry = $_POST['product_inquiry'];
$email_to = 'jakir44.du@gmail.com';
$email_subject = "Contact from automobile inquiry";
function died($error)
{
// your error code can go here
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error . "<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die;
}
// validation expected data exists
if (!isset($your_name) || !isset($product_inquiry) || !isset($email_address)) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$first_name = $your_name;
// required
$email_from = $email_address;
// required
$inquiry_parts = $inquiry_parts;
// not required
$comments = $product_inquiry;
// required
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}$/';
if (!preg_match($email_exp, $email_from)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
$string_exp = "/^[A-Za-z .'-]+\$/";
if (!preg_match($string_exp, $your_name)) {
$error_message .= 'The First Name you entered does not appear to be valid.<br />';
}
if (strlen($comments) < 2) {
$error_message .= 'The Comments you entered do not appear to be valid.<br />';
}
if (strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Form details below.\n\n";
function clean_string($string)
{
$bad = array("content-type", "bcc:", "to:", "cc:", "href");
return str_replace($bad, "", $string);
}
$email_message .= "<p>Name: " . clean_string($your_name) . "</p>";
$email_message .= "<p>Email: " . clean_string($email_from) . "</p>";
$email_message .= "<p>Inquiry parts: " . clean_string($inquiry_parts) . "</p>";
$email_message .= "<p>Comments: " . clean_string($comments) . "</p>";
// create email headers
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: "' . $your_name . '"' . "\r\n";
$headers .= 'Reply-To: ' . $email_from . "\r\n";
$mail_send = wp_mail($email_to, $email_subject, $email_message, $headers);
if ($mail_send) {
$results = array('success' => true, 'mess' => 'Email successfully sent.');
} else {
$results = array('success' => false, 'mess' => 'Email not send, there are some error to send email.');
}
echo json_encode($results);
}
die;
}
示例10: while
echo "</div></td></tr>\n";
echo "</table>\n";
echo "<table align=\"center\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\" border=\"0\">\n";
while ($tempdb = mysql_fetch_array($result)) {
if ($choice == "fav") {
$query = mysql_query("SELECT * FROM " . $prefix . "ads WHERE id='{$tempdb['adid']}'") or died("Ads - Record NOT Found");
$db = mysql_fetch_array($query);
} else {
$db = $tempdb;
}
if ($db) {
$result2 = mysql_query("SELECT * FROM " . $prefix . "userdata WHERE id='{$db['userid']}'") or died("Userdata - Record NOT Found" . mysql_error());
$dbu = mysql_fetch_array($result2);
$result3 = mysql_query("SELECT * FROM " . $prefix . "adcat WHERE id='{$db['catid']}'") or died("Adcat - Record NOT Found");
$dbc = mysql_fetch_array($result3);
$result4 = mysql_query("SELECT * FROM " . $prefix . "adsubcat WHERE id='{$db['subcatid']}'") or died("AdSubcat Record NOT Found");
$dbs = mysql_fetch_array($result4);
if (!$db[location]) {
$db[location] = $ad_noloc;
}
$iconstring = "";
for ($i = 10; $i > 0; $i--) {
$iconfield = "icon" . $i;
$iconalt = "icon" . $i . "alt";
if ($db[$iconfield] && adfield($db[catid], $iconfield)) {
$iconstring .= "<img src=\"{$dbc[$iconfield]}\" alt=\"{$dbc[$iconalt]}\" align=\"right\" vspace=\"2\"\n onmouseover=\"window.status='{$dbc[$iconalt]}'; return true;\"\n onmouseout=\"window.status=''; return true;\">\n";
}
}
echo " <tr>\n";
echo " <td class=\"classcat5\">\n";
if ($db[_picture1] || $db[_picture2] || $db[_picture3] || $db[_picture4] || $db[_picture5]) {
示例11: badwordsmail
function badwordsmail($msg)
{
global $prefix;
$eachword = explode(" ", $msg);
$result = mysql_query("SELECT * FROM " . $prefix . "badwords") or died("Query Error");
while ($db = mysql_fetch_array($result)) {
for ($i = 0; $i < count($eachword); $i++) {
if (is_int(strpos($eachword[$i], $db['badword']))) {
$msg = eregi_replace($eachword[$i], str_repeats("*", strlen($eachword[$i])), $msg);
// Badword
}
}
}
return stripslashes($msg);
}
示例12: sidstr
} else {
echo " ";
}
echo " </td>\n";
echo " <td class=\"classcat2\">\n";
if ($db) {
echo " <a href=\"classified.php?catid={$catid}&subcatid={$db['id']}\" onmouseover=\"window.status='{$db['description']}';\n return true;\" onmouseout=\"window.status=''; return true;\">{$db['name']}</a> ({$db['ads']})<br>\n";
}
echo " <div class=\"smallleft\">\n";
echo " {$db['description']}<br>\n";
if ($catnotify && $db[id] && $_SESSION[suserid]) {
echo " <a href=\"notify.php?addid={$db['id']}\"\n onClick='enterWindow=window.open(\"notify.php?" . sidstr() . "addid={$db['id']}\",\"Notify\",\"width=400,height=200,top=200,left=200\"); return false'\n onmouseover=\"window.status='{$notify_add}'; return true;\"\n onmouseout=\"window.status=''; return true;\">\n <img src=\"{$image_dir}/icons/mail.gif\" border=\"0\" alt=\"{$notify_add}\" align=\"right\" vspace=\"2\"></a>\n";
if ($dbc[passphrase]) {
echo "<img src=\"{$image_dir}/icons/key.gif\" alt=\"{$cat_pass}\" align=\"right\" vspace=\"2\"\n onmouseover=\"window.status='{$cat_pass}'; return true;\"\n onmouseout=\"window.status=''; return true;\">";
}
if ($show_newicon) {
$query = mysql_query("SELECT id FROM " . $prefix . "ads WHERE subcatid='{$db['id']}' AND (TO_DAYS(addate)>TO_DAYS(now())-{$show_newicon})") or died(mysql_error());
if (mysql_num_rows($query)) {
echo "<img src=\"{$image_dir}/icons/new.gif\" alt=\"{$cat_new}\" align=\"right\" vspace=\"2\"\n onmouseover=\"window.status='{$cat_new}'; return true;\"\n onmouseout=\"window.status=''; return true;\">";
}
}
}
echo " </div>";
echo " </td>\n";
echo " </tr>\n";
}
//End while
}
# End of Page reached
#################################################################################################
echo "</table>\n";
示例13: explode
$picsize = explode("x", $pic_lowres);
if ($picinfo[0] > intval($picsize[0]) || $picinfo[1] > intval($picsize[1])) {
$div[0] = $picinfo[0] / $picsize[0];
$div[1] = $picinfo[1] / $picsize[1];
if ($div[0] > $div[1]) {
$sizestr = "width=" . intval($picinfo[0] / $div[0]) . " height=" . intval($picinfo[1] / $div[0]);
} else {
$sizestr = "width=" . intval($picinfo[0] / $div[1]) . " height=" . intval($picinfo[1] / $div[1]);
}
} else {
$sizestr = $picinfo[3];
}
echo " <a href=\"pictureviewer.php?pic={$pic_path}/{$picture}\" onClick='enterWindow=window.open(\"pictureviewer.php?" . sidstr() . "pic={$pic_path}/{$picture}\",\"Picture\",\"width={$pic_width},height={$pic_height},top=100,left=100,scrollbars=yes,resizable=yes\"); return false'>\n <img src=\"{$pic_path}/{$picture}\" {$sizestr} border=\"0\" alt=\"{$ad_enlarge}\"></a>\n";
} elseif ($picture) {
// claculate thumbnail-size
$result4 = mysql_query("SELECT * FROM " . $prefix . "pictures WHERE picture_name='{$picture}'") or died("Can NOT find the Picture");
$dbp = mysql_fetch_array($result4);
$picsize = explode("x", $pic_lowres);
if ($dbp[picture_width] > intval($picsize[0]) || $dbp[picture_height] > intval($picsize[1])) {
$div[0] = $dbp[picture_width] / $picsize[0];
$div[1] = $dbp[picture_height] / $picsize[1];
if ($div[0] > $div[1]) {
$sizestr = "width=" . intval($dbp[picture_width] / $div[0]) . " height=" . intval($dbp[picture_height] / $div[0]);
} else {
$sizestr = "width=" . intval($dbp[picture_width] / $div[1]) . " height=" . intval($dbp[picture_height] / $div[1]);
}
} else {
$sizestr = "width={$dbp['picture_width']} height={$dbp['picture_height']}";
}
echo " <a href=\"pictureviewer.php?id={$picture}\" onClick='enterWindow=window.open(\"pictureviewer.php?" . sidstr() . "id={$picture}\",\"Picture\",\"width={$pic_width},height={$pic_height},top=100,left=100,scrollbars=yes,resizable=yes\"); return false'>\n <img src=\"picturedisplay.php?id={$picture}\" {$sizestr} border=\"0\" alt=\"{$ad_enlarge}\"></a>\n";
}
示例14: header
if ($_SESSION[suserid] || $votefree) {
if (!$vote) {
header(headerstr($source . "?status=8"));
} else {
if (isbanned($_SESSION[suserid])) {
// IP banned, Do nothing !!!
$errormessage = rawurlencode($error[27]);
$headerstr = "status=9&errormessage={$errormessage}";
} elseif ($vote && $_SESSION[suserlastvote] + $vote_cookie_time * 3600 > $timestamp && $vote_cookie_time) {
// Cookie is set - Already voted, Do nothing !!!
$errormessage = rawurlencode($error[25]);
$headerstr = "status=9&errormessage={$errormessage}";
} elseif ($vote) {
mysql_query("update " . $prefix . "votes set votes=votes+1 where id='{$vote}'") or died("Database Query Error");
if ($_SESSION[suserid]) {
mysql_query("update " . $prefix . "userdata set votes=votes+1,lastvotedate=now(),lastvote='{$timestamp}' where id='{$_SESSION['suserid']}'") or died("Database Query Error");
}
$_SESSION[suserlastvote] = $timestamp;
logging("X", "{$_SESSION['suserid']}", "{$_SESSION['susername']}", "VOTE: voted", "");
$headerstr = "status=10";
}
}
} else {
$errormessage = rawurlencode($error[28]);
$headerstr = "status=9&errormessage={$errormessage}";
}
if (strpos("{$source}", "errormessage")) {
$source = substr("{$source}", 0, strpos("{$source}", "errormessage") - 1);
}
if (strpos("{$source}", "?")) {
$source = $source . "&";
示例15: die
# purpose : My Profile Area
#
#################################################################################################
if (!strpos($_SERVER['PHP_SELF'], 'member.php') === false) {
die("YOU MAY NOT ACCESS THIS FILE DIRECTLY");
}
if ($change == "email") {
include "{$language_dir}/member_chemail.inc";
} elseif ($change == "pass") {
include "{$language_dir}/member_chpass.inc";
} elseif ($change == "delete") {
include "{$language_dir}/member_delete.inc";
} elseif ($change == "sales" && $sales_option) {
include "sales_member.php";
} else {
$query = mysql_query("select * from " . $prefix . "userdata where id = '{$_SESSION['suserid']}'") or died(mysql_error());
list($id, $username, $password, $email, $sex, $newsletter, $level, $votes, $lastvotedate, $lastvote, $ads, $lastaddate, $lastad, $firstname, $lastname, $address, $zip, $city, $state, $country, $phone, $cellphone, $icq, $homepage, $hobbys, $field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8, $field9, $field10, $picture, $_picture, $language, $registered, $lastlogin, $timezone, $dateformat) = mysql_fetch_row($query);
if (!$homepage) {
$homepage = "http://";
}
if (strpos($client, "MSIE")) {
// Internet Explorer Detection
$field_size = "50";
$text_field_size = "31";
$input_field_size = "20";
} else {
$field_size = "28";
$text_field_size = "20";
$input_field_size = "10";
}
echo " <table align=\"center\">\n";