PDA

View Full Version : Contact Us Email Feedback Form (with IP address & status of sender)


Erwin
07-31-2002, 10:00 PM
Contact Us Email Feedback Form (with IP address) Version 2.3
-------------------------------------------------------------------------

Reason:
--------------

This hack allows members and guests to email you the administrator using an online email form. This way, you keep your email address hidden from spambots that crawl sites for email addresses.

When members use the form, their name and email address gets automatically inserted. Guests will have to fill out the name and email boxes. If they are not filled, the email will not be sent. Users get to choose from a list of subjects, or they can enter their own email subject if they choose "Other".

If the member who emails you is Unregistered or Not Logged In, the email will tell you that the Sender is Unregistered or Not Logged In.

If the member who emails you is Registered, then the username and email address of the member on file will be sent to you as well - this way, even if a registered member tries to pretend to be another member or put in a fake address, you will know who the member is.

The email sent to you will have the IP address and if available, the Host Name of the sender, with a link to click that will automatically search the database for members sharing that same IP - good for tracking down people sending you abusive emails using the form.

Example of an email from a Registered Member:
----------------------------------------------------------



******* Delete this section before replying ********

IP address of sender: 123.123.12.12
Host name: test.hostname.com
Click below to search for members with same IP:
http://www.yourforums.com/forums/admin/user.php?action=doips&s=&ipaddress=123.123.12.12

Registered Member - Username: Erwin
Email on file: admin@myforums.com

******* Delete this section before replying ********

Hi,

Test message here...

- Erwin





Email from a Unregistered User or Member who is Not Logged In:
----------------------------------------------------------------------



******* Delete this section before replying ********

IP address of sender: 123.123.12.12
Host name: test.hostname.com
Click below to search for members with same IP:
http://www.yourforums.com/forums/admin/user.php?action=doips&s=&ipaddress=123.123.12.12

Not Logged In or Unregistered User


******* Delete this section before replying ********

Hi,

Test message here...

- Erwin





The form is web-based, and the feedback is emailed to you, without ever revealing your admin email address if you want to keep that private.


Screenshot:
-----------------------

http://www.medlinepro.com/contact22.jpg


Installation:
-------------------

Easy. There are no file changes, 3 new templates to make, and 2 files to upload.

Create the 3 templates based on the txt files - name the templates after the file names, and copy the content of the txt files into the templates.

contact
contact_error
contact_sent

Then upload the following files into your forums directory.

contact.php

Last thing you need to do is to place this link anywhere on your site, or in your contact link field in your vB Admin Options. I have placed mine in the footer template (change it to your forums URL).

<a href="http://www.yourforums.com/yourforums/contact.php">Contact Us</a>

And you're done!

Enjoy! :)


Version 2.0
------------------

Added the option for users to choose from a list of subjects. Also fixed a minor title bug. If the option "Other" is chosen, but no title filled out in the optional text box, a blank field error message will be shown.

To upgrade from Version 1.2 - just copy the new "contact.php" and "send.php" over the old files, and replace the "contact" template with the new one.

Feel free to add more email subject titles by modifying the "contact" template. :)

Version 2.1
-------------------

Added - IP address and if available, the Host Name of sender in the email sent to you, with a link to search the database for members with the same IP address in the email (in case of people sending you abusive emails using the form)!

Version 2.2
-------------------

Added - if the sender is a Registered Member the email will contain the username and email on file, regardless of what the sender puts in the fields. If the sender is Not Logged In or Unregistered, the email will let you know.

Version 2.3
-------------------

Tidied the code up, removed the need for send.php.


Upgrading
-------------------

- to upgrade from version 1.2 - upload the new contact.php and send.php files, and replace the "contact" template with the new one.

- to upgrade from version 2.0 - upload the new send.php

- to upgrade from version 2.1 - upload the new send.php

- to upgrade from version 2.2 - upload the new contact.php, delete send.php (not needed), replace "contact" template with contact.txt



Latest hack version 2.3 below:

MrLister
08-01-2002, 07:55 PM
screenshot?

Erwin
08-01-2002, 07:59 PM
Screenshot
-----------------------

New screenshot for Version 2.2, showing the new Subject Title options, and the optional Other text input box (in case the one in the 1st post is offline).

SpotMe
08-01-2002, 08:04 PM
Sweet ;)

SpotMe
08-01-2002, 08:12 PM
One thing...

The value for '$defaulttitle' is **** Feedback. I just changed it on mine to '$bbtitle Feedback'..

SpotMe
08-01-2002, 08:15 PM
Also, instead of 'Your email has been sent to the *** Administrator', should be 'Your email has been sent to the $bbtitle Administrator' :)

Erwin
08-01-2002, 08:15 PM
Ooops... I better go fix that. :)

Erwin
08-01-2002, 08:21 PM
Okay, your own Forum name should now automatically be used rather than mine! :p

Unknown553
08-02-2002, 12:32 AM
Nice spin off, I might even add this to my own forums :D Nice work Erwin.

Unknown553
08-02-2002, 12:59 AM
Just noticed something

Originally posted by Erwin
Last thing you need to do is to place this link anywhere on your site. I have placed mine in the footer template (change it to your forums URL).

<a href="http://www.yourforums.com/yourforums/contact.php">Contact Us</a>

