Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Add sender name -email and message to "Send email of favorites" code  (Read 25065 times)

0 Members and 1 Guest are viewing this topic.

spa2036

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 16

I have been looking for a solution to send picture names in an email.
Thanks to this forum I have found the code from Abbas Ali ("Send favorites as e-mail").

Is it possible to have a visitor enter their credentials in three input fields for name, email and message?
I have tried to use a part of the ecard.php but do not get it to work.
Who knows how to get this coded in the present code "Send favorites as e-mail"?
http://forum.coppermine-gallery.net/index.php?topic=22719.0 is the link to the code of Abbas Ali where I would like to have the input fields added.

Thanks, Rob
« Last Edit: March 07, 2006, 08:28:29 pm by spa2036 »
Logged
Thanks for sharing this wonderful program

spa2036

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 16
Re: Add sender name -email and message to "Send email of favorites" code
« Reply #1 on: March 08, 2006, 10:00:10 pm »

I have tried to code something, but looks horrible.

Take a look at the code that runs when I hit the "send to email" button:

Code: [Select]
<form action="placeorder.php" method="post">

<?php
$ipi 
getenv("REMOTE_ADDR");
$httprefi getenv ("HTTP_REFERER");
$httpagenti getenv ("HTTP_USER_AGENT");
?>

<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 ?>" />
<h2 align="center">Bestellijst</h2>

<p align="center">
Naam: <input type="text" name="sender_name" size="40" /></br>
E-mail: <input type="text" name="sender_mail" size="40" />

<br />
<h3 align="center">Opmerkingen (optioneel)</h3>
<p align="center">
<textarea name="sender_mssg" rows="6" cols="30">Geen</textarea>
</p>
<hr />
<p align="center">
<input type="submit" value="Plaats bestellijst" />
</p>

</form>

The next code is used to place the order:

Code: [Select]
<?php

define
('IN_COPPERMINE'true);
define('THUMBNAILS_PHP'true);
define('INDEX_PHP'true);
require(
'include/init.inc.php');
require(
'include/mailer.inc.php');
$user_name trim(stripslashes($_POST['sender_name']));
$user_mail trim(stripslashes($_POST['sender_mail']));
$user_mssg trim(stripslashes($_POST['sender_mssg']));

if (
count($FAVPICS)>0) {
        
$message "Er is een order geplaatst door $user_name met emailadres: $user_mail.<br><br>Opmerking:<br>$user_mssg<br><br>Details worden hieronder weergegeven.<br><br>";
        
        
$favs implode(",",$FAVPICS);

        
$select_columns "filename,{$CONFIG['TABLE_PICTURES']}.title as pic_title,pid,{$CONFIG['TABLE_ALBUMS']}.title as alb_title";

        
$result db_query("SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']},{$CONFIG['TABLE_ALBUMS']} WHERE approved = 'YES'AND pid IN ($favs) AND {$CONFIG['TABLE_ALBUMS']}.aid = {$CONFIG['TABLE_PICTURES']}.aid");
        
$rowset db_fetch_rowset($result);
        foreach (
$rowset as $key => $row){

                
$message .= $rowset[$key]['pic_title']." (pid ".$rowset[$key]['pid'].") uit ".$rowset[$key]['alb_title']." album met fotonummer ".$rowset[$key]['filename']."<br>";

        }
        
        
$query "SELECT user_email FROM {$CONFIG['TABLE_USERS']} WHERE user_id=1";
        
$result db_query($query);
        
$row mysql_fetch_array($result);
        
$subject "Order vanaf de website James van Leuven Beeldarchief";

        
$result cpg_mail($row['user_email'], $subject$message'text/html'"Order""info@xxxxxxxxx.nl");
        
        if (
$result) {
            
pageheader("Plaats bestelling""<META http-equiv=\"refresh\" content=\"3;url=index.php\">");
            
msg_box($lang_cpg_die[INFORMATION], "Uw bestelling is succesvol verzonden..."$lang_continue"index.php");
            
pagefooter();
            
ob_end_flush();
            exit;
        } else {
            
cpg_die(ERROR"Er is iets fout gegaan bij het verwerken van uw bestelling."__FILE____LINE__);
        }        
}
?>

