Клубове Дир.бг
powered by diri.bg
търси в Клубове diri.bg Разширено търсене

Вход
Име
Парола

Клубове
Dir.bg
Взаимопомощ
Горещи теми
Компютри и Интернет
Контакти
Култура и изкуство
Мнения
Наука
Политика, Свят
Спорт
Техника
Градове
Религия и мистика
Фен клубове
Хоби, Развлечения
Общества
Я, архивите са живи
Клубове Дирене Регистрация Кой е тук Въпроси Списък Купувам / Продавам 04:54 25.04.24 
Компютри и Интернет
   >> PHP
Всички теми Следваща тема *Кратък преглед

Тема Формуляр за обратна връзка  
Автор Cont (непознат)
Публикувано26.04.12 12:44



Здравейте!

Реших да си направя собствен сайт в който да сложа формуляр за обратна връзка.Попаднах на един,но не зная какви промени трябва да му се направят така че като го кача на сайта си и се попълни от читателя,информацията да пристига на моят mail.

Ето и кодът на формулярът:

!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body><body onload="setTimeout('aaa()',dt)" bgcolor="#000033" text="#000033" link="#DD0000" vlink="#DD0000" alink="#DD0000" leftmargin="3" topmargin="3" marginwidth="3" marginheight="3">
<center>

<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td valign="top"><table border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
<td valign="top"><!--img src="space.gif" width="1" height="18" border="0"><br />

<TABLE BGCOLOR="#FF0000" BORDER="0" CELLPADDING="0" CELLSPACING="2">
<TR><TD><A onMouseOver="setImg('ifree','bfreeov')" onMouseOut="setImg('ifree','bfree')" HREF="index.php?p=free"><IMG NAME="ifree" SRC="menu/free.gif" WIDTH="100" HEIGHT="24" BORDER="0"></A></TD></TR>
</TABLE>
<TABLE style="border:2px solid #FF0000" width="104" BORDER="0" CELLPADDING="1" CELLSPACING="0">
<TR><TD align="center"><span class="small"><a style="text-decoration:none;color:#FFFFFF;" href="index.php?p=free">Click here to view our <B>free section</B>. Each issue we add an article or two free of charge.</a></span></TD></TR>
</TABLE-->
<img src="space.gif" width="1" height="12" border="0">





<img src="space.gif" width="1" height="12" border="0">

<span class="normalw"></span> </td><td valign="top"></td>
<td valign="top" bgcolor="#FFFFFF"><img src="space.gif" width="4" height="1" border="0"></td>
<td valign="top" bgcolor="#FFFFFF" width="540"><span class="normal">

<h2></h2>


<form id="contactform" action="index.php?p=comments" enctype="multipart/form-data" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="5000000">
<table align="center" border="0" cellpadding="2" cellspacing="0" style="font-size:11px;"><tbody><tr><td align="right" valign="top"><b>Name</b></td><td><input style="width:400px;" type="text" name="name" value="">
<span style="color:#FF8040"></span></td></tr><tr><td align="right" valign="top"><b>E-mail</b></td><td><input style="width:400px;" type="text" name="email" value="">
<span style="color:#FF8040"></span></td></tr><tr><td align="right" valign="top">Message</td><td><textarea style="width:400px;" name="message" rows="6" cols="33"></textarea></td></tr><tr>
<td align="right" valign="top"></td>
<td>

<span style="color:#FF8040"></span></td></tr>
<tr><td></td><td><input type="submit" value="Send"><input type="hidden" name="submit" value="1"></td></tr>
</tbody></table>
</form>
</span></td>
<td valign="top" bgcolor="#FFFFFF"><img src="space.gif" width="3" height="1" border="0"></td>
<td valign="top"><img src="space.gif" width="6" height="1" border="0"></td>
<td valign="top"></td>
</tr>
</tbody></table>


</td>
<td valign="top"></td><td valign="top">
<img src="space.gif" width="1" height="8" border="0">



</td></tr></tbody></table>

</center>


</body>
</body>
</html>



Тема Re: Формуляр за обратна връзканови [re: Cont]  
Автор croesus (хлевоуст)
Публикувано26.04.12 12:59



Няма да стане само с формуляра. Трябва ти код на сървъра, който да прихваща попълнените данни и да праща мейл.



Тема Re: Формуляр за обратна връзканови [re: croesus]  
Автор Cont (непознат)
Публикувано26.04.12 13:31



Този код няма ли да ми го дадат от сървъра на който си качвам сайта.



Тема Re: Формуляр за обратна връзканови [re: Cont]  
Автор croesus (хлевоуст)
Публикувано26.04.12 18:06



Не, трябва да си го напишеш сам.



Тема Re: Формуляр за обратна връзканови [re: croesus]  
Автор Cont (непознат)
Публикувано27.04.12 10:41



Ясно,значи ще трябва да мина без този формуляр.



