vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Contact Us Email Feedback Form (with IP address & status of sender) (https://vborg.vbsupport.ru/showthread.php?t=41791)

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

Quote:

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:

PHP Code:

require('./global.php'); 

Add BELOW:

PHP Code:

if ($bbuserinfo[usergroupid] !=AND $bbuserinfo[usergroupid] !=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:

Code:

You have no permission to access the contact form.
Or whatever you want.

Done. :)

Vinney 08-24-2002 10:29 PM

Quote:

Originally posted by Erwin


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

Open contact.php.

Find:

PHP Code:

require('./global.php'); 

Add BELOW:

PHP Code:

if ($bbuserinfo[usergroupid] !=AND $bbuserinfo[usergroupid] !=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:

Code:

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 Code:

<?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 Code:

<?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]==|| $bbuserinfo[usergroupid]==|| $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 Code:

<?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]==|| $bbuserinfo[usergroupid]==|| $bbuserinfo[usergroupid]==11) {
eval(
"dooutput(\"".gettemplate('error_nopermission_loggedout')."\");"); 
} else {
eval(
"dooutput(\"".gettemplate('helpdesk')."\");");
}
include(
"footer.php");
?>

notice :

PHP Code:


$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

Quote:

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 :)


All times are GMT. The time now is 12:44 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01237 seconds
  • Memory Usage 1,784KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (8)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete