הוסטס - פורום אחסון האתרים הגדול בישראל

הוסטס - פורום אחסון האתרים הגדול בישראל (https://hosts.co.il/forums/index.php)
-   פורום תיכנות (https://hosts.co.il/forums/forumdisplay.php?f=14)
-   -   אתם ממשיכיים להסתבך עם זה [טופס לאימייל - Php] (https://hosts.co.il/forums/showthread.php?t=1820)

Valid 18-10-05 14:05

אתם ממשיכיים להסתבך עם זה [טופס לאימייל - Php]
 
PHP קוד:

foreach ($_POST as $key => $val)
{
$text.=$key.":".$val."\n";
}
mail("myemail@myhost.net","טופס",$text); 

באמת... הכי פשוט שיש, בלי בולשיט, בלי כלום.
כל מה שהוא עושה זה שולח את כל הפרטים בטופס לאימייל.

ikkon8 18-10-05 14:33

זה רק הקוד,
יש גם שדות מילוי :p.
ברשותך, אני אוסיף שדות מילוי וארשום את הקוד המלא.
אפשר? D:

ttom1 18-10-05 14:42

ציטוט:

נכתב במקור על ידי LeadTekk
זה רק הקוד,
יש גם שדות מילוי :p.
ברשותך, אני אוסיף שדות מילוי וארשום את הקוד המלא.
אפשר? D:

זה היה מועיל יותר כי מי שלא ידע עד עכשיו את הקוד הזה אז הוא גם לא ידע איפו להכני את הקוד הזה בטופס וכו'

Espire 18-10-05 15:24

קוד:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>

<body>
<?
// keep people from accessing this page directly
if (eregi('contact.php', $_SERVER['PHP_SELF'])) {
// go to index page
header('Location: ../main.php?page=contact');
die();
}

?>
<h4>Contact Form</h4>
<?php
echo "<p>* Denotes required fields. </p>";

// put your email here
$send_to = "youremail@your.com";

// This is what is displayed in the email subject line
$subject = "Message from Your Website";

// This is displayed if all the fields are not filled in
$empty_fields_message = "<p>Please <a href='contact.php'>go back</a> and complete all the fields in the form!</p>";

// This is displayed when the email has been sent
$thankyou_message = "<p>Thankyou. Your message has been sent! =)<br /><br /><a href='index.php'><< Back to Main</a></p>";

// set up info
$nowDay=date("m.d.Y");
$nowClock=date("H:i:s");
$http_referrer = getenv( "HTTP_REFERER" );

// You do not need to edit below this line

$name = stripslashes($_POST['txtName']);
$email = stripslashes($_POST['txtEmail']);
$phone = stripslashes($_POST['txtPhone']);
$message = stripslashes($_POST['txtMessage']);

if (!isset($_POST['txtName'])) {

?>
</p>
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>" id="mailme" name="mailme">
Name: <span class="error"> *</span><br />
<input name="txtName" type="text" title="Enter your name" size="35" maxlength="20"/>
<p> Email: <span class="error"> *</span><br />
<input name="txtEmail" type="text" title="Enter your email address" size="35" maxlength="30"/>
</p>
<p> Phone:<br />
<input name="txtPhone" type="text" title="Enter your phone number" size="35" maxlength="20"/>
</p>
<p>Contact? </p>
<input name="contact" type="radio" value="yes" checked>
Yes<br />
<input name="contact" type="radio" value="no">
No
<p>How did you find us?</p>
<input name="found" type="radio" value="advertisement">Advertisement <br />
<input name="found" type="radio" value="wordofmouth">Word of Mouth <br />
<input name="found" type="radio" value="search_engine">Search Engine <br />
<input name="found" type="radio" value="web_link">Web Link <br />
<input name="found" type="radio" value="other" checked>Other<br />
<p> Message: <span class="error"> *</span> <br />
<textarea name="txtMessage" cols="50" rows="10" wrap="VIRTUAL" /></textarea></p>
<p>
<input name="Reset" type="reset" value="Clear"/>&nbsp;
<input name="submit" type="submit" value="Send"/>
</p>
</form>
<?php
}
elseif (empty($name) || empty($email) || empty($message)) {

echo @$empty_fields_message;
}
else {
// Stop the form being used from an external URL
// Get the referring URL
@$referer = $_SERVER['HTTP_REFERER'];
// Get the URL of this page
@$this_url = "http://".$_SERVER['HTTP_HOST'].$_SERVER["REQUEST_URI"];
// If the referring URL and the URL of this page don't match then
// display a message and don't send the email.
if ($referer != $this_url) {
echo "You do not have permission to use this script from another URL.";
exit;
}
@$messageproper =

// we now generate a nice form for emailing
"Message recieved: $nowDay at $nowClock:\n\n" .
"Email Sent From: $http_referrer\n\n" .
"Name: $name\n\n".
"Email: $email\n\n".
"Phone Number: $phone\n\n".
"Contact?: $contact\n\n".
"Found site By: $found\n\n".

"------------------------ COMMENTS ------------------------\n\n\n" .

$message .

"\n\n\n----------------------------------------------------------\n" ;
// The URLs matched so send the email
mail($send_to, $subject, $messageproper, "From: $name <$email>");

# Autoresponder #############################################################
// note , the . (dot) joins two strings. to end a string, use semi-colon ;
$replysubject =
"Query from Your Website" ; // send our subject header
$replymessage =
"Dear " .
$name .
"\n\nThank you for your email. \nIf you had so requested, we will get back to you as soon as possible. " .
"\n\nRegards," .
"\n Your Name Here" .

mail( "$email", "$replysubject", "$replymessage\n\n", "From:$send_to" );
// Display the thankyou message
echo $thankyou_message;

}

?>

</body>
</html>

ראיתי באיזה אתר אחד קחו

Valid 18-10-05 15:56

לא מבין אותכם... לבנות טופס ב Html זה הדבר הכי פשוט שיש... הקוד שלי פשוט שולח אותו לאימייל... זה לא משנה איזה שדות יהיו בטופס, הכל ישלח (כל מה שנשלח בpost).

ttom1 18-10-05 19:16

ציטוט:

נכתב במקור על ידי Espire
קוד:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>

<body>
<?
// keep people from accessing this page directly
if (eregi('contact.php', $_SERVER['PHP_SELF'])) {
// go to index page
header('Location: ../main.php?page=contact');
die();
}

?>
<h4>Contact Form</h4>
<?php
echo "<p>* Denotes required fields. </p>";

// put your email here
$send_to = "youremail@your.com";

// This is what is displayed in the email subject line
$subject = "Message from Your Website";

// This is displayed if all the fields are not filled in
$empty_fields_message = "<p>Please <a href='contact.php'>go back</a> and complete all the fields in the form!</p>";

// This is displayed when the email has been sent
$thankyou_message = "<p>Thankyou. Your message has been sent! =)<br /><br /><a href='index.php'><< Back to Main</a></p>";

// set up info
$nowDay=date("m.d.Y");
$nowClock=date("H:i:s");
$http_referrer = getenv( "HTTP_REFERER" );

// You do not need to edit below this line

$name = stripslashes($_POST['txtName']);
$email = stripslashes($_POST['txtEmail']);
$phone = stripslashes($_POST['txtPhone']);
$message = stripslashes($_POST['txtMessage']);

if (!isset($_POST['txtName'])) {

?>
</p>
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>" id="mailme" name="mailme">
Name: <span class="error"> *</span><br />
<input name="txtName" type="text" title="Enter your name" size="35" maxlength="20"/>
<p> Email: <span class="error"> *</span><br />
<input name="txtEmail" type="text" title="Enter your email address" size="35" maxlength="30"/>
</p>
<p> Phone:<br />
<input name="txtPhone" type="text" title="Enter your phone number" size="35" maxlength="20"/>
</p>
<p>Contact? </p>
<input name="contact" type="radio" value="yes" checked>
Yes<br />
<input name="contact" type="radio" value="no">
No
<p>How did you find us?</p>
<input name="found" type="radio" value="advertisement">Advertisement <br />
<input name="found" type="radio" value="wordofmouth">Word of Mouth <br />
<input name="found" type="radio" value="search_engine">Search Engine <br />
<input name="found" type="radio" value="web_link">Web Link <br />
<input name="found" type="radio" value="other" checked>Other<br />
<p> Message: <span class="error"> *</span> <br />
<textarea name="txtMessage" cols="50" rows="10" wrap="VIRTUAL" /></textarea></p>
<p>
<input name="Reset" type="reset" value="Clear"/>&nbsp;
<input name="submit" type="submit" value="Send"/>
</p>
</form>
<?php
}
elseif (empty($name) || empty($email) || empty($message)) {

echo @$empty_fields_message;
}
else {
// Stop the form being used from an external URL
// Get the referring URL
@$referer = $_SERVER['HTTP_REFERER'];
// Get the URL of this page
@$this_url = "http://".$_SERVER['HTTP_HOST'].$_SERVER["REQUEST_URI"];
// If the referring URL and the URL of this page don't match then
// display a message and don't send the email.
if ($referer != $this_url) {
echo "You do not have permission to use this script from another URL.";
exit;
}
@$messageproper =

// we now generate a nice form for emailing
"Message recieved: $nowDay at $nowClock:\n\n" .
"Email Sent From: $http_referrer\n\n" .
"Name: $name\n\n".
"Email: $email\n\n".
"Phone Number: $phone\n\n".
"Contact?: $contact\n\n".
"Found site By: $found\n\n".

"------------------------ COMMENTS ------------------------\n\n\n" .

$message .

"\n\n\n----------------------------------------------------------\n" ;
// The URLs matched so send the email
mail($send_to, $subject, $messageproper, "From: $name <$email>");

# Autoresponder #############################################################
// note , the . (dot) joins two strings. to end a string, use semi-colon ;
$replysubject =
"Query from Your Website" ; // send our subject header
$replymessage =
"Dear " .
$name .
"\n\nThank you for your email. \nIf you had so requested, we will get back to you as soon as possible. " .
"\n\nRegards," .
"\n Your Name Here" .

mail( "$email", "$replysubject", "$replymessage\n\n", "From:$send_to" );
// Display the thankyou message
echo $thankyou_message;

}

?>

</body>
</html>

ראיתי באיזה אתר אחד קחו

תיתחבר בבקשה לIcq


כל הזמנים הם GMT +2. הזמן כעת הוא 07:09.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