Тема Re: Формуляр за обратна връзканови [re: Cont]  
Автор WMC (Прах във вятъра)
Публикувано28.04.12 19:56



Леле... Кажи ми баже как да реша биквадратно уравнение, но да знайШ, че сега уча таблицата за умножение?!!!



Нещо такова ти е "въпроса", незная дали се усещаш. За имейли ти е нужно: PHP, SQL, SMTP и 1-2 години четене на спецификации.

Или да си платиш на специалист - според това точно какъв имел ти е нужно да получиш цената е от 50 лв. до 450 лв.



Тема Re: Формуляр за обратна връзканови [re: Cont]  
Автор KiberZlo (хак-холик)
Публикувано30.04.12 04:18



Предполагам че се опитваш да си направиш нещо от така наречените "безплатни сайтове". Както и да е де, във всички случаи за тебе ще е най добре да се регистрираш в някой сайт за безплатни форми. Вземаш си кода и го слагаш в сайта си, без да се занимаваш с разни програмни кодове и глупости, от които нямаш нужда.

Ето един такъв сайт





Тема До KiberZloнови [re: KiberZlo]  
Автор Cont (непознат)
Публикувано02.05.12 17:12



Прав си. Благодаря за линка.



Тема Re: До KiberZloнови [re: Cont]  
Автор sashometallico (непознат)
Публикувано26.05.12 02:38



Преди време писах е това. Виж дали ти върши работа.

Цялата философия да го подкараш е да заместиш mail@example.com с твоя мейл, после да го запишеш като файл с разширение .php и накрая да го качиш.

В отговор на:


<?php
class metallico {
//set form recipent here:
public $to = 'mail@example.com';


public $name, $tel, $ml, $message, $output, $error, $errormsg, $jsemail;


//check mail function
function checkEmail($email){
return ( eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email) );
}



//hide email function:
function hide_email($email) {
$character_set = '+-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz';
$key = str_shuffle($character_set);
$cipher_text = '';
$id = 'e'.rand(1,999999999);
for ($i=0;$i<strlen($email);$i+=1)
$cipher_text.= $key[strpos($character_set,$email[$i])];
$script = 'var a="'.$key.'";var b=a.split("").sort().join("");var c="'.$cipher_text.'";var d="";';
$script.= 'for(var e=0;e<c.length;e++)d+=b.charAt(a.indexOf(c.charAt(e)));';
$script.= 'document.getElementById("'.$id.'").innerHTML="<a href=\\"mailto:"+d+"\\">"+d+"</a>"';
$script = "eval(\"".str_replace(array("\\",'"'),array("\\\\",'\"'), $script)."\")";
$script = '<script type="text/javascript">/*<![CDATA[*/'.$script.'/*]]>*/</script>';
return '<span id="'.$id.'">[javascript protected email address]</span>'.$script;
}




function validpost($post) {
//check agains each of the posted values


if ( isset($post['name']) ? ( $post['name'] != '' ) && ( strlen($post['name']) > 2 ) : false ) { $this->name = addslashes($post['name']); } else { $this->error[] = 1; };
if ( isset($post['tel']) ? ( $post['tel'] != '' ) && ( strlen($post['tel']) > 2 ) : false ) { $this->tel = addslashes($post['tel']); } else { $this->error[] = 2; };
if ( isset($post['ml']) ? ( $post['ml'] != '' ) && ( strlen($post['ml']) > 2 ) && ($this->checkEmail($post['ml'])) : false ) { $this->ml = addslashes($post['ml']); } else { $this->error[] = 3; };

(isset($post['message']) && $post['message'] != '' ) ? $this->message = addslashes($post['message']) : $this->error[] = 4;

//debug:
//echo 'This function has set $post[\'message\'] as ' . $post['message'] . ' then it has $this->error[] as: <br /> ';
//print_r($this->error);
//echo '<br /> then it has $this->message as ' . $this->message;
//exit();
return ( !isset($this->error) );
}

function displayform() {
$this->output = '
<div id="contactformouter">
<form action="'. $_SERVER["SCRIPT_NAME"] .'" method="POST">
<table>
<tr>
<td><label for="name">Your Name: <span class="required">*</span></label></td>
<td><input type="text" name="name" id="name" class="forminput" /></td>
</tr>

<tr>
<td><label for="tel">Your Tel:</label></td>
<td><input type="text" name="tel" id="tel" class="forminput" /></td>
</tr>

<tr>
<td><label for="ml">Your Email: <span class="required">*</span></label></td>
<td><input type="text" name="ml" id="ml" class="forminput" /></td>
</tr>

<tr>
<td><label for="message">Message: <span class="required">*</span></label></td>
<td>
<textarea rows="10" cols="30" name="message" id="message"></textarea>
</td>
</tr>



<tr>
<td colspan="2" align="right">
<!--<input type="reset" onclick="return confirm(\'Are you sure you wish to reset?\')" />-->
<input type="submit" name="submit" value="Send" class="formbutton" />
</td>
</tr>
</table>
</form>
</div>
';
echo $this->output;
}