This isn't necessary, is it? You can just change the contact link in the Admin CP, under vBulletin Options. On default it's <a href="mailto:webmaster@email.com">, so you can just edit that and it'll automatically be changed in the footer, right? Or am I missing something?

xeon
08-02-2002, 02:09 AM
Originally posted by Unknown553
Just noticed something

This isn't necessary, is it? You can just change the contact link in the Admin CP, under vBulletin Options. On default it's <a href="mailto:webmaster@email.com">, so you can just edit that and it'll automatically be changed in the footer, right? Or am I missing something?

Well the description says:
"Contact Us Link
Link for contacting the site. Can just be mailto:webmaster@whereever.com or your own form. Appears at the bottom of every page.

I would think what you said would be the case. Just change the field from the e-mail address to contact.php and that's all you should have to do.

Nice addition to keep the admin e-mail from spamming eyes.

Boofo
08-02-2002, 03:11 AM
When I chnage the contact link in the option like you said, it just brings up an email error page. Also, how would we change it in our profile field? If I put in the link you suggested, it goes to the error page again. :)

Unknown553
08-02-2002, 03:15 AM
try adding ?s= to the end of it. Or ?action=compose. I'm not quite sure why this happens, same bug is in my hack, and it only comes up for some members...

/me shrugs

Boofo
08-02-2002, 03:23 AM
None of that worked. All I get is the contact error message. Even when I put the full URL to the file in the address bar, it always goes straight to the error message. No further. :eek:

Originally posted by Unknown553
try adding ?s= to the end of it. Or ?action=compose. I'm not quite sure why this happens, same bug is in my hack, and it only comes up for some members...

* Unknown553 shrugs

Unknown553
08-02-2002, 04:18 AM
And you're logged in ok? Are you browsing with or without cookies?

Boofo
08-02-2002, 04:22 AM
Yes, I'm logged in AND using cookies. It's got me puzzled. :ermm:

Originally posted by Unknown553
And you're logged in ok? Are you browsing with or without cookies?

Dean C
08-02-2002, 09:53 AM
this is exactly what ive been looking for.. ill try it 2nite...

SpotMe
08-02-2002, 10:26 AM
Originally posted by Boofo
Yes, I'm logged in AND using cookies. It's got me puzzled. :ermm:




What error message are you getting.. 'nopermissions_loggedin'?

Lesane
08-02-2002, 10:32 AM
Good hack, will install it later. Well done.

Erwin
08-02-2002, 12:38 PM
Boofo, you always have trouble with hacks I release! ;)

Unknown553 - this hack is totally based on your great work, so all credit goes to you! :) All I did was stand on the shoulders of giants. :D Thanks for letting me share this with others.

Tungsten
08-02-2002, 07:06 PM
For what it's worth... I am having the same problem as Boofo. :confused:

Unknown553
08-02-2002, 07:06 PM
Originally posted by Erwin
Unknown553 - this hack is totally based on your great work, so all credit goes to you! :) All I did was stand on the shoulders of giants. :D Thanks for letting me share this with others.
But unfortunately your hack is getting the same bug as mine. I think my code is corrupt or something :cross-eyed:

freeshares1
08-02-2002, 08:45 PM
This is great, I use it for a slightly different use (for people claiming cashback on my site) working example at www.gamblingforums.net/vbportal/forums/contact.php

Erwin
08-03-2002, 02:52 AM
Originally posted by freeshares1
This is great, I use it for a slightly different use (for people claiming cashback on my site) working example at www.gamblingforums.net/vbportal/forums/contact.php

Nice modification of the hack, freeshares1. :)

Boofo, can you post a screenshot of the error you get? I would like to see if I can work out why you have that bug. The contact form works fine on my site.

SuB_ZeR0
08-03-2002, 03:12 AM
Can it be setup so that only registered users can use this function? I don't want unkown ppl spamming my inbox. I want to provide help to my members only. Thanks.

Erwin
08-03-2002, 03:17 AM
To only allow registered members to use this:

In contact.php, find:



if ($action == 'compose') {



ABOVE it, add:



if ($bbuserinfo[userid]) {



Then find:



?>



ABOVE it, add:



} else {
eval("dooutput(\"".gettemplate('contact_error')."\");");
}



Edit the contact_error template to include "you need to be registered to use our contact form" or something like that. Should work.

Erwin
08-03-2002, 03:19 AM
Boofo, I went to your site and clicked on your "Contact Us" link. You're right, it goes straight to the error template.

http://www.bearfacts2.com/forum/contact.php

Very weird... It works for other members though... it has to be the way your forum is setup...

Boofo
08-03-2002, 03:33 AM
Sorry, but it foesn't work for Tungsten, either, so it can't just be my setup. :)

Originally posted by Erwin
Boofo, I went to your site and clicked on your "Contact Us" link. You're right, it goes straight to the error template.

http://www.bearfacts2.com/forum/contact.php

Very weird... It works for other members though... it has to be the way your forum is setup...

SuB_ZeR0
08-03-2002, 03:37 AM
Erwin>> Thanks for the prompt reply ... I'll try it tonight.

Erwin
08-03-2002, 03:39 AM
I suspect it may be your PHP version. What version does your server use?

