Advertisement
Guest User

Untitled

a guest
Jul 12th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.18 KB | None | 0 0
  1. <?php
  2. $debug_globalemails = get_db_column("SELECT * FROM debug WHERE id='1'", "active");
  3. $globalemails = implode($debug_globalemails, ",");
  4. $c = get_post_var("c");
  5.  
  6. //Nohing changed before this point
  7.  
  8. $users = array( //I need all these values to run the loop
  9.     "rick" => "chamb0",
  10.     "ross" => "Ross",
  11.     "john" => "john",
  12.     "simon" => "simon",
  13.     "codge" => "codge",
  14.     "alex" => "alex");
  15.    
  16. $emails = array( //These are needed for the emails part... T_T
  17.     "rick" => "rickychambo@gmail.com",
  18.     "ross" => "rosshurrell@gmail.com",
  19.     "john" => "john.martin117@googlemail.com",
  20.     "simon" => "simon.ansah@googlemail.com",
  21.     "codge" => "danielsmith1983ds@googlemail.com",
  22.     "alex" => "alex.sheekey@gmail.com");
  23. /*
  24. Loop through the users and the databases
  25. Note the dynamic variable name created like this: $n="name" $$n
  26. Now we have a variable called $name
  27. The {} brackets used basically evaluates the content to create the name ${$n.$n.'boobs'} would be $namenameboobs
  28. */
  29.  
  30. //First batch
  31. foreach($users as $db => $u) {
  32.     ${'comment_'.$db.'_db'}= get_db_column("SELECT * FROM comments WHERE torrent=$id AND user=\"$u\" OR torrent=$id AND user=\"$u\" Limit 1", "user");
  33.     ${'comment_'.$db} = implode(${'comment_'.$db.'_db'});
  34. }
  35.  
  36. //Second batch
  37. if(($globalemails=="On") && isset($c['comment'])) {
  38.     if($_POST['emailall'] == "yes"){
  39.         $everyone_email = implode(", ",$emails).", actionboll@gmail.com"; //Just collapse the email array and add mine >_>
  40.     } else {
  41.         foreach($users as $db => $u) { //Same loop as before
  42.             //strtolower needed due to all the oddities, also below as the variable now is chamb0 and not Chamb0 or rick... confusion!
  43.             if(strtolower($username)==strtolower($u)||strtolower($newspost['username'])==strtolower($u)||strtolower(${'comment_'.$db})==strtolower($u)) {
  44.                 ${strtolower($u).'_email'} = $email[$db].', ';
  45.             }
  46.         }
  47.     }
  48.    
  49. //Nothing changed beyond this point
  50.  
  51.  $to = $chamb0_email.$ross_email.$john_email.$simon_email.$codge_email.$alex_email.$everyone_email;
  52.  $subject = "Comment added: ".$news_post['title'];
  53.  $body = $username.": ".$c['comment'];
  54.  $headers = "From: chamb0.com<deluge@chamb0.com>\r\n" .
  55.      "X-Mailer: php";
  56.  mail($to, $subject, $body, $headers);
  57. }
  58.  
  59. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement