########################################################################################### #This script disables anyone from entering text that includes "http(s)" or "www" into a post if their account is under 30 days old. Sorry, I don't know fancy regex :P # # Website: usebbzone.com # Author: Melissa # File Edits: 5 ########################################################################################### #******************************** #Open sources/functions.php #******************************** @@@@@@@ FIND @@@@@@@ /** * Generate a date given a timestamp @@@@@@@@@@@ ABOVE add @@@@@@@@@@@ /** * Disallows anyone who registered under 30 days to post a link */ function kill_links($content) { global $session, $db; $allow = true; $user_id = $session->sess_info['user_id']; //get registration date $result = $db->query("SELECT regdate FROM ".TABLE_PREFIX."members WHERE id = ".$user_id); $regdate = $db->fetch_result($result); $regdate = $regdate['regdate']; //get last months $lastmonth = mktime(0, 0, 0, date("m")-1, date("d"), date("Y")); //check the content for URLs if (stristr($content, 'http') || stristr($content, 'www') || stristr($content, 'https')) { if ( $regdate < $lastmonth ) { $allow = true; } else { $allow = false; } } return $allow; } #**************************** #OPEN langues/lang_XX.php #**************************** @@@@@ FIND @@@@@ kill_links($_POST['signature']) === TRUE ) ) @@@@@ FIND @@@@@ } elseif ( $email_banned ) { $template->parse('msgbox', 'global', array( 'box_title' => $lang['Note'], 'content' => sprintf($lang['BannedEmail'], $_POST['email']) )); } @@@@@@@@@@ BELOW add @@@@@@@@@@ if ( $functions->kill_links($_POST['signature']) === FALSE ) { $template->parse('msgbox', 'global', array( 'box_title' => $lang['30Days'], 'content' => $lang['30DaysExplained'] )); } #*********************** # The next edits can be done on the following files, the edits/locations remain the same: # --- # sources/post_reply.php # sources/post_topic.php #************************ @@@@@@ FIND @@@@@@ && empty($_POST['preview']) && $flood_protect_wait_sec <= 0 @@@@@@@@@@@ AFTER add @@@@@@@@@@@ && ($functions->kill_links($_POST['content']) === TRUE ) @@@@@@ FIND @@@@@@ if ( count($errors) ) { $template->parse('msgbox', 'global', array( 'box_title' => $lang['Error'], 'content' => sprintf($lang['MissingFields'], join(', ', $errors)) )); } @@@@@@@@@@@@ BELOW add @@@@@@@@@@@@ if ( $functions->kill_links($_POST['content']) === FALSE ) { $template->parse('msgbox', 'global', array( 'box_title' => $lang['30Days'], 'content' => $lang['30DaysExplained'] )); } #**** DONE! #****