
Contact us mail form with image verification for Coppermine Photo Gallery, 1.4.9
by wirewolf, http://academyphotos.net 10/27/2006, v1.1

This mod will add a contact us mail form for Coppermine Photo Gallery, 1.4.9
Tested with classic theme, not tested with others, but it should work.
There are only two edits (adding additional lines) to the lang/english.php file and three new files added to the gallery root folder.
There are no edits to theme.php, or to template.html

The contact form will display error messages when a users fails to enter the required information. All fields are required, Name, Email Address, Subject, Comments, and the image verification code. It also allows for the user to 'Reset' the image if they have difficulty reading the code. The error messages are displayed right on the contact form page. Even if they have only entered partial information, the error messages will toggle on or off accordingly upon hitting the 'Submit' button. It not only checks for a required email address from the user, but it also checks that the email address they enter is correctly formatted.

A new image code is generated any time they hit the 'Submit' button without all of the required information entered, or if they hit the 'Reset Image' button. However, they will not lose any of the information they have entered up to that point. unless they hit the 'Reset Form' button (reloads the entire form) or, of course, leave the page.

They can't send a message until the form is successfully submitted, when they are then directed automatically to a 'Thank You Page'. The email is then sent via the email address you have entered in the Admin Control Panel. The email you receive not only has the users input, but contains a link to check out their ip address (with ARIN Whois) and lists their server agent.

See working mod at http://academyphotos.net/photogallery/contact.html
You will notice that I have mod-rewrite on my site (the file is actually contact.php), but this mod will work with the standard 1.4.9 files.

files to edit - 1:
lang/english.php  

new files to add - 3:
randomimage.php // generates the random image code.
contact.php  // the contact us form
thank_you.php // page displayed when user has successfully submitted an email

as always with any editing to existing files, BACKUP!! BACKUP!! before applying the changes

step 1:
upload randomimage.php into the root folder of your gallery
upload contact.php into the root folder of your gallery
upload thank_you.php into the root folder of your gallery

end upload new files

step 2:
edit lang/english.php // you'll have to edit for different languages

open and find - around line 2024 (approx.) in the view_log.php section:

// ------------------------------------------------------------------------- //
// File view_log.php  //cpg1.4
// ------------------------------------------------------------------------- //

if (defined('VIEWLOG_PHP')) $lang_viewlog_php = array(
  'delete_all' => 'Delete All Logs', //cpg1.4
  'delete_this' => 'Delete This Log', //cpg1.4
  'view_logs' => 'View Logs', //cpg1.4
  'no_logs' => 'No logs created.', //cpg1.4
);

add after:

// ------------------------------------------------------------------------- //
// File thank_you.php  // contact us mod 
// ------------------------------------------------------------------------- //

if (defined('THANK_YOU_PHP')) $lang_thank_you_php = array(
  'thank_name' => 'Contact Us Form - Thank you',
  'feed_back' => 'Thank you for your feedback',
  'thanks_email' => 'Thank you for your comments and or suggestions. If your message requires a reply, we will get back to you as soon as possible.',
  'return_page' => '<a href ="' . $CONFIG['home_target'] . '">Return to the Catalog Page</a>, or use any of the links above.',
);

// ------------------------------------------------------------------------- //
// File contact.php  // contact us mod
// ------------------------------------------------------------------------- //

if (defined('CONTACT_PHP')) $lang_contact_php = array(
 'page_head' => 'Contact Us Form',
 'form_name' => 'Contact Us',
 'all_fields' => 'All fields are required!',
 'enter_name' => 'Please enter your name.',
 'enter_email' => 'Please enter your valid email address.',
 'enter_subject' => 'Please enter the subject of your message.',
 'enter_comments' => 'Please enter your comments.',
 'enter_code' => 'Please enter a valid image verification code! Maybe you\'re having trouble seeing the image code clearly.<br />If so, just hit the "Reset Image" button >>',
 'reset_image' => 'Reset Image',
 'contact_explain' => 'You can use this form to send your comments/suggestions to the Administrator. <b>Please Note:</b> All fields are required and if you expect a reply, please include your correct email address. Thank you.',
 'name' => 'Name: ',
 'email_address' => 'Email address: ',
 'subject' => 'Subject:',
 'comments' => 'Comments:',
 'check_spell' => 'Check your spelling at <a title="Check your spelling at SpellCheck.net" target="_blank" href="http://spellcheck.net/">SpellCheck.net</a>',
 'copy_paste' => '(Just copy and paste your text)',
 'enter_image_ver' => 'Enter Image Verification: This is to prevent automated entry from search robots. Letters must be in upper case.',
 'submit' => 'Submit',
 'reset_form' => 'Reset Form',
 'reset_warn' => 'Resetting the form will delete any or all data entered!',
 'give_time' => 'Please do not hit the Submit button more then once. It may take some time for the server to post your comment. Thanks!',
 'ip_sent' => '<b>Note</b> - Your IP address is being recorded and will be sent along with the message.',
);


end edit lang/english.php
upload edited lang/english.php file

========================================================

Now, where to place a link to your 'Contact Us' form?
I put mine in the custom footer (you could also add it to the custom header) of the main template of my theme (classic):
example - <a title="Contact Us" href="contact.php">Contact Us</a>, 
and in the sub menu, in the Admin Panel, under - Themes settings:
Custom menu link name (Contact Us)- Custom menu link URL (contact.php)

Enjoy! wirewolf, John