function displayerror() {
$this->errormsg = '<div class="problems"><p class="error">Problems were found with the information you entered:</p>';

//set the error message:
(in_array(1, $this->error)) ? $this->errormsg .= '<p class="errordetail">Please enter your name (it must be at least 3 letters).</p>' : false;
(in_array(2, $this->error)) ? $this->errormsg .= '<p class="errordetail">Please enter your telephone number.</p>' : false;
(in_array(3, $this->error)) ? $this->errormsg .= '<p class="errordetail">You have entered an invalid email address. Please enter your email again.</p>' : false;
(in_array(4, $this->error)) ? $this->errormsg .= '<p class="errordetail">You have not entered a message.</p>' : false;

$this->errormsg .= '<p>Please fix the errors above in the form below, or just send us an email on ' . $this->jsemail . ' </p></div>';

$this->output = '
<div id="contactformouter">';
$this->output .= $this->errormsg;
$this->output .= '<form action="'. $_SERVER["SCRIPT_NAME"] .'" method="POST">
<table>
<tr>
<td><label for="name">Your Name: <span class="required">*</span></label></td>
<td><input type="text" name="name" id="name" class="forminput'; (in_array(1, $this->error)) ? $this->output .= ' red"' : $this->output .= '" value="' . $this->name . '"'; $this->output .= ' /></td>
</tr>

<tr>
<td><label for="tel">Your Tel:</label></td>
<td><input type="text" name="tel" id="tel" class="forminput'; (in_array(2, $this->error)) ? $this->output .= ' red"' : $this->output .= '" value="' . $this->tel . '"'; $this->output .= ' /></td>
</tr>

<tr>
<td><label for="ml">Your Email:</label> <span class="required">*</span></td>
<td><input type="text" name="ml" id="ml" class="forminput'; (in_array(3, $this->error)) ? $this->output .= ' red"' : $this->output .= '" value="' . $this->ml . '"'; $this->output .= ' /></td>
</tr>

<tr>
<td><label for="message">Message: <span class="required">*</span></label></td>
<td>
<textarea name="message" id="message" class="formselect'; (in_array(4, $this->error)) ? $this->output .= ' red"' : false; $this->output .= '" cols="30" rows="10"></textarea>
</td>
</tr>
<tr>
<td colspan="2" style="text-align: right;">
<!--<input type="reset" onclick="return confirm(\'Are you sure you wish to reset?\')" />-->
<input type="submit" name="submit" value="Send" class="formbutton" />
</td>
</tr>
</table>
</form>
</div>
';
echo $this->output;

}

function processmail() {
//create the variables for the email:
$subject = 'New enquiry from your website';

//headers:
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain; charset=ISO-8859-1\n";
$headers .= "X-Priority: 3\n";
$headers .= "X-MSMail-Priority: Normal\n";
$headers .= "X-Mailer: php\n";
$headers .= "From: \"".$this->name."\" <".$this->ml.">\n";
$headers .= "Auto-Submitted: auto-generated\n";

//msg:
$msg = "A visitor of your website has just filled in the form. The details are shown below: \n\n";
$msg .= "Name: $this->name \n";
$msg .= "Telephone: $this->tel \n";
$msg .= "Email: $this->ml \n";
$msg .= "Message: $this->message \n";


$msg .= "Metallico Web Mail script, free to use (GNU/GPL).
";

//echo $msg;

//attempt to send the email:
(mail($this->to, $subject, $msg, $headers)) ? $this->output = 'Thank you for your message. We will respond shortly.' : $this->output = 'Your request could not be sent (reason: The PHP mail() function has failed to process the email). Please email us manually at ' . $this->jsemail;

//display result:
echo $this->output;

}


//the init function to be called when the class instance is created:
function __construct() {
$this->jsemail = $this->hide_email($this->to);

if ( isset($_POST["submit"]) ) {

($this->validpost($_POST)) ? $this->processmail() : $this->displayerror();
}
else {
//then display the form:
$this->displayform();
}
}

}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Metallico Form</title>
<!--<link rel="stylesheet" type="text/css" href="style.css" /> -->
</head>
<body>
<?php $classmet = new metallico(); ?>
</body>
</html>




Just trying to help..


Всички темиСледваща тема*Кратък преглед
Клуб :  


Clubs.dir.bg е форум за дискусии. Dir.bg не носи отговорност за съдържанието и достоверността на публикуваните в дискусиите материали.

Никаква част от съдържанието на тази страница не може да бъде репродуцирана, записвана или предавана под каквато и да е форма или по какъвто и да е повод без писменото съгласие на Dir.bg
За Забележки, коментари и предложения ползвайте формата за Обратна връзка | Мобилна версия | Потребителско споразумение
© 2006-2024 Dir.bg Всички права запазени.