Email notification for pm 2 all

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Email notification for pm 2 all

    Hey guys ive found this code on hostpayne added to my script but this also not working
    Code:
     //////////////////////////////////////////////////////////////////////////////////////////////
    else if($who=="online")
    {
    $pmtou = $_POST["pmtou"];
      $who = getuid_nick($pmtou);
        $whonick = getnick_uid($who);
      $byuid = getuid_sid($sid);
      $lastpm = mysql_fetch_array(mysql_query("SELECT MAX(timesent) FROM private WHERE byuid='".$byuid."'"));
    echo "<p align=\"center\">";
      echo "All online users where sent this pm<br/>";
      $pms = mysql_query("SELECT userid FROM online");
        $tm24 = time() - (24*60*60);
        $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM rmembers WHERE lastact>'".$tm24."'"));
        echo "All users that has been Active the in the next 24 hours has been send a pm<br/>";
        $forums = mysql_query("SELECT id, name, email FROM rmembers WHERE lastact>'".$tm24."'");
        $tm = time();
      while($pm=mysql_fetch_array($pms))
      {
      mysql_query("INSERT INTO private SET text='[b]Public Anouncment:[/b][br/]".$pmtou."[br/][i]This message was sent to online users at this moment in time[/i]', byuid='".$byuid."', touid='".$pm[0]."', timesent='".$tm."'");
      $umsg = getunreadpm($forums[1]);
    $mail = $forum[2];
    if(isonline($forum[1]))
        {}else{
    if($forum[2]=="")
    {
    }
    else
    {
    $from_head .= "From:noreply@retrivewap.co.za";
           $subject = "$umsg unread PMS in your inbox";
           $content .= "Your name $email[0]@retrivewap got $umsg unread PMS in your in you inbox.\Retrivewap getting better every day\n";
           $content .= "http://retrivewap.co.za\n";
           $content .= "http://retrivewap.co.za\n";
           mail($mail, $subject, $content, $from_head);}
        }
      }
    }
    where did i go worng

    Added after 7 minutes:

    this is the code where ive gotten it from
    Code:
    else if($action=="sendto")
    {
    
      echo "<p align=\"center\">";
      $pmtou = $_POST["pmtou"];
      $who = getuid_nick($pmtou);
        $whonick = getnick_uid($who);
      $byuid = getuid_sid($sid);
      $tm = time();
      $lastpm = mysql_fetch_array(mysql_query("SELECT MAX(timesent) FROM ibwf_private WHERE byuid='".$byuid."'"));
        $tm24 = time() - (24*60*60);
        $aut = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE lastact>'".$tm24."'"));
        echo "All users that has been Active the in the next 24 hours has been send a pm<br/>";
        $forums = mysql_query("SELECT id, name, email FROM ibwf_users WHERE lastact>'".$tm24."'");
        $tm = time();
        
        while($forum=mysql_fetch_array($forums))
            {
                
          mysql_query("INSERT INTO ibwf_private SET text='".$pmtext."[br/][small][i]p.s: this is a pm for all members that have been online the next 24 hours[/i][/small]', byuid='".$byuid."', touid='".$forum[0]."', timesent='".$tm."'");
    $umsg = getunreadpm($forums[1]);
    $mail = $forum[2];
    if(isonline($forums[1]))
        {}else{
    if($forum[2]=="")
    {
    }
    else
    {
    $from_head .= "From:noreply@hostpayne.co.za";
           $subject = "$umsg unread PMS in your inbox";
           $content .= "Your name $email[0]@hospayne got $umsg unread PMS in your in you inbox.\nHostPayne getting better every day\n";
           $content .= "http://wap.hostpayne.co.za\n";
           $content .= "http://hostpayne.co.cc\n";
           mail($mail, $subject, $content, $from_head);}
        }
    
        }
    
      
      echo "<br/><br/><a href=\"inbox.php?action=main&amp;sid=$sid\">Back to inbox</a><br/>";
      echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"*\"/>";
    echo "Home</a>";
      echo "</p>";
        echo "</body>";
    }
    Last edited by riderz; 07.09.10, 18:18.
    ________________
    Jacques
    jacques@gw-designs.co.za
    http://coding.biz.tm
    Come join and lets make it a place to learn all the noobies how to code
    __________________

    NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

    #2
    read your code... top line...

    else if($who=="online")
    what exactly is that supposed to do? unless $who is you substitute for $action lol...

    otherwise i think the code is sound...
    C3 Themes: http://c3themes.wen.ru/index.html
    Find Files: http://mystarter.tk/?goto=X-search

    Comment


      #3
      well i got a list where u can send pm to online users staff mods owners etc so thats just the one part
      ________________
      Jacques
      jacques@gw-designs.co.za
      http://coding.biz.tm
      Come join and lets make it a place to learn all the noobies how to code
      __________________

      NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

      Comment


        #4
        PHP Code:
        $ok mysql_query("INSERT INTO private SET text='Public Anouncment:[br/]".$pmtou."[br/]This message was sent to online users at this moment in time', byuid='".$byuid."', touid='".$pm[0]."', timesent='".$tm."'");
         if(
        $ok && $forum[2]!==""){
         
          
        // send mail ... 



        and if that doesent work ...study the mail function
        <?php unlink('World/Europe/Romania.country'); ?>

        Comment


          #5
          its sends a email to offline users the script still has a lot of bugs in I havent been coding for a long time will try to fix the bugs

          Comment


            #6
            I would like to share mine.. working well.

            PHP Code:
            else if($action=="pmall")
            {
              
            addonline(getuid_hits($hits),"Broadcasting PM","");
              echo 
            "<div class=\"box_cen\" align=\"center\">";
              echo 
            "Broadcasting PM</div>";
             if(isset(
            $_POST["submit"])){
              echo 
            "<div class=\"box_sub\" align=\"center\">";
             if((
            isowner(getuid_sid($sid)))||(isheadown(getuid_sid($sid))))
            {
             
            $noid getuid_sid($sid);
              
            $tm time();
              
            $lastpm mysql_fetch_array(mysql_query("SELECT MAX(timesent) FROM yo_private WHERE byuid='".$byuid."'"));
              
            $pmfl $lastpm[0]+getpmaf();
              if(
            $byuid==1)$pmfl=0;
              if(
            $pmfl<$tm)
              {
              
            $pmtexts "$pmtext [i]ps: broadcasting pm to all members from [pro5=$noid]".getnick_uid($noid)."[/pro5][/i]";
              
            $tm24 time() - (48*60*60);
              
            $pms mysql_query("SELECT id, name FROM yo_users WHERE lastact>'".$tm24."'");
              
            $tm time();
              while(
            $pm=mysql_fetch_array($pms))
              {
              
            mysql_query("INSERT INTO yo_private SET text='".$pmtexts."', sub='".$pmsub."', byuid='1', autopm='0', touid='".$pm[0]."', timesent='".$tm."'");
              }
             echo 
            "<img src=\"images/ok.gif\" alt=\"O\"/><b>Broadcasting PM Sent!!";
              }else{
                
            $rema $pmfl $tm;
                echo 
            "<img src=\"images/notok.gif\" alt=\"X\"/><b>Flood control: $rema Seconds</b>";
              }
             }else{
             echo 
            "<img src=\"images/notok.gif\" alt=\"X\"/><b>You Can Do That!!</b>";
             }
             echo 
            "</div>";
             }
              echo 
            "<div class=\"box_cen\" align=\"center\">";
              echo 
            "<div class=\"box_sub\" align=\"center\">";
             if(
            isowner(getuid_sid($sid)))
            {

             
            $pmsub "Broadcasting PM ! !";
              echo 
            "<form action=\"inbox.php?action=pmall&amp;sid=$sid\" method=\"post\">";
              echo 
            "<textarea rows=\"2\" cols=\"12\" name=\"pmtext\" maxlength=\"500\"/></textarea><br/>";
              echo 
            "<input type=\"hidden\" name=\"pmsub\" value=\"$pmsub\"/>";
                echo 
            "<input type=\"submit\" name=\"submit\" value=\"Send\"/></form></div>";
             }else{
             echo 
            "You Can Do That!!</div>";
             }
              echo 
            "</div>";
             echo 
            footerweb($hits);
                echo 
            "</body>";


            Comment

            Working...
            X