1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

phpBB: where is the "insert new posting" code?!

Discussion in 'PHP' started by falcondriver, Dec 1, 2006.

  1. #1
    hi there,
    SEMrush
    i have a phpBB forum and always get ths stupid spam, even if i have captcha enabled and guest postings disabled.
    im trying do modify the script so that members with less than 10 postings cant post anything with "[url", "http://", "www" or ".info/" in it.
    my problem is that i just cant find the code where "insert posting into database" happens (have checked posting.php for "Submit" and "Insert Into").
    can someone just point in the right direction please?
    and is there already an $var which holds the number of postings this user made so far or must i count it by myself?
     
    falcondriver, Dec 1, 2006 IP
    SEMrush
  2. Seiya

    Seiya Peon

    Messages:
    4,666
    Likes Received:
    404
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try adding a custom security question in your sign up page, this stopped my problem.... 100%... look at my forum: www.soccerod.com

    The world cup question.
     
    Seiya, Dec 1, 2006 IP
    falcondriver likes this.
  3. chopsticks

    chopsticks Active Member

    Messages:
    565
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Check:

    /includes/functions_post.php

    Thats where the topic / post is inserted etc.
     
    chopsticks, Dec 1, 2006 IP
    falcondriver likes this.
  4. falcondriver

    falcondriver Well-Known Member

    Messages:
    963
    Likes Received:
    47
    Best Answers:
    0
    Trophy Points:
    145
    #4
    thanks everyone, here is what i did:

    
    //spamcheck
    $text = $post_message;
    if($userdata['user_posts']<10) {
    	if(strpos($text, "[url")!==false || strpos($text, "http://")!==false || strpos($text, "www")!==false || strpos($text, ".info")!==false) {
    	//get lost!
    	message_die(GENERAL_ERROR, 'Error in posting: You are not allowed to post any websites here at the moment.');
    	}
    }
    //end spamcheck
    
    Code (markup):
    insert this code before
    	$edited_sql = ($mode == 'editpost' && !$post_data['last_post'] && $post_data['poster_post']) ? ", post_edit_time = $current_time, post_edit_count = post_edit_count + 1 " : "";
    
    Code (markup):
    in includes/function_post.php

    hope this will do it :)
     
    falcondriver, Dec 2, 2006 IP
    clancey likes this.
  5. clancey

    clancey Peon

    Messages:
    1,099
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thank you for the code falcondriver.

    However, I was unable to get it to work where you suggested including it. Instead, I placed it in the prepare_post function in the function_post.php file. I also changed the error reporting to:

    
    $error_msg .= (!empty($error_msg)) ? '<br />' : "";
    $error_msg .= 'Error in posting: You are not allowed to post any websites here at the moment.';
    
    PHP:
    It does not seem to matter when the code segment is placed inside the function, I put it just before the "// Handle poll stuff" comment. If an error_msg is created, that function does not post the message. It returns the error to the user in the style of the site.
     
    clancey, Dec 6, 2006 IP