vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Prevent Users With Low Post Counts Posting/PM'ing URLS (https://vborg.vbsupport.ru/showthread.php?t=60076)

NTLDR 01-10-2004 10:00 PM

Prevent Users With Low Post Counts Posting/PM'ing URLS
 
Title: Prevent members with low post count posting/pm'ing urls.
Author: NTLDR
Version: 1.0.1
vB Compatibility: vB3 Gamma, RC1, RC2

Description: I created this hack a while ago for use on my board to prevent people signing up and just posting a URL. This hack will prevent users with less than X posts from PM'ing or posting URLs.

File edits:

In includes/functions_newpost.php find:

PHP Code:

        eval('$errors[] = "' fetch_phrase('toomanyimages'PHRASETYPEID_ERROR) . '";');
    } 

Add after:

PHP Code:

$errors array_merge($errorsverify_message_urls($post['message'])); 

Find:

PHP Code:

    return sizeof($errors);


Add after (making sure you change REPLACE_NUMBER_OF_POSTS_HERE to the number of posts a user must have before being able to post/pm URLS):

PHP Code:

function verify_message_urls($pagetext) {

    global 
$vboptions$vbphrase$bbuserinfo;

    
$errors = array();

    if (
$bbuserinfo['posts'] < REPLACE_NUMBER_OF_POSTS_HERE) {
        if (
THIS_SCRIPT == 'newthread' || THIS_SCRIPT == 'newreply' || THIS_SCRIPT == 'editpost') {
            
$typephrase $vbphrase['post'];
        } elseif (
THIS_SCRIPT == 'private') {
            
$typephrase $vbphrase['private_message'];
        } else {
            
$typephrase $vbphrase['message'];
        }

        if (
preg_match('/\[url/i'$pagetext)) {
            eval(
'$errors[] = "' fetch_phrase('x_contains_urls'PHRASETYPEID_ERROR) . '";');
            
$errored true;
        }

        
$pagetext strip_bbcode($pagetext);

        if (!
$errored && preg_match('/h(\s*)t(\s*)t(\s*)p/i'$pagetext)) {
            eval(
'$errors[] = "' fetch_phrase('x_contains_urls'PHRASETYPEID_ERROR) . '";');
            
$errored true;
        }

        if (!
$errored && preg_match('/w(\s*)w(\s*)w/i'$pagetext)) {
            eval(
'$errors[] = "' fetch_phrase('x_contains_urls'PHRASETYPEID_ERROR) . '";');
            
$errored true;
        }

        if (!
$errored && preg_match('/(\w*)(\s*)(\.|dot)(\s*)(c(\s*)o(\s*)m|c(\s*)o(\s*)(\.|dot)(\s*)u(\s*)k|n(\s*)e(\s*)t|o(\s*)r(\s*)g)/i'$pagetext)) {
            eval(
'$errors[] = "' fetch_phrase('x_contains_urls'PHRASETYPEID_ERROR) . '";');
            
$errored true;
        }
    }

    return 
$errors;


If you want this to apply to posts only you don't need to do the following edit which is for PM's:

In private.php find:

PHP Code:

        // process errors if there are any
        
if (!empty($errors)) 

Add BEFORE:

PHP Code:

$errors array_merge($errorsverify_message_urls($pm['message'])); 

Phrases to add:

In Front-End Error Messages add:
Varname: x_contains_urls
Text:
Code:

Your $typephrase contains one or more URLs, please remove them before submitting your message again.

Boofo 01-11-2004 06:26 PM

Can we get a text install file for this? And, good work there. ;)

FleaBag 01-11-2004 06:47 PM

Another one let out of the bag. Good work. This will hopefully stop my rivals advertising their sites to my members lol.

Koutaru 01-11-2004 08:32 PM

Nice hack :) this one will really help prevent spamming no?

Xenon 01-11-2004 08:37 PM

instead of
PHP Code:

$url_errors verify_message_urls($post['message']); 
    foreach(
$url_errors AS $url_error) { 
        
$errors[] = $url_error
    } 

i'd use
PHP Code:

$errors array_merge($errorsverify_message_urls($post['message'])); 

but rather than that, nice one Lee :)

NTLDR 01-11-2004 09:08 PM

I had that origionally but it didn't seem to work, although I think that was due to me using $post['pagetext'] which doesn't exisit :P

Thanks for the comments Stefan :) I've updated the first post with this change.

Boofo 01-11-2004 09:14 PM

What is a good recommended setting for this?

Erwin 01-11-2004 09:16 PM

I've had this running on my site for 2 years now. But I use a much shorter piece of code to achieve a similar result.

bigdaddy04 01-15-2004 05:51 PM

Great hack!
Is there a similar one to 2.3.x versions?

Erwin, wanna share with us? :)

NTLDR 01-15-2004 05:53 PM

Erwin released and alternative version for vB2.

bigdaddy04 01-15-2004 05:59 PM

Quote:

Originally Posted by NTLDR
Erwin released and alternative version for vB2.

Whats it called? :)

NTLDR 01-15-2004 06:08 PM

