Script Contact.php

Discutii despre tot ce nu se incadreaza in celelalte categorii.

Moderators: Moderatori ajutatori, Moderatori

Post Reply
EarthMuziq
Utilizator banat
Utilizator banat
Posts: 238
Joined: 22 Aug 2008, 04:12
Detinator Steam: Nu

08 Nov 2008, 22:44

Bună seara am mare nevoie pentru la forumul meu care este prin CMSul phpbb3 de o pagină contact.php mă poate ajuta cineva ?
RoyalServer 2
User avatar
Marius
Fost moderator
Fost moderator
Posts: 8294
Joined: 11 Nov 2007, 12:19
Detinator Steam: Da
CS Status: being awesome since 1992
SteamID: kNNwOw
Reputatie: eXtream Mod
Fost administrator
Fost dezvoltator al listei de seriozitate eXtreamCS
Fost Membru Club eXtreamCS
Location: Timisoara
Has thanked: 577 times
Been thanked: 680 times

08 Nov 2008, 23:19

Uite o sintaxa facuta acum rapid...

Faci un fisier index.php in care adaugi:

Code: Select all

<html>
<head>
<title>Formular de contact</title>
</head>
<body>
<form action="trimite.php" method="post">

E-Mail:  <input type="text" name="email" value=""> <br>
Nume:    <input type="text" name="nume" value=""> <br>
Prenume: <input type="text" name="prenume" value=""> <br>
Subiect: <input type="text" name="subiect" value=""> <br>
Mesaj:   <textarea name="mesaj" cols="60" rows="6"></textarea> <br><br>

<input type="submit" name="Trimite" value="Trimite">
<input type="reset" name="Reseteaza" value="Reseteaza">

</form>
</body>
</html>
Apoi unul trimite.php

Code: Select all

<?php
  
if(($_POST['email'] == '') || ($_POST['nume'] == '') || (is_numeric($_POST['nume'])) || ($_POST['prenume'] == '') || (is_numeric($_POST['prenume'])) || ($_POST['subiect'] == '') || ($_POST['mesaj'] == '')) {
echo 'Completati campurile corect <br>
      Apasati <a href="index.php">aici</a> pentru a va intoarce la pagina principala.'; 
} else {

$catre = '[email protected]';  // schimbati adresa de email
$data_trimitere = date('d-m-Y H:i:s');

$subiect = $_POST['subiect'];

$mesaj = '
<html>
<head>
<title>Formular de Contact</title>
</head>
<body>
<p><tt>Data trimitere: '.$data_trimitere.' </tt></p>
<table>
<tr>
<td><tt> Nume: '.$_POST['nume'].' </tt></td>
</tr>
<tr>
<td><tt> Prenume: '.$_POST['prenume'].' </tt></td>
</tr>
<tr>
<td><tt> E-Mail: <a href="mailto:'.$_POST['email'].'">'.$_POST['email'].'</a> </tt></td>
</tr>
<tr>
<td><tt> Mesaj: <br><br> '.$_POST['mesaj'].' </tt></td>
</tr>
</table>
</body>
</html>';

$headere  = "MIME-Version: 1.0\r\n";
$headere .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headere .= "From: ".$_POST['nume']." ".$_POST['prenume']."<".$_POST['email'].">\r\n";

mail($catre, $subiect, $mesaj, $headere);

echo 'Mesajul a fost trimis';

}

?>
Atat ! :)
------> un mindset sanatos pentru eXtream <------
PS: NU sunt intermediar
EarthMuziq
Utilizator banat
Utilizator banat
Posts: 238
Joined: 22 Aug 2008, 04:12
Detinator Steam: Nu

09 Nov 2008, 10:34

Mulţumesc Maryus pentru ajutor,rog un moderator să închidă acest topic.
User avatar
MCosti
Fost moderator
Fost moderator
Posts: 2251
Joined: 28 Sep 2008, 06:58
Detinator Steam: Da
Reputatie: Membru Club eXtreamCS (2 luni)
Fost moderator
Nume anterior: DjMax
Has thanked: 139 times
Been thanked: 60 times
Contact:

09 Nov 2008, 10:51

|Maryus,index.php-ul unde il pun ca forumul are deja 1
EDIT:Am facut singur :D
User avatar
Marius
Fost moderator
Fost moderator
Posts: 8294
Joined: 11 Nov 2007, 12:19
Detinator Steam: Da
CS Status: being awesome since 1992
SteamID: kNNwOw
Reputatie: eXtream Mod
Fost administrator
Fost dezvoltator al listei de seriozitate eXtreamCS
Fost Membru Club eXtreamCS
Location: Timisoara
Has thanked: 577 times
Been thanked: 680 times

09 Nov 2008, 10:55

DjMax wrote:|Maryus,index.php-ul unde il pun ca forumul are deja 1
EDIT:Am facut singur :D
Poti sa ii schimbi numele in contact.php....sau faci un folder nou numit /contact/ si pui alea doua...
------> un mindset sanatos pentru eXtream <------
PS: NU sunt intermediar
User avatar
MCosti
Fost moderator
Fost moderator
Posts: 2251
Joined: 28 Sep 2008, 06:58
Detinator Steam: Da
Reputatie: Membru Club eXtreamCS (2 luni)
Fost moderator
Nume anterior: DjMax
Has thanked: 139 times
Been thanked: 60 times
Contact:

09 Nov 2008, 10:56

