######################################################## ## ## Hack Title: Mass Mail and Mass PM ## Hack Version: 1.0.0 ## Author: Christoph "Toxic" Hellings (toxic@freenet.de) ## Date Created: 09-12-02 ## Thread Location: http://www.tforumhacks.com/tforum/viewtopic.php?TopicID=1118 ## Working Example: ## Description: Adds a Mass Mail and a Mass PM function to admin area ## ## ## Installation Level: Easy ## Installation Time: 5 Minutes ## Files To Edit: 2 ## Edit Database: no ## Included Files: none ## ######################################################## ## ## Installation/Author Notes: ## ## I think it works but no warranty... ## UPDATING INSTRUCTIONS 1.0.0 -> 1.0.1 ## only add the following line at the top of adminfunctions.php ## set_time_limit(600); ## END OF UPDATING INSTRUCTIONS ## ######################################################## # #-----[ ACTION: BACKUP ]------------------------------------------ # Every time you edit your files, you should always back them up first. Although all of these hacks have been tested on various systems, they may not work with your configuration or you may not like what it does. Backing up protects yourself and your users from downtime. # #-----[ ACTION: OPEN ]------------------------------------------- # admin.php # #-----[ ACTION: FIND ]------------------------------------------- # Mass Delete
# #-----[ ACTION: ADD AFTER ]-------------------------------------- # Send Mass Mail/PM
# #-----[ ACTION: OPEN ]------------------------------------------- # adminfunctions.php # #-----[ ACTION: ADD ]-------------------------------------------- # function MassMail() { global $input,$Submit,$Subject,$fSettings,$CurrentUserPass; $CurrentUserInfo = GrabUserInfo($CurrentUserPass[UserName]); if ($Submit == "Send") { $input[posts2] = doubleval($input[posts2]); $input[postsperday2] = doubleval($input[postsperday2]); $input[daysreg2] = doubleval($input[daysreg2]); $input[daysin2] = doubleval($input[daysin2]); $input[level2] = doubleval($input[level2]); $query = "SELECT UserName,Email FROM t_users WHERE NumPost $input[posts] $input[posts2] AND (NumPost/CEILING(((".time()." - RegDate)/86400))) $input[postsperday] $input[postsperday2] AND CEILING(((".time()." - RegDate)/86400)) $input[daysreg] $input[daysreg2] AND CEILING(((".time()." - LastActive)/86400)) $input[daysin] $input[daysin2] AND UserLevel $input[level] $input[level2]"; $result = mysql_query($query); echo "Sending $input[type] to ". mysql_affected_rows() ." users:
"; while (list($name,$mail) = mysql_fetch_array($result)) { if ($input[type] == "pm") { echo $name."..."; $query = "INSERT INTO t_pm (Subject, FromUser, ToUser, Message, Date) VALUES('".addslashes($Subject)."', '".addslashes($CurrentUserInfo[UserName])."', '".addslashes($name)."', '".addslashes($input[message])."', ".time().")"; $result2 = mysql_query($query); if ($result) echo "done
"; else echo "failed
"; } else if ($input[type] == "mail") { mail ($mail, stripslashes($Subject), stripslashes($input[message]), "From:$input[from]"); } } } else {?> tForum Administration Area
Message:
Type
From (only if
you chose Mail)
Subject
Message
Send to all users with: (Settings are connected with "AND"; Use "more" and "-1" for all users.)
Total Posts
Posts Per Day
Days Registered
Days Inactive
User Level
Remember that admin is the lowest user level (1) and junior the highest (5). And if you defined your own levels they are perhaps even bigger. (100 and more)