Contact us mail form plugin with image verification for Coppermine Photo Gallery Contact us mail form plugin with image verification for Coppermine Photo Gallery
 

News:

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

Main Menu

Contact us mail form plugin with image verification for Coppermine Photo Gallery

Started by wirewolf, October 31, 2006, 02:00:22 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wirewolf

Contact us mail form plugin with image verification by wirewolf, v1.1 - for Coppermine Photo Gallery, 1.4.x

Original mod by myself, wirewolf, http://forum.coppermine-gallery.net/index.php?topic=37846.0

For this plugin, original files for the codebase, configuration and the init.inc are from the devs, donnoman, gaugau, with modifications by BMossavari, Frantz (inspired from GYZMO's Add On) and adaptation by myself for this plugin. This is my first plugin for Coopermine and I learned a lot by studying the scripts from other plugins.

Original contact_us.php and english.php files by myself, randomimage.php file by unknown author. If anyone would like to provide translations for other languages, please do so.

This plugin will add a contact us mail form with image verification and a 'Contact Us' link on the top menu bar for Coppermine Photo Gallery, 1.4.x  Tested with classic theme, not tested with others, but it should work.

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 plugin at http://academyphotos.net/photogallery/index.php?file=contact_us/contact_us

Added the cpg_mail() function, so it should work with both mail() and SMTP (thanks to Nibbler for some guidance on the correct coding)

You can download the zip file at the end of this post. It contains all of the plugin files plus a README.txt file with full instructions. For those unfamilar with installing a plugin, see http://coppermine-gallery.net/demo/cpg14x/docs/index.htm#plugin_manager

step 1:
Download and unzip the archive - contact_us.zip
Upload the "contact_us" directory structure as is to your Coppermine gallery's plugins folder.

end upload plugin

step 2:
Login to your admin panel, go to config, then "Manage Plugins"
Find the Contact Us entry in the available plugins and click install.
A new menu button is now added for opening contact us mail form.
If you want, you can also add a link to the form in your custom footer, IE:
<a href="index.php?file=contact_us/contact_us">Contact Us</a>

Enjoy! wirewolf, John

If the devs like, please move move post accordingly, Thanks

Add On: Uploaded new zip file with corrections for cpg_mail function as suggested by Nibbler

Nibbler

You might like to consider using cpg_mail() instead of mail(). That way it will work for people who use SMTP to send emails too. Also, if you name the plugin's directory as contact_us then it will play much better with the plugin manager.

Thanks for your contribution.

wirewolf

Hi Nibbler, thanks

The folder is named contact_us. (I didn't want it to conflict with other mods or plugins named contact).

I just tried the script with the cpg_mail() and got this:
Fatal error: Call to undefined function: cpg_mail() in photogallery/plugins/contact_us/contact_us.php on line 93

For now I'll go back to the mail() until I can figure it out. The contact_us.php file calls for the include/init.inc.php file, so the cpg_mail() function should have been defined. Any clues?

wirewolf

wirewolf

I just looked up the function cpg_mail($to, $subject, $msg_body = '', $type = 'text/plain', $sender_name = '', $sender_email = '', $msg_body_plaintext = '') in the mailer.inc.php file

this is my line of code in my contact_us.php script:
mail($CONFIG['gallery_admin_email'], $sender_subject, $messageproper, "From: \"$sender_name\" <$sender_email>" . $headersep . "Reply-To: \"$sender_name\" <$sender_email>");

Would I have to match the coding variables to my script in order for cpg_mail() to work?

wirewolf

Nibbler

You need to

include 'include/mailer.inc.php';

to be able to use cpg_mail(). You also need to give it the right arguments, yes.

cpg_mail('admin', $sender_subject, $messageproper, 'text/plain', $sender_name, $sender_email);

The folder is named 'contact_us_plugin_v1.1' in the package I downloaded.

wirewolf

Thanks Nibbler.

I was starting to look at some of the coding from existing scripts when I got the email notice about your reply. Applied the changes you suggested and it works like a charm now, Thank you.

added - include 'include/mailer.inc.php'; - to the script and changed the one line to:
cpg_mail('admin', $sender_subject, $messageproper, 'text/plain', $sender_name, $sender_email);


I replaced the zip file with the corrections in the top post.

Again, Thanks for the assist,
wirewolf

m@rk

#6
Great Plugin!

Here's my German translation.
I left the "Check your spelling" fields blank.

Modification:

With attached modified contact_us.php, the anti spam protection appears only for not-logged-in-guests.
Also, members have their name and email fix in the form.
By default, the gallery name is set as subject.

wirewolf

Thank you m@rk, for the translation and the guests/members coding addition.

I didn't even occur to me of adding that. My site has no registered users (except for me!). It's for display of photos I'm taking only. Great add-on

I also have a mod for capcha for e-cards - http://forum.coppermine-gallery.net/index.php?topic=37635.0 . Your additional code would be great for that too.

Have to look in to it.

Again, thanks
wirewolf

JvM


kushti

I got a problem with all the contact plug-ins I have installed because the image verification does not work - this did work at first but has now stopped! Does anyone have an idea why this has happened how how to fix it?

LukaszP


panatan

Hi all !

Instead "Captcha (Visual Confirmation) for adding comments" like shown in this post "http://forum.coppermine-gallery.net/index.php?topic=36319.msg233202#msg233202" i've installed "Contact Us Mail Form v1.1" (wirewolf)

But i never receive any message when i'm testing...

I've changed "cpg_mail" in "mail" but it doesn't works...

Could you help me ?

sard

This is macedonian translation of this plugin.


Luksi1

Great plugin!

You can find Slovenian translation here.

Chears,

Luka

durangod

Most excellent Mod, works perfectly on the fruity theme... only thing i changed was i added a back button, other than that PERFECT!!  NICE JOB...