Check his profile, you'll see it listed there :)

bigdaddy04 01-15-2004 06:16 PM

Quote:

Originally Posted by NTLDR
Check his profile, you'll see it listed there :)

i think im going blind, i don't see it.. :(

cirisme 01-16-2004 04:51 PM

Quote:

Originally Posted by bigdaddy04
i think im going blind, i don't see it.. :(

here: https://vborg.vbsupport.ru/showthrea...threadid=44694 :)

bigdaddy04 01-16-2004 06:24 PM

Quote:

Originally Posted by cirisme

does that also disable urls in the signatures/pms?

Boofo 01-17-2004 12:21 PM

Is there any way to add a message to the error that comes up that says they need to have so many posts before they can use links in their messages? I haven't installed this yet. Does it already do that? If not, they may wonder how many posts they DO need to have before that can use links. ;)

NTLDR 01-17-2004 06:21 PM

I kind of find that doing that would be like telling them how many messages they need to spam before they can spam there URL ;) However you can just edit the Phrase you add to change the text to something along the lines of you need X posts before you can post URLs :)

cirisme 01-17-2004 08:54 PM

Quote:

Originally Posted by bigdaddy04
does that also disable urls in the signatures/pms?

No idea... since it's a different hack it would be better to ask in that thread ;)

AshAbed 01-19-2004 12:18 AM

i only want this to apply to pm's, not posts because my competition always advertises through pms ;) can you please tell me how i would go about doing that? do i just add everything after
"If you want this to apply to posts only you don't need to do the following edit which is for PM's:"
or...?

NTLDR 01-19-2004 10:49 AM

Just don't add:

PHP Code:

$errors array_merge($errorsverify_message_urls($post['message'])); 

To includes/functions_newpost.php :)

MrNase 01-24-2004 10:30 PM

hey thanks. it's working like a charm :)

yl88 05-03-2004 05:51 PM

is it working with vb3.0.1?

AshAbed 05-07-2004 09:24 AM

Quote:

Originally Posted by yl88
is it working with vb3.0.1?

I'm about to test it, I'll tell you how it goes

Boofo 05-07-2004 10:27 AM

Any way to get this to work for signatures also?

NTLDR 05-07-2004 11:41 AM

Just add the code to profile.php whereever the signature is is checked.

Boofo 05-07-2004 12:01 PM

Quote:

Originally Posted by NTLDR
Just add the code to profile.php whereever the signature is is checked.

Which code and how exactly?

redd 05-18-2004 08:12 AM

I'd also like to know how to use this to stop linking in signatures. The profile.php file doesn't contain the same code, so we can't use the same instructions. I tried adding it where it seemed to fit, but it didn't work.

Thanks for any input :)

Alien 05-22-2004 05:57 PM

Confirmation that this is working fine in 3.0.1? :D

NTLDR 05-22-2004 06:03 PM

There is no reason why it shouldn't work.

WEForums 05-22-2004 11:59 PM

I...don't know. I had it set to 50 and made a test username and posted a link just fine. I'm using 3.0.1...could have ben a mistake by me, but I don't think so...?

WHC_Luke 05-24-2004 01:16 AM

I would like to know how to limit this to specfic forums.....like so that a user has to have x amount of posts before they are allowed to post in a specfic forum? Is this possible with this bit of code or should i ask elsewhere on the board?

Aurous 06-02-2004 02:28 PM

works fine in 3.0.1 - Installed

one thing which I dont like about this hack is the fact that new users cant use [img] tags with this :( any fix on this?

great hack, although I am looking for something similar with signature as well regardless of number of posts. I just dont want any url in the signature. Any help regarding this?

Noiz Pollution 06-23-2004 10:01 AM

That's a bit of a bummer that it stops people from using [img] but if it stops the spammers then it's something I'll put up with.

Aurous 07-06-2004 02:55 AM

any help with the [img] code?

Aurous 07-13-2004 07:01 PM

*bump*

Noiz Pollution 07-14-2004 06:44 AM

Quote:

Originally Posted by Aurous
*bump*

In the meantime you should probably just have your members attach images as opposed to linking to them.


Cheers,
Robert

Aurous 07-14-2004 07:22 PM

ya, but I'd prefer not wasting my b/w on that.

Also, can we make a check so it allows internal links and only show the error if there are external links!

Noiz Pollution 07-14-2004 08:57 PM

Confirmed this is working as normal with 3.0.3.

Cheers,
Robert

Dras 07-23-2004 08:10 PM

I can't get it to work on my 3.0.3 board. I can still post links and I have 2 posts and I set the min to 5.

Malke 07-25-2004 12:42 PM

I installed this in 3.0.1 and got an error in functions_newpost.php on line 811 when anyone tried to post anything. I re-did the whole thing and I still had the error... I did edit the nr of posts so it's not that.

Just thought I'd let you know...


All times are GMT. The time now is 04:50 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.01423 seconds
  • Memory Usage 1,841KB
  • 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
  • (1)bbcode_code_printable
  • (9)bbcode_php_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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