It probably is the "if (!isset($action))" command that your site is having a problem with - since it doesn't recognise this line, it automatically goes to "action=send" and because you haven't filled out any fields yet, you go to the error message as not all fields are entered.

This can be avoided by dividing the contact.php to 2 files, and not use the action variable... but that doesn't really make sense, since other vb files surely use the same variable too.

Erwin
08-03-2002, 03:49 AM
Okay, I have an idea:

In contact.php, find:



if (!isset($action)) {



And replace with:



if (isset($action)==0) {



It should now work.

I have fixed up the ZIP file in the first post.

Boofo
08-03-2002, 04:02 AM
Shouldn't this:

if (isset($action)==0)

actually be this?

if (isset($action)==0) {

else I get a parse error. And sorry, that didn't fix it. :)

EDIT: My server is using PHP 4.2.1 BTW.

Originally posted by Erwin
Okay, I have an idea:

In contact.php, find:



if (!isset($action)) {



And replace with:



if (isset($action)==0)



It should now work.

I have fixed up the ZIP file in the first post.

Boofo
08-03-2002, 04:07 AM
No, I am getting the contact_error message from the hack itself. :)

Originally posted by SpotMe



What error message are you getting.. 'nopermissions_loggedin'?

Erwin
08-03-2002, 04:07 AM
Arrghhh... I thought that it would... that's very weird then... I'm stumped...

Erwin
08-03-2002, 04:19 AM
Okay try this:

In contact.php, find:



} else {
$action = 'send';


And remove it.

That should fix it.

Erwin
08-03-2002, 04:24 AM
So that top section should now look like this:


if (isset($action)==0) {
$action = 'compose';
}


Does that work?

Erwin
08-03-2002, 04:30 AM
I've updated the ZIP with the changes anyway as version 1.1. If the hack is working for you, no need to make any changes. If the hack is not working for you, upload the new contact.php and give it a try.

Erwin
08-03-2002, 04:46 AM
Okay, hack updated to version 1.2.

This SHOULD work now for Boofo and Tungsten, who seem to have problems with the ?action variables. I have removed them and split contact.php into 2 files, contact.php and send.php.

The contact template has been changed.

I will outline the changes here:

In the "contact" template, find:



contact.php?action=send"



Change to:



send.php"

Erwin
08-03-2002, 04:48 AM
Then upload the new contact.php located below:

Erwin
08-03-2002, 04:49 AM
And then upload the new send.php located below:

Boofo
08-03-2002, 04:50 AM
Where's the send.php? It's not in the zip. :)

Erwin
08-03-2002, 04:50 AM
The ZIP file has been updated to version 1.2.

If you have installed version 1.0 (original hack) and it works, there is NO need to update. The update is only for sites which seem to have a problem with the ?action variable.

Boofo
08-03-2002, 04:55 AM
We have a winner! :)

My site is hosted on a Linux server, could that have something to do with it? :)

And how could I set this up for my email address as a user? Can it de done?

Erwin
08-03-2002, 04:57 AM
HAH!!! It works!!!

I thought it was the ?action variables. Your forum setup is weird if it has a problem with that.

As long as it works. :)

Boofo
08-03-2002, 05:00 AM
Linux must handle some things a little differently than UNIX. :)

Originally posted by Erwin
HAH!!! It works!!!

I thought it was the ?action variables. Your forum setup is weird if it has a problem with that.

As long as it works. :)

Erwin
08-03-2002, 05:00 AM
Originally posted by Boofo
We have a winner! :)

My site is hosted on a Linux server, could that have something to do with it? :)

So is mine. :) That's not the problem.


And how could I set this up for my email address as a user? Can it de done?

In send.php, find:


$to = "$webmasteremail";


Change $webmasteremail to your own email address eg. boofo@yoursite.com

like this:


$to = "boofo@yoursite.com";


That will work. :)

Boofo
08-03-2002, 05:23 AM
Erwin,

Good thing I didn't reply to your test message on my site, huh? Who knows where that would have ended up at? fakeemail.com? :)

What I meant was, is there a way to have it show the contact form instead of my email address in my profile field. It does show the contact.php fine, but it also opens up the users message program (in my case, Outlook 2002) instead of going to the contact.php file when you click on the link where it tells the user my email address.

Erwin
08-03-2002, 05:27 AM
Why don't you just set in the vB admin options to not allow members to see each other's email, but to use the vB email forms instead.

Boofo
08-03-2002, 05:30 AM
No, I just wanted to be able to do it for mine. That way, the other users can have their choice for it to show their email or not.

Can it be done?

Originally posted by Erwin
Why don't you just set in the vB admin options to not allow members to see each other's email, but to use the vB email forms instead.

Erwin
08-03-2002, 05:36 AM
Yes, it can be done, but it will need hacking of member.php - I'm going to stick to supporting this hack for the moment.

Boofo
08-03-2002, 05:41 AM
You're still not understanding what I mean. I want to be able to use this hack as my profile and personal email address on the site. :)

Erwin
08-03-2002, 10:08 PM
That would require a hack of the members.php file, like I said. :) You can't just pop the URL into your email profile.

Unknown553
08-04-2002, 03:57 AM
Wow, thanks Erwin. That bug that goes straight to the error page had me stumped too, glad you were able to squash it! Thanks!

MalaK_3araby
08-04-2002, 10:44 AM
Nice ... Thanks

Erwin
08-06-2002, 03:30 AM
Updated = Version 2.0
-------------------------------

Added the option for users to choose from a list of subjects. Also fixed a minor title bug. If the option "Other" is chosen, but no title filled out in the optional text box, a blank field error message will be shown.

To upgrade from Version 1.2 - just copy the new "contact.php" and "send.php" over the old files, and replace the "contact" template with the new one.

Feel free to add more email subject titles by modifying the "contact" template.

Screenshot in Post#3 of this thread. :)

Dean C
08-06-2002, 06:17 AM
this is awesome....EXACTLY what i needed now.. :D

Erwin
08-06-2002, 10:11 AM
Version 2.1
-------------------

Added - IP address of sender in the email sent to you, with a link to search the database for members with the same IP address in the email (in case of people sending you abusive emails using the form)!

- to upgrade from version 1.2 - upload the new contact.php and send.php files, and replace the "contact" template with the new one.

- to upgrade from version 2.0 - upload the new send.php

Boofo
08-06-2002, 10:20 AM
Here's a copy of the email it sent me. :) (I took the IP address out of this message), How do I change it to read my forums?

Your message here...

Testing ...

- Boofo

Search for members using this ip

Erwin
08-06-2002, 10:22 AM
Ooops... bug... also, please edit your post to take my forums URL out please. :)

Erwin
08-06-2002, 10:26 AM
Fixed.

The latest hack file is contact_ip21.zip

Just upload the new PHP files - it will automatically show your forum name and URL. :)

Boofo - please edit your post and remove my forum URL - thanks!

Boofo
08-06-2002, 10:29 AM
Thanks for the fix and the post has been edited. ;)

Originally posted by Erwin
Fixed.

The latest hack file is contact_ip21.zip

Just upload the new PHP files - it will automatically show your forum name and URL. :)

Boofo - please edit your post and remove my forum URL - thanks!

Erwin
08-06-2002, 10:29 AM
It works... :) Enjoy!

Boofo
08-06-2002, 10:33 AM
Now, is there any way to have the IP address resolved to a host name if there is one? Might be good to know to get ahold of their ISP if there is abuse or spamming going on. :)

Erwin
08-06-2002, 10:34 AM
Okay... I'll do that now...

Boofo
08-06-2002, 10:37 AM
Suggestion: If it can't be resolved, it can just say "The host name for this IP address could not be determined." or something to that effect. Also, how can I reformat the email message I get to my own format? :)

Erwin
08-06-2002, 10:42 AM
I've updated the send.php file in the ZIP. The host name will show up in the email as well, IF it is available - otherwise, it won't show up.

Like this:



Hi,

Test message here...

- Erwin

IP address of sender: 123.123.12.12
Host name: test.hostname.com
Click below to search for members with same IP:
http://www.yourforums.com/forums/admin/user.php?action=doips&s=&ipaddress=123.123.12.12

Boofo
08-06-2002, 10:44 AM
That's even better than my suggestion. :) How about the formatting? :)

Originally posted by Erwin
I've updated the send.php file in the ZIP. The host name will show up in the email as well, IF it is available - otherwise, it won't show up.

Like this:

Boofo
08-06-2002, 10:49 AM
The host name resolve didn't work for me. It shows:

Host name:

with nothing after it.

Erwin
08-06-2002, 11:02 AM
Oops... forgot 2 essential lines in send.php in the ZIP.

It's fixed, and definitely works 100%. :)

The latest ZIP file is contact_ip_21.zip (in the 1st post). Just upload the latest send.php if you find the hostname is not working.

Boofo
08-06-2002, 11:11 AM
We have a weiner! (or is that winner?) :)

Chris M
08-06-2002, 12:34 PM
Winner:)

Satan

Erwin
08-06-2002, 01:16 PM
New Version 2.2:

If the member who emails you is Unregistered or Not Logged In, the email will tell you that the Sender is Unregistered or Not Logged In.

If the member who emails you is Registered, then the username and email address of the member on file will be sent to you as well - this way, even if a registered member tries to pretend to be another member or put in a fake address, you will know who the member is.

Example of an email from a Registered Member:
----------------------------------------------------------



******* Delete this section before replying ********

IP address of sender: 123.123.12.12
Host name: test.hostname.com
Click below to search for members with same IP:
http://www.yourforums.com/forums/admin/user.php?action=doips&s=&ipaddress=123.123.12.12

Registered Member - Username: Erwin
Email on file: admin@myforums.com

******* Delete this section before replying ********

Hi,

Test message here...

- Erwin





Email from a Unregistered User or Member who is Not Logged In:
----------------------------------------------------------------------



******* Delete this section before replying ********

IP address of sender: 123.123.12.12
Host name: test.hostname.com
Click below to search for members with same IP:
http://www.yourforums.com/forums/admin/user.php?action=doips&s=&ipaddress=123.123.12.12

Not Logged In or Unregistered User


******* Delete this section before replying ********

Hi,

Test message here...

- Erwin





Upgrading
-------------------

- to upgrade from version 1.2 - upload the new contact.php and send.php files, and replace the "contact" template with the new one.