Apropo,exista si un Contsct.php care sa aiba putin deisgn?
Daca nu incerc sa fac eu
Problema e ca emailurile ajung in spam dar acesta functioneaza ;)
User avatar
MCosti
Fost moderator
Fost moderator
Posts: 2251
Joined: 28 Sep 2008, 06:58
Detinator Steam: Da
Reputatie: Membru Club eXtreamCS (2 luni)
Fost moderator
Nume anterior: DjMax
Has thanked: 139 times
Been thanked: 60 times
Contact:

09 Nov 2008, 11:39

Scuze de dublu post
Uite scriptul meu(sper sa nu se considere reclama)
Deci faci un folder "contact"
In acest folder creezi un fisier numit contact.php si adaugi textul

Code: Select all

<? 
$name     = $_POST['name'];
$email    = $_POST['email'];
$comments = $_POST['comments'];
$error_msg = "";
$msg = "";

if($name){
	$msg .= "Nume: \t $name \n";
}

if(!$email){
	$error_msg .= "Email: \n";
}
if($email){
	if(!eregi("^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\._\-]+\.[a-zA-Z]{2,4}", $email)){
		echo "\n<br>Aceasta nu este o adresa valabila.Va rugam incercati din nou.\n<br>";
		exit;
	}			
	$msg .= "Email: \t $email \n";
}

if($comments){
	$msg .= "Comentarii \t $comments \n";
}
$sender_email="";

if(!isset($name)){
	if($name == ""){
		$sender_name="Contact form";
	}
}else{
	$sender_name=$name;
}
if(!isset($email)){
	if($email == ""){
		$sender_email="[email protected]";
	}
}else{
	$sender_email=$email;
}
if($error_msg != ""){
	echo "Nu ai completat toate casutele<br>"
	.nl2br($error_msg) .'<br>Va rugam incercati din nou!';
	exit;
}
$mailheaders  = "MIME-Version: 1.0\r\n";
$mailheaders .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$mailheaders .= "From: $sender_name <$sender_email>\r\n";
$mailheaders .= "Reply-To: $sender_email <$sender_email>\r\n";
mail("[email protected]","Te-a contactat cineva de pe site-ul tau",stripslashes($msg), $mailheaders);
header("Location: http://www.configuredgames.info/contact/thankyou.html");
?>
Mai avem de creat un fisier index.html

Code: Select all

<STYLE type=text/css> 
<!--
a:link{
	color:#FF0000;
	text-decoration: none;
}
a:visited{
	color:BF00FF;
	text-decoration: none;
}
a:hover{
	color:#0000FF;
	text-decoration: none;
}
body {
	background-color: #3e4637;
	color: #FFFF00;
}
--> 
</style> 

<html>
<head>
<title>Contactati-ne!</title>
</head>

<body>
<form method=post action="contact.php">
<table border="0" cellspacing="0" cellpadding="5">
<tr>
<td>Nume:</td>
<td> <input type="text" name="name"></td>
</tr>
<tr>
<td>Email:</td>
<td> <input type="text" name="email"></td>
</tr>
<tr>
<td valign="top">Comentarii</td>
<td><textarea name="comments" rows="10" cols="34"></textarea></td>
</tr>
<td><input type="submit" name="Submit" value="Submit"></td>
<td><input type="reset" name="reset" value="reset"></td></tr></table>
</form>
<img src="http://configuredgames.info/forum/styles/X-Treme%20Red/imageset/site_logo.png" alt="ConfiguredGames"/>

</body>

</html>
Si un fisier thankyou.html

Code: Select all

<STYLE type=text/css> 
<!--
a:link{
	color:#FF0000;
	text-decoration: none;
}
a:visited{
	color:BF00FF;
	text-decoration: none;
}
a:hover{
	color:#0000FF;
	text-decoration: none;
}
body {
	background-color: #3e4637;
	color: #FFFF00;
}
--> 
</style> 

<html>
<head>
<title>Va multumim</title>
</head>

<body>
Va multumim ca ne-ati contactat!<br>
<br>
Vom face si noi acelasi lucru cat de curand!
</body>

</html>
Iti schimbi tu toate detaliile(apropo,vezi ca e pus un banner de al meu,il scoti tu ;) ,te descurci sa editezi ;) )
User avatar
Marius
Fost moderator
Fost moderator
Posts: 8294
Joined: 11 Nov 2007, 12:19
Detinator Steam: Da
CS Status: being awesome since 1992
SteamID: kNNwOw
Reputatie: eXtream Mod
Fost administrator
Fost dezvoltator al listei de seriozitate eXtreamCS
Fost Membru Club eXtreamCS
Location: Timisoara
Has thanked: 577 times
Been thanked: 680 times

09 Nov 2008, 11:53

Uite unul si mai simplu....e doar o pagina
contact.php

Code: Select all

<?php
if (isset($_REQUEST['email']))
  {
  $email = $_REQUEST['email'] ; 
  $subiect = $_REQUEST['subiect'] ;
  $mesaj = $_REQUEST['mesaj'] ;
  mail( "[email protected]", "Subject: $subiect",
  $mesaj, "From: $email" );
  echo "Va multumim !";
  }
else
  {
  echo "<form method='post' action='contact.php'>
  Email: <input name='email' type='text' /><br />
  Subiect: <input name='subiect' type='text' /><br />
  Mesaj:<br />
  <textarea name='mesaj' rows='15' cols='40'>
  </textarea><br />
  <input type='submit' />
  </form>";
  }
?> 
------> un mindset sanatos pentru eXtream <------
PS: NU sunt intermediar
Post Reply

Return to “Discutii generale”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 393 guests