Google+

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tutorial Pagina de contact
#1
Creati un fiser html cu denumirea "contact". In acest fiser intruduce-ti urmatoarele:

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<form method="POST" action="/contact/mail.php">
	<div align="center">
		<font size="2" color="red" face="Verdana, Arial, Helvetica, sans-serif"><strong>Va rugam sa completati toate campurile !</strong></font><br /><br /><br />
		<font size="2" face="Verdana, Arial, Helvetica, sans-serif">
			Adresa dvs. de e-mail <font color="#FF0000"><i>(obligatoriu)</i></font>:<br />
			<input type="text" name="Email" size="42"><br /><br />
			Subiect / Titlul mesajului:<br />
			<input type="text" name="Subiect" size="42"><br /><br />
			Numele:<br />
			<input type="text" name="Numele" size="42"><br /><br />
		
		</font>
		<font size="2" face="Verdana, Arial, Helvetica, sans-serif">
			Mesajul dumneavoastra:<br />
			<textarea name="Comentarii" rows="6" cols="50"></textarea><br /><br />
			<br />
			<input type="submit" name="submit" value="Trimite">
		</font>
	</div>
</form>

Apoi creatu un alt fisier php si denumitil mail.php .In acest fisier introduceti urmatoarele:

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
$Email = Trim(stripslashes($_POST['Email']));
// Inlocuieste adresa de email de mai jos, cu adresa ta de email la care vrei sa primesti mesajele.
$EmailTo = "mail@yahoo.com";
$Subiect = Trim(stripslashes($_POST['Subiect']));
$Numele = Trim(stripslashes($_POST['Numele']));
$Adresa = Trim(stripslashes($_POST['Adresa']));
$Telefon = Trim(stripslashes($_POST['Telefon']));
$Comentarii = Trim(stripslashes($_POST['Comentarii'])); 

$validationOK=true;
if (Trim($Email)=="") $validationOK=false;
if (!$validationOK) {
  print "	<meta http-equiv=\"refresh\" content=\"3;URL=/contact/contact.html\">
			<div align=\"center\">
				<font size=\"6\" color=\"#FF0000\" face=\"Verdana, Arial, Helvetica, sans-serif\"><strong>Eroare!</strong></font><br /><br />
				<font size=\"6\" color=\"#FF0000\" face=\"Verdana, Arial, Helvetica, sans-serif\"><strong>(adresa e-mail incorecta)</strong></font><br /><br />
				<font size=\"6\" color=\"#FF0000\" face=\"Verdana, Arial, Helvetica, sans-serif\"><strong><a href=\"/contact/contact.html\">Reîncercati!</a></strong></font><br /><br />
			</div>
  ";
  exit;
}

$Body = "";
$Body .= "Numele: ";
$Body .= $Numele;
$Body .= "\n";
$Body .= "Adresa: ";
$Body .= $Adresa;
$Body .= "\n";
$Body .= "Telefon: ";
$Body .= $Telefon;
$Body .= "\n";
$Body .= "Comentarii: ";
$Body .= $Comentarii;
$Body .= "\n";

$success = mail($EmailTo, $Subiect, $Body, "From: <$Email>");

if ($success){
  print "	<meta http-equiv=\"refresh\" content=\"3;URL=/index.php\">
			<div align=\"center\"><br /><br /><br /><br />
				<font size=\"6\" color=\"#666666\" face=\"Verdana, Arial, Helvetica, sans-serif\"><strong>Mesajul a fost trimis !</strong></font><br /><br />
				<font size=\"6\" color=\"red\" face=\"Verdana, Arial, Helvetica, sans-serif\"><strong>Va multumim !<br>Veti fi redirectionat catre pagina principala</strong></font><br /><br />
			</div>
  ";
}
else{
  print "	<meta http-equiv=\"refresh\" content=\"3;URL=/index.php\">
			<div align=\"center\">
				<font size=\"6\" color=\"#FF0000\" face=\"Verdana, Arial, Helvetica, sans-serif\"><strong>Eroare!</strong></font><br /><br />
				<font size=\"6\" color=\"#FF0000\" face=\"Verdana, Arial, Helvetica, sans-serif\"><strong>(adresa e-mail incorecta)</strong></font><br /><br />
				<font size=\"6\" color=\"#FF0000\" face=\"Verdana, Arial, Helvetica, sans-serif\"><strong><a href=\"/contact/contact.html\">Reîncercati!</a></strong></font><br /><br />
			</div>
  ";
}
?>

Introduceti ambele fisiere intr-un director si denumitil "contact" (fara ghilimele), si incaractil in public_html.
Ca sa accesati pagina de contact folositi urmatoarea legatura:
www.siteultau.ro/contact/contact.html
Pentru a face o legatura directa in meniul din site-ul vostru, intrati in cp admin,templates/tema voastra/Header Templates/header si in meniul de acolo mai adaugati o linie pentru pagina de contact. Uita-ti si un exemplu:

PHP Code:
<li><a href="{$mybb->settings['bburl']}/contact/contact.html">Contact</a></li>

Am setat scripul in asa fel incat dupa 3 secunde de la trimiterea mesajului sa fiti redirectionati catre pagina index.php

Pentru a mentine un forum unitar si pentru a utiliza informatia intr-un numar cat mai mic de subiecte, va rugam ca inainte de a deschide o Discutie Noua sa folositi functia Cautare (Search) !
Cititi periodic
Regulamentul
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)