- to upgrade from version 2.0 - upload the new send.php

- to upgrade from version 2.1 - upload the new send.php

freeshares1
08-06-2002, 02:52 PM
erwin,

Great hack, that keeps getting betting. ! thing how about a pull down box with the subjects.

Erwin
08-06-2002, 11:08 PM
I was debating between radio buttons or a pull-down menu - it's easy to set up either way - in the end I decided on radio buttons, because if they chose other "Other" it was clear that they had to fill out the text box to the right. You can't really make it as clear with a pull-down menu.

But if you want a pull down menu, just use the < select > < /select > tags.

MalaK_3araby
08-08-2002, 11:37 AM
Erwin ...
Thanks for a sweet sweet hack.
am off to update it.

Dark_Wizard
08-08-2002, 12:00 PM
Nice hack! Thx!

nhlrat
08-11-2002, 11:37 AM
If a user is unregisterd should it let them use the form anyway? Currently if a new user comes along and is having trouble registering, so they click the footer asking to contact us for help, they are not given access to the contact.php page becasue they aren't registered??? Thanks.

Jim

Erwin
08-11-2002, 11:39 AM
Unregistered users can still use the form - that is the point of this hack - you get different information in the email if the person is unregistered.

nhlrat
08-13-2002, 05:11 PM
Thanks for your response and the great hack, but I guess what I was trying to say is that the results I am getting is that if I come along as an unregistered/not logged in user and try to access the contact page to send an email becasue maybe I'm having problems registering, I am told I can't access the contact.php page because I'm not logged in. Is there a way to fix this?

Erwin
08-13-2002, 08:20 PM
Originally posted by nhlrat
Thanks for your response and the great hack, but I guess what I was trying to say is that the results I am getting is that if I come along as an unregistered/not logged in user and try to access the contact page to send an email becasue maybe I'm having problems registering, I am told I can't access the contact.php page because I'm not logged in. Is there a way to fix this?

I had a look at my php files again.

Neither the contact.php or the send.php files check for user status. Unless you added anything new to the files, or you check status for every page of your forum via global.php, it's not my hack that is causing the problem.

Make sure you don't add the additional code elsewhere in this thread to restrict the page to registered members only. Download the current ZIP and upload the 2 PHP files to your forum directory again. I repeat - my files in the ZIP do NOT check user status. So I don't know why unregistered users cannot access your feedback form. It is designed to work for ALL users.

nhlrat
08-13-2002, 08:23 PM
Ok thanks, I will try it again.

nhlrat
08-13-2002, 08:26 PM
Yep I have the correct version with no extra code at all. I guess it's in that global file then but I never added anything to there either :cry:

Thanks for your help.

Erwin
08-13-2002, 08:28 PM
Does anyone else have the same problem? I can use mine easily - I logged out, and tried it many times. I get emails from unregistered users, with all the IP information, a few times a day, so I know it works for me.

nhlrat
08-13-2002, 11:33 PM
Here's what I did to get it working. I gave unregistered/not logged in users permission to view the board and now it's working. :banana:

Erwin
08-13-2002, 11:49 PM
Originally posted by nhlrat
Here's what I did to get it working. I gave unregistered/not logged in users permission to view the board and now it's working. :banana:

LOL! Like I said, it was the way you set up your forums. If unregistered users can't view your forum, then they can't view the contact form too. :)

Boofo
08-13-2002, 11:52 PM
Is there any way to set it up so you don't have to turn on permissions, though? I have it set up that way, so it works for me, but there are a lot of sites that don't have it turned on. :)

Erwin
08-14-2002, 12:01 AM
The permissions are set up in global.php which the contact.php file includes at the very beginning.

To set it up to work would mean hacking global.php OR copying global.php and renaming it another name and then removing the permission bits, and then include that file in contact.php instead of global.php OR commenting out the global.php include line in contact.php and then hardcoding in the header, footer, name of forum and other variables in the template (not a good option the last one).

There are ways around it.

:)

nhlrat
08-14-2002, 01:28 AM
Originally posted by Erwin


LOL! Like I said, it was the way you set up your forums. If unregistered users can't view your forum, then they can't view the contact form too. :)

Yep, you were right on target ;) Thanks for your help. If anyone has this hack (https://vborg.vbsupport.ru/showthread.php?s=&threadid=40746) please let me know because it's not in the thread any longer. Thanks.

mewgood
08-14-2002, 01:30 AM
great hack
:D

Dark Shogun
08-20-2002, 03:47 AM
Works great at my forum.

Dark Shogun

Vinney
08-24-2002, 04:03 PM
hi,

how do i get this, only a certain user group can use it, and others get a custom error message ( using a template ) ?

there group i want to only access this is:

usergroupid=2

could anyone help me please ?

thanks for your time - great hack.

Erwin
08-24-2002, 09:18 PM
Originally posted by Vinney
hi,

how do i get this, only a certain user group can use it, and others get a custom error message ( using a template ) ?

there group i want to only access this is:

usergroupid=2

could anyone help me please ?

thanks for your time - great hack.

Sure, but this means guests cannot contact you using the form.

Open contact.php.

Find:


require('./global.php');


Add BELOW:


if ($bbuserinfo[usergroupid] !=2 AND $bbuserinfo[usergroupid] !=6 AND $bbuserinfo[usergroupid] !=5) {
eval("standarderror(\"".gettemplate("error_nocontact")."\");");
exit;
}


Make sure you add the usergroupid's of your staff usergroups in there too so they can use the form.

The make a new template called:

error_nocontact

Add this as contents:


You have no permission to access the contact form.


Or whatever you want.

Done. :)

