Advanced search  

News:

cpg1.5.46 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter recently discovered vulnerabilities. It is important that all users who run version cpg1.5.44 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Contact us mail form with image verification for Photo Gallery 1.4.9  (Read 39007 times)

0 Members and 1 Guest are viewing this topic.

wirewolf

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 35
    • Ship Modeling Forum

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 and no additions or changes to the database.

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 (go ahead, send me an message!).
You will notice that I have mod-rewrite on my site (the file is actually contact.php). This mod will work with the standard 1.4.9 files.

If the devs like the script, I'll post the code.

wirewolf
« Last Edit: October 30, 2006, 10:35:14 am by GauGau »
Logged

Sami

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 3686
  • BMossavari
    • My Project
Re: Contact us mail form with image verification for Photo Gallery 1.4.9
« Reply #1 on: October 28, 2006, 06:48:20 pm »

Post it , Nice work ...
Logged
‍I don't answer to PM with support question
Please post your issue to related board

wirewolf

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 35
    • Ship Modeling Forum
Re: Contact us mail form with image verification for Photo Gallery 1.4.9
« Reply #2 on: October 28, 2006, 07:46:33 pm »

Thanks, Sami.

I'll just post the file edits to lang/english.php here. All of the new files along with a README.txt file with installation instructions and containing the file edits to lang/enlish.php are in a zip file, which you can download at the end of this post.

I should add that this works with the PHP mail() function. Some hosts block the use of PHP mail() unless you are using your domain email address for the 'fromemail'.

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 message

As always with any editing to existing files or installing new ones, 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:

Code: [Select]
// ------------------------------------------------------------------------- //
// 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:

Code: [Select]
// ------------------------------------------------------------------------- //
// 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

PS, I think this would make a good plugin module, but I've never done one before and may need a bit of help. I'll give it a try.
« Last Edit: October 29, 2006, 11:38:36 pm by wirewolf »
Logged

wirewolf

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 35
    • Ship Modeling Forum
Re: Contact us mail form with image verification for Photo Gallery 1.4.9
« Reply #3 on: October 29, 2006, 10:06:38 pm »

I did a little house cleaning with the files. Not much, just put the pageheader and starttable names into the lang/english.php file rather than hard coded. also cleaned up some of the code in thank_you.php to include the gallery home_target as the return page rather than hard coded.

All changes are reflected in the above post for the english.php file and I uploaded a revised zip file - contact_us_mod_v1.1.zip

wirewolf

bigarte

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 12
  • Oz Sapper
    • Free Windows Wallpapers
Re: Contact us mail form with image verification for Photo Gallery 1.4.9
« Reply #4 on: October 29, 2006, 11:19:16 pm »

Nice work wirewolf. I'm impressed.
Logged

wirewolf

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 35
    • Ship Modeling Forum
Re: Contact us mail form with image verification for Photo Gallery 1.4.9
« Reply #5 on: October 29, 2006, 11:52:07 pm »

Thanks, bigarte. I was trying to come up with a form that, if a user makes just one little error, they don't have to retype everything back in to the form after being sent to an error page. I'm working on a plugin version.
wirewolf

wirewolf

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 35
    • Ship Modeling Forum
Re: Contact us mail form with image verification for Photo Gallery 1.4.9
« Reply #6 on: November 01, 2006, 11:01:04 pm »

This is now available as a plugin - http://forum.coppermine-gallery.net/index.php?topic=37956.0
wirewolf

Muurvaren

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 37
    • Muurvaren, digitale fotografie
Re: Contact us mail form with image verification for Photo Gallery 1.4.9
« Reply #7 on: April 01, 2007, 07:54:14 pm »

This is now available as a plugin - http://forum.coppermine-gallery.net/index.php?topic=37956.0
wirewolf

Nice work indeed!  I translated the english lanquage file in Dutch.

Logged

Visitors

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 51

Thanks for this mod. It's great.
Logged
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 20 queries.