:-: ADDON CONTACT :-:
par Gyzmo
Bonjour,
Cet addon est un script de "CONTACT" minimaliste.
Le script vérifie si les champs obligatoires sont renseignés. Et si l'adresse email contient bien le "@" et le "."
Si vous apportez des améliortions à ce script n'hésitez pas à poster votre script modifié.
En premier lieu créez les quatre fichiers PHP suivant.
Créez le fichier contact.php et coller le code suivant :
<?php
/*************************
Cobbled together by Billy Bullock
Tested on Coppermine 1.4.4
Reference link for code = "http://www.ibdhost.com/contact/"
lil moded by PYAP
**************************/
define('IN_COPPERMINE', true);
require('include/init.inc.php');
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
pageheader('Contactez PYAP');
// start first table content
starttable("800", 'Contactez PYAP', 1);
?>
<tr>
<td class="tableb" valign="top" align="left">
Merci de contacter <b>PYAP</b> via cette modeste Galerie de photos.
<br><center>ICI CE QUE VOUS VOULEZ</center>
</td>
</tr>
<?php
endtable();
// end first table content
// start comment feedback content
starttable("800", 'Formulaire Contact Info', 1);
?>
<tr>
<td class="tableb" valign="top" align="left">
* Tous les champs sont requis.
</td>
</tr>
<tr>
<td class="tableb" valign="top" align="center">
<form method="post" action="sendmail.php">
<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
* Votre Nom : <br />
<input type="text" name="visitor" size="35" />
<br />
* Votre Email :<br />
<input type="text" name="visitormail" size="35" />
<br />
Sujet :<br />
<input type="text" name="subject" size="35" />
<br /> <br />
<br />
* Votre Message :
<br />
<textarea name="notes" rows="8" cols="60"></textarea>
<br />
<input type="submit" value="! Go Post ! Go !" />
<br />
</form>
</td>
</tr>
<?php
endtable();
// end comment feedback content
pagefooter();
ob_end_flush();
?>
Créez le fichier contacterror.php et coller le code suivant :
<?php
// lil moded by PYAP
define('IN_COPPERMINE', true);
require('include/init.inc.php');
pageheader('Contact');
// start page content
starttable("800", '<b><font color="red">E R R E U R</font>', 1);
?>
<tr>
<td class="tableb" valign="top" align="center"><b><font color="red">E R R E U R</b><br>
Vous oubliez certains champs obligatoires !<br />
Faites la correction en cliquant le bouton <b>BACK</b> de votre navigateur.<br />
Merci.<br /><br />
<i>Please fill in all required fields.<br /><br />
Press the <b>BACK</b> button in your browser and try again.<br /><br />
Thank you.</i></font><br />
<br><center><!-- <img src="http://www.votre-site.com/img.jpg">--></center>
</td>
</tr>
<?php
endtable();
// end page content
pagefooter();
ob_end_flush();
?>
Créez le fichier sendmail.php et coller le code suivant :
<?php
/*************************
Cobbled together by Billy Bullock
Tested on Coppermine 1.4.4
Reference link for code = "http://www.ibdhost.com/contact/"
lil moded by PYAP
**************************/
$visitor = $_REQUEST['visitor'] ;
$visitormail = $_REQUEST['visitormail'] ;
$subject = $_REQUEST['subject'] ;
$notes = $_REQUEST['notes'] ;
// Modifiez ces adresses
// change address to your root CPG gallery below 4 times
if (!isset($_REQUEST['visitormail'])) {
header( "Location: http://www.votre-site.com/contact.php" );
}
elseif(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,"."))) {
header( "Location: http://www.votre-site.com/contacterror.php" );
}
elseif (empty($visitor) || empty($visitormail) || empty($notes)) {
header( "Location: http://www.votre-site.com/contacterror.php" );
}
else {
$todayis = date("l, F j, Y, g:i a") ;
$notes = stripcslashes($notes);
$message = " $todayis [EST] \n
Poste par : $visitor ($visitormail)\n
Sujet : $subject \n
Message : $notes \n
Autre Info : IP = $ip \n
Navigateur Info : $httpagent \n
Depuis la Page : $httpref \n
";
$from = "Par : $visitormail\r\n";
// Indiquez votre adresse email / change to your email
mail("VOUS-MÊME@votre-site.com", $subject, $message, $from);
header( "Location: http://www.votre-site.com/thankyou.php" );
}
?>
Créez le fichier thankyou.php et coller le code suivant :
<?php
// lil moded by PYAP
define('IN_COPPERMINE', true);
require('include/init.inc.php');
pageheader('Contact');
// your actual page content starts here
starttable("800", 'Merci and Thanks', 1);
?>
<tr>
<td class="tableb" valign="top" align="center">
Nous vous remercions pour votre email :-) <br />
<i>Thank you for your email.</i>
<br><center><!-- <img src="http://www.VOTRE-CPG/IMG.JPG">--></center>
</td>
</tr>
<?php
endtable();
// your actual page content ends here
pagefooter();
ob_end_flush();
?>
Comment installé cet addon ?
1 : / Ouvrez le fichier SENDMAIL.PHP et renseignez les adresses des scripts correctement.
ainsi que l'adresse email vers laquelle vous voulez expédier ce contact.
2 : / Téléchargez CONTACT.PHP, SENDMAIL.PHP, CONTACTERROR.PHP et THANKYOU.PHP à la racine de votre Coppermine.
3 : / Ajoutez un lien (txt ou bouton) vers "votre-cpg/contact.php" où bon vous semble sur votre Thème.
4 : / Modifiez selon vos désirs...
Deux liens pour vous aider à installer un nouveau bouton :
Ajouter un lien : http://forum.coppermine-gallery.net/index.php?topic=24107.0
Ajouter de nouvelles pages : http://forum.coppermine-gallery.net/index.php?topic=21000.0
PYAP