Vinney
08-24-2002, 10:29 PM
Originally posted by Erwin


Sure, but this means guests cannot contact you using the form.

Open contact.php.

Find:


require('./global.php');


Add BELOW:


if ($bbuserinfo[usergroupid] !=2 AND $bbuserinfo[usergroupid] !=6 AND $bbuserinfo[usergroupid] !=5) {
eval("standarderror(\"".gettemplate("error_nocontact")."\");");
exit;
}


Make sure you add the usergroupid's of your staff usergroups in there too so they can use the form.

The make a new template called:

error_nocontact

Add this as contents:


You have no permission to access the contact form.


Or whatever you want.

Done. :)

whats does the " exit; " do ? is that needed ?

also is it possible to place the group in an array.

Am a newbie at php, bit am trying different methods to get the same result at the moment.

i have :


<?php
error_reporting(7);
include ("../../mainfile.php");
$index = 1;
global $Pmenu,$breadcrumb;
$Pmenu="";
$breadcrumb="Account Activation";
$defaultmessage = "Your message here... \n\n - $bbuserinfo[username]";
$defaultemail = "$bbuserinfo[email]";
$unwantedgroups = array('1', '6', '11');
getvbpvars();
include("header.php");
if ($bbuserinfo[usergroupid] == $unwantedgroups) {
eval("dooutput(\"".gettemplate('contact_error')."\");");
} else {
eval("dooutput(\"".gettemplate('contact')."\");");
}
include("footer.php");
?>



now i dont get any errors when running this, but the contact template is always displayed, even when am using a group id of 6 - so this dont work for some reason :(

i can get it to work, using this :


<?php
error_reporting(7);
include ("../../mainfile.php");
$index = 1;
global $Pmenu,$breadcrumb;
$Pmenu="";
$breadcrumb="Account Activation";
$defaultmessage = "Your message here... \n\n - $bbuserinfo[username]";
$defaultemail = "$bbuserinfo[email]";
getvbpvars();
include("header.php");
if ($bbuserinfo[usergroupid]==1 || $bbuserinfo[usergroupid]==6 || $bbuserinfo[usergroupid]==11) {
eval("dooutput(\"".gettemplate('contact_error')."\");");
} else {
eval("dooutput(\"".gettemplate('contact')."\");");
}
include("footer.php");
?>



why dont my array version work ?

Erwin
08-25-2002, 07:38 AM
That question belongs in the PHP forum. :) I have no idea why it wouldn't work.

Vinney
08-25-2002, 10:46 AM
it's mean again.

How do you get 'User Profile Fields' to be displayed. this is what i have :


<?php
error_reporting(7);
include ("../../mainfile.php");
$index = 1;
global $Pmenu,$breadcrumb;
$Pmenu="";
$breadcrumb="Contact Helpdesk";
$defaultmessage = "Dear Helpdesk... \n\n - $bbuserinfo[username]";
$defaultemail = "$bbuserinfo[email]";
$defaultmembership = "$post[field5]";
$defaultexpiry = "$post[field9]";
//getvbpvars();
include("header.php");
if ($bbuserinfo[usergroupid]==1 || $bbuserinfo[usergroupid]==3 || $bbuserinfo[usergroupid]==11) {
eval("dooutput(\"".gettemplate('error_nopermission_loggedout')."\");");
} else {
eval("dooutput(\"".gettemplate('helpdesk')."\");");
}
include("footer.php");
?>


notice :



$defaultmembership = "$post[field5]";
$defaultexpiry = "$post[field9]";



then in my template i have :

<tr>
<td bgcolor="{firstaltcolor}" align="left" valign="top" nowrap><normalfont>Your
m/ship N<font face="Times New Roman">?</font>:</normalfont></td>
<td bgcolor="{firstaltcolor}" align="left" width="50%">
<input type="text" name="mem" size="4" class="bginput" tabindex="1" value="$defaultmembership"></td>
<td bgcolor="{firstaltcolor}" align="left"><b><font color="#FF0000">
*</font></b></td>
</tr>
<tr>
<td bgcolor="{secondaltcolor}" align="left" valign="top" nowrap><normalfont>Your
expiry date:</normalfont></td>
<td bgcolor="{secondaltcolor}" align="left" width="50%">
<input type="text" name="expiry" size="8" class="bginput" tabindex="1" value="$defaultexpiry"> example:
08/12/02</td>
<td bgcolor="{secondaltcolor}" align="left"><b>
<font color="#FF0000">*</font></b></td>
</tr>


but it dont work ? what else do i need to do ?

Erwin
08-25-2002, 10:30 PM
You are obviously using vBPortal there. :)

Well, the $post variables only work in the showthread section since it pulls information from the functions.php - you would need to do a db query to pull the custom user profile fields in contact.php first for this to work.