Is this the right way to do the trick and how can I shrink the commentorder.php on screen because now it is displayed on a total white display and does not match my theme.

Thanks, Rob
« Last Edit: March 12, 2006, 11:13:41 pm by spa2036 »
Logged
Thanks for sharing this wonderful program

spa2036

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 16
Re: Add sender name -email and message to "Send email of favorites" code
« Reply #2 on: February 16, 2007, 08:05:39 pm »

Almost a year ago I made this post.
Now I have found a solution that works for me.

Look for these lines in thumbnails.php:

Code: [Select]
display_thumbnails($album, (isset($cat) ? $cat : 0), $page, $CONFIG['thumbcols'], $CONFIG['thumbrows'], true);
pagefooter();

And add the following lines between these two lines:

Code: [Select]
?>
<form method="post" action="placeorder.php">
<table border="0" bgcolor="#ececec" cellspacing="5">
<tr><td>Naam / Name</td><td><input type="text" size="30" name="name"></td></tr>
<tr><td>Email address</td><td><input type="text" size="30" name="email"></td></tr>
<tr><td valign="top">Opmerkingen /<br>Comments</td><td><textarea name="comments" rows="6" cols="30"></textarea></td></tr>
<tr><td>&nbsp;</td><td><input type="submit" value="Verstuur / Send"></td></tr>
</table></form>
<?

The code for placeorder.php is this:
Code: [Select]
<?php

define
('IN_COPPERMINE'true);
define('THUMBNAILS_PHP'true);
define('INDEX_PHP'true);
require(
'include/init.inc.php');
require(
'include/mailer.inc.php');
$user_name trim(stripslashes($_POST['name']));
$user_mail trim(stripslashes($_POST['email']));
$user_mssg trim(stripslashes($_POST['comments']));

if (
count($FAVPICS)>0) {
        
$message "Er is een order geplaatst door: $user_name<br>eMail: $user_mail.<br><br>Opmerking:<br>$user_mssg<br><br>Details worden hieronder weergegeven.<br><br>";
        
        
$favs implode(",",$FAVPICS);

        
$select_columns "filename,{$CONFIG['TABLE_PICTURES']}.title as pic_title,pid,{$CONFIG['TABLE_ALBUMS']}.title as alb_title";

        
$result db_query("SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']},{$CONFIG['TABLE_ALBUMS']} WHERE approved = 'YES'AND pid IN ($favs) AND {$CONFIG['TABLE_ALBUMS']}.aid = {$CONFIG['TABLE_PICTURES']}.aid");
        
$rowset db_fetch_rowset($result);
        foreach (
$rowset as $key => $row){

                
$message .= $rowset[$key]['pic_title']." (pid ".$rowset[$key]['pid'].") uit ".$rowset[$key]['alb_title']." album met afbeeldingnummer ".$rowset[$key]['filename']."<br>";

        }
        
        
$query "SELECT user_email FROM {$CONFIG['TABLE_USERS']} WHERE user_id=1";
        
$result db_query($query);
        
$row mysql_fetch_array($result);
        
$subject "Order from Coppermine";

        
$result cpg_mail($row['user_email'], $subject$message'text/html'"eMail from""your email adress");
        
        if (
$result) {
            
pageheader("Plaats bestelling""<META http-equiv=\"refresh\" content=\"3;url=index.php\">");
            
msg_box($lang_cpg_die[INFORMATION], "Uw bestelling is succesvol verzonden...<br>Your order has been send succesfully..."$lang_continue"index.php");
            
pagefooter();
            
ob_end_flush();
            exit;
        } else {
            
cpg_die(ERROR"Er is iets fout gegaan bij het verwerken van uw bestelling.<br>Something went wrong with your order. Please send again."__FILE____LINE__);
        }        
}
?>

Hope this will help and good luck.

Rob
Logged
Thanks for sharing this wonderful program
Pages: [1]   Go Up
 

Page created in 0.025 seconds with 19 queries.