Like I said before, this has nothing to do with my contact form hack. Please ask this in the PHP forum, or in the vBPortal forums. :) I cannot support my hack to make it work with VBPortal - only with vB.

shinpad
10-30-2002, 04:58 PM
Great hack - one question:
would it be possible to have the form check that the email address entered is at least in the right format? ie user@domain.com
at present you can type in anything as the email address.
I know it's not going to matter to those who actually want a reply, but it may put some of the idiots of sending crap :cheeky:

cheers

Graham

Erwin
10-30-2002, 06:26 PM
Originally posted by shinpad
Great hack - one question:
would it be possible to have the form check that the email address entered is at least in the right format? ie user@domain.com
at present you can type in anything as the email address.
I know it's not going to matter to those who actually want a reply, but it may put some of the idiots of sending crap :cheeky:


No, because:

1) People who want to hide their emails will put in a fake one no matter what.

2) I rather they put in an obviously wrong one, so I don't waste time replying.

3) If they keep spamming you, you have their IP address and DNS server sent to you in their email with this hack, and you can still ban them.

Goldknight
10-31-2002, 12:41 AM
Great hack, about time I install this hack

-=dm=-
10-31-2002, 10:38 AM
Erwin & Unknown553

Thanx its working fine on vB 2.2.4 :)

Visionray
12-03-2002, 03:23 PM
Nice hack guys...working great.

donna8284
12-03-2002, 06:34 PM
Hi,

I installed this hack today and it works fine, however it will not let me log out of my board now. It says I logged out and all cookies have been cleared, but I'm still actually logged in. Any ideas on how to fix this?

Erwin
12-03-2002, 07:49 PM
donna, that has nothing to do with this hack. You have a corrupted cookie. Manually clear all cookies in your browser, log in again and you will be fine.

donna8284
12-03-2002, 08:31 PM
Thank you,

I did finally figure out what is was - sorry for the stupid question!!

Erwin
12-03-2002, 08:47 PM
It's okay. :)

Smoothie
01-06-2003, 05:35 AM
Well done Doc! Works great. Thank you!

SHalliday
04-25-2003, 06:51 PM
Erwin, nice job on this hack! Just installed it this morning and its working great!

I have one question though. When you press the "Send Email" button on the contact page it sends the email but displays a blank screen. I then have to select the back button to return to the contact page. Should'nt it automatically display a message like "Your email has been sent - Press enter to return to previous page" message or automatically return back to the contact page?

Am I the only one that gets a blank screen display after email has been sent and if so, what should be displayed?

Thanks again for making available such useful hack!

FFArmageddon
04-25-2003, 08:19 PM
This is a nice hack, easy to install to (my kind of hack :p)

Not sure if I will install though, I am not sure I would have a use for it.,

Erwin
04-26-2003, 09:58 AM
Minor Update Version 2.3

Fixed up the blank page bug. :)

Removed the need for 2 files - took away send.php

Tidied up the code.

To upgrade - upload the new contact.php, delete send.php (not needed), replace "contact" template with contact.txt

wolfe
04-27-2003, 07:58 PM
d00d still getting blank screen on send

Erwin
04-28-2003, 04:12 AM
That's weird. Anyone else?

trafix
04-28-2003, 05:17 AM
interesting ..... i havent had a problem with the original script .... lol i havent had a blank screen just the " your email has been sent to......." message

should I update??

Erwin
04-28-2003, 05:29 AM
No need to update if everything is working. I did remove the need for the send.php - if you just want to have 1 file, then update. Note - there is a small change to the contact template too.

Also, if you're getting a blank page, make sure you created all the templates - there are 3 of them.

Austin Dea
05-04-2003, 05:17 AM
You forgot to update the install.txt ;)

Carsten
05-04-2003, 10:18 AM
Great hack!

OmaniMan
05-06-2003, 05:19 AM
WoooooooooW ... !!!

What a WONDERFUL Hack :classic:

Great Man ... Wish You The Best

Erwin
05-06-2003, 07:00 AM
05-04-03 at 04:17 PM Austin Dea said this in Post #114 (https://vborg.vbsupport.ru/showthread.php?postid=391083#post391083)
You forgot to update the install.txt ;)


LOL!

I've fixed it...

Austin Dea
05-06-2003, 02:21 PM
Nice hack =D

Boofo
05-06-2003, 02:37 PM
Erwin, if we are using the older version with 2 files and it is working fine, do we really need to upgrade? Is there any real advantages to doing that? Just curious. ;)

Keyser S?ze
05-06-2003, 08:14 PM
great job erwin, such a wonderful useful hack and yet so easy to install!!

suggested upgrades:

when they click in the txt box the "type your msg here" disappears

also after sending it gives a thank you msgs then redirects you to the last page you were on, instead of just providing a link to the forums

OmaniMan
05-06-2003, 08:50 PM
Hello Erwin,,,

I have a Question ...But before that I want to say short words ...

While I was testing the wonderful hack ... I just press send to webmastermail ...

I recieved it but not in (( INBOX )) .... I recieved in (( Junk Mail )) !!

why ?

Erwin
05-07-2003, 02:20 AM
Sorry, I don't understand what on earth you mean.

It's probably your mail reader filtering your own website domain to the junk mail for some reason.

Erwin
05-07-2003, 02:21 AM
Today at 07:14 AM IceMalee said this in Post #120 (https://vborg.vbsupport.ru/showthread.php?postid=392457#post392457)
great job erwin, such a wonderful useful hack and yet so easy to install!!


suggested upgrades:

when they click in the txt box the "type your msg here" disappears

also after sending it gives a thank you msgs then redirects you to the last page you were on, instead of just providing a link to the forums

Not bad ideas. :) When I have time... the redirecting one is a bit hard, since you are 3 pages in front of your previous page, if you know what I mean.

wolfe
05-07-2003, 09:24 PM
right i figured out why i got blank page lol stupid me had contact_send instad of contact_sent but now it working but theres a problem i am not receiving the email any ideas :(

Erwin
05-08-2003, 09:44 AM
Check your that your email set in the Admin CP is the right one. I am using the $webmasteremail variable in this hack.

Remi
05-15-2003, 07:56 AM
Hi Erwin

Is it posible to send defferent subjcet to another email.

For example, I wan to send the "Bug Report" to my personal email and the rest to the webmasteremail.

Thanks in advance

Alien
05-17-2003, 08:17 PM
/me clicks install.

Great job on this!

-Jason

Erwin
05-18-2003, 02:21 AM
05-15-03 at 06:56 PM Remi said this in Post #126 (https://vborg.vbsupport.ru/showthread.php?postid=395374#post395374)
Hi Erwin

Is it posible to send defferent subjcet to another email.

For example, I wan to send the "Bug Report" to my personal email and the rest to the webmasteremail.

Thanks in advance


Yes, it's very possible, and easy to do.

Just change this bit:

Find:


$to = "$webmasteremail";
if ($title == "") {
$title = $otitle;
}


Underneath ADD:


if ($title == "Whatever") {
$to = "anotheremail@yourdomain.com";
}


Just add as many of those underneath as you like. :)

Remi
05-18-2003, 12:12 PM
Thank you very much Erwin, you are SUPER, it works perficly.

I was just woundering if there is a way to prevent people from sending the same message more than once or twice, ( by setting some cookies counter may be).

Some people might abuse the system and flood your inbox with emals :)

Erwin
05-18-2003, 12:45 PM
Well, this is why this hack logs the user's IP address. :)

We can always use the email spam check time limit for the normal email form, but this means adding another query. It can be done.

In contact.php,

Find:


eval("dooutput(\"".gettemplate('contact_sent')."\");");


ABOVE THIS, add:


$DB_site->query("UPDATE user SET lastemail=$ourtimenow WHERE userid='$bbuserinfo[userid]'");


Then, find:


if ($action == "send") {


BELOW, add:


if ($emailspamcheck) {
if (time()-$bbuserinfo[lastemail]<=$spamtimelimit) {
eval("standarderror(\"".gettemplate("error_spamcheck")."\");");
exit;
}
}


So if you have email spam check enabled, and you have set the time limit in your Admin CP vB Options, then the email flood spam check time limit will apply to the Contact Form as well. :)

Not tested, but should work.

Remi
05-18-2003, 12:54 PM
Wow :)

thank you Erwin for the quick reply, I will certainly use that :)

Crazy Pete
05-18-2003, 06:03 PM
Very nice, Erwin! Installed.

xs1
05-27-2003, 10:39 AM
after submitting i get a blank page ! :(

magicfox
07-25-2003, 03:45 PM
Great hack! Easy to install und works without any problems.

cklaszlo
09-12-2003, 01:55 PM
We just installed: vBulletin Version 3.0.0 Beta 6

And the contact form doesn't seem to work anymore. Are you working on an update?

http://community.singlereel.com/contact.php

StevenTN
09-12-2003, 02:27 PM
I just upgraded one of the sites I admin to vBulletin 3.0, rendering this hack useless without some changes.

I got it working after about 15 minutes worth of fixing code, but it looks a little bit crummy at the moment. If any of you want to know how I fixed it for vB3, let me know. I might be a little late in responding, but I will respond (since I have to go out of town for this weekend).

Paul
09-12-2003, 03:59 PM
This hack is now a standard feature in vB3.

StevenTN
09-12-2003, 04:56 PM
Then how come I don't see such an option for using the form? I know there's an option for enabling a contact form for e-mailing a registered member, but not one for someone like webmaster@ or info@.

Paul
09-12-2003, 05:09 PM
<a href="http://www.vbulletin.com/forum/sendmessage.php" target="_blank">http://www.vbulletin.com/forum/sendmessage.php</a>

StevenTN
09-12-2003, 05:28 PM
Thanks

Erwin
09-13-2003, 06:01 AM
Yeah, this hack is now superfluous as it's now part of vB3. :)

midnightz
10-08-2003, 03:00 PM
Hi -

I am very fond of this hack and trying to make it work with this current form, I love the style of it and it wont send the information, I have looked through the hack and I'm trying to fiquire out how to make it work and send mt the desired information

http://www.digikitten.com/forums/emailform.php

thanks

I can attach the php file and the three templates if somebody can help. I'm kind of lost on what to do, I have tried many things. but none work at all :(

midnightz
10-08-2003, 08:38 PM
Never mind - got it to work and its great :) with the mods