Email Notification

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

    Email Notification

    Hey guys im trying to get a code to work i want to add email notification to my inbox but i dont get it to send a email when i receive a new msg on site

    i dont know if i done it right or if i placed it on the right place

    Code:
    ////////////////////////////////////////UNREADED PMs
     if($action=="folderunread")
    {
      addonline(getuid_sid($sid),"UnRead PMs - xHTML:v3","");
       
      $tolog = false;
        $view = $_GET["view"];
        //////ALL LISTS SCRIPT <<
        if($view=="")$view="all";
        if($page=="" || $page<=0)$page=1;
        $myid = getuid_sid($sid);
        $doit=false;
        $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM redo_private WHERE touid='".$uid."' AND unread='1'"));
        $num_items = $noi[0]; //changable
        $items_per_page= 10;
        $num_pages = ceil($num_items/$items_per_page);
        if($page>$num_pages)$page= $num_pages;
        $limit_start = ($page-1)*$items_per_page;
        if($num_items>0)
        {
          if($doit)
          {
            $exp = "&amp;rwho=$myid";
          }else
          {
            $exp = "";
          }
        //changable sql
    
        $sql = "SELECT
                a.name, b.id, b.byuid, b.unread, b.starred, title FROM redo_users a
                INNER JOIN redo_private b ON a.id = b.byuid
                WHERE b.touid='".$myid."' AND b.unread='1'
                ORDER BY b.timesent DESC
                LIMIT $limit_start, $items_per_page ";  
                
                	echo " <div class=\"head\">";	
    			echo "<center>UnRead Messages:</center></div>";
    	
    					    $items = mysql_query($sql);
    					    echo mysql_error();
    					    while ($item = mysql_fetch_array($items))
    					    {
    					      if($item[3]=="1")
    					      {
    					        $iml = "<img src=\"../images/npm.gif\" alt=\"+\"/>";
    					      }else{
    					        if($item[4]=="1")
    					        {
    					            $iml = "<img src=\"../images/spm.gif\" alt=\"*\"/>";
    					        }else{
    					
    					        $iml = "<img src=\"../images/opm.gif\" alt=\"-\"/>";
    					        }
    					      }
    					      
    					      $lnk = "<a href=\"../inbox/readpm.php?action=readpm&amp;pmid=$item[1]&amp;sid=$sid\">$iml $item[0]</a>";
    					      echo "$lnk: $item[5]<br/>";
    					    }
        			
        echo "<p><center>";    
        $npage = $page+1;
        if($page>1)
        {
          $ppage = $page-1;
          echo "<a href=\"../inbox/folderunread.php?action=folderunread&amp;page=$ppage&amp;sid=$sid&amp;view=$view$exp\"><small>&#171; Prev</small></a> ";
        }
        echo "<small> $page/$num_pages </small>";
        if($page<$num_pages)
        {
          $npage = $page+1;
          echo "<a href=\"..inbox/folderunread.php?action=folderunread&amp;page=$npage&amp;sid=$sid&amp;view=$view$exp\"><small>Next &#187;</small></a>";
        }
        if($num_pages>2)
        {
    	    $rets = "<form action=\"../inbox/index.php\" method=\"get\">";
            $rets .= "Jump to page:<input name=\"page\" format=\"*N\" size=\"3\"/><br/>";
    	    $rets .= "<input type=\"submit\" value=\"GO\"/>";
            $rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
            $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";         
            $rets .= "<input type=\"hidden\" name=\"view\" value=\"$view\"/>";
            $rets .= "</form>";
            echo $rets;
        }    
         echo "</center></p>";
    $tolog = true;   
     }
    if($tolog)
    {
    
    $msg = "\n Username: ".$uid." You received a message on".$sitename."";
    
    $subj = "Registration details for ".$sitename."";
    $headers = 'From: noreply@MyBook' . "\r\n" .
    
    'Reply-To: noreply@MyBook' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();
    mail($email, $subj, $msg, $headers);
    
    echo "<a href=\"redo.biz.tm\">Take me there now</a>";
    
    }
    else{
          echo "<p align=\"center\">";
          echo "You have no Private Messages<br/>";
          echo "</p>";
        }
      ////// UNTILL HERE >>
    
      echo "<p>";
      echo "<a href=\"../home/index.php?action=main&amp;sid=$sid\">Home</a>";
      echo " &#62; ";
      echo "<a href=\"../inbox/index.php?action=main&amp;sid=$sid\">Inbox</a>";
      echo " &#62; ";
      echo "UnRead PMs";
      echo "</p>";  
    
    }
    ________________
    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
    re

    try putting it in sendpm code mate thats why

    like this

    PHP Code:
    $res mysql_query("INSERT INTO ibwf_private SET text='".$pmtext."', byuid='".$byuid."', touid='".$who."', timesent='".$tm."'");
    }

     }else{
        
    $res true;
      }
      if(
    $res)
      {
          
    //Check if the user we are pming has their email alerts enabled
          
    $emlon=mysql_fetch_array(mysql_query("SELECT emlalerton,email FROM ibwf_users WHERE id='".$who."'"));
          if(
    $emlon[0]==1)
          {
              if(
    isonline($who))
              {
              }else{

            
    $email=$emlon[1];
            
    $bynick=getnick_uid($byuid);
      
    $from_head "From: noreply@$sitename";
      
    $subject "$sitename New PM Recieved From $bynick";
      
    $content "You Have Recieved a New PM From User $bynick.\n";
      
    $content .= "Please Visit The Site To Read the Message\n\n";
      
    $content .= "$sitename Visit The Site\n\n";
      
    $content .= "$sitename: The best wap community!";
      
    mail($email$subject$content$from_head);
    }
    }
        echo 
    "<img src=\"images/ok.gif\" alt=\"O\"/>";
        echo 
    "PM was sent successfully to $whonick<br/><br/>";
        echo 
    parsepm($pmtext$sid);

      }else{
        echo 
    "<img src=\"images/notok.gif\" alt=\"X\"/>";
        echo 
    "Can't Send PM to $whonick<br/><br/>";
      }
      }else{
        
    $bantime time() + (30*24*60*60);
        echo 
    "<img src=\"images/notok.gif\" alt=\"X\"/>";
        echo 
    "Can't Send PM to $whonick<br/><br/>";
        echo 
    "You just sent a link to one of the crapiest sites on earth<br/> The members of these sites spam here a lot, so go to that site and stay there if you don't like it here<br/> as a result of your stupid action:<br/>1. you have lost your sheild<br/>2. you have lost all your Plusses<br/>3. You are BANNED!";
        
    mysql_query("INSERT INTO ibwf_penalties SET uid='".$byuid."', penalty='1', exid='1', timeto='".$bantime."', pnreas='Banned: Automatic Ban for spamming for a crap site'");
        
    mysql_query("UPDATE ibwf_users SET plusses='0', shield='0' WHERE id='".$byuid."'");
        
    mysql_query("INSERT INTO ibwf_private SET text='".$pmtext."', byuid='".$byuid."', touid='2', timesent='".$tm."'");
      }
      }else{
        
    $rema $pmfl $tm;
        echo 
    "<img src=\"images/notok.gif\" alt=\"X\"/>";
        echo 
    "Flood control: $rema Seconds<br/><br/>";
      }
     
      echo 
    "<a accesskey=\"9\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
    echo 
    "[9] Home</a>";
      echo 
    "</p>"









    Dont Ask Me Dumb Questions.Or you'l get a Dumb Answer..
    Want A Profesional Logo or Theme For Your wap site Pm Me.If I Have The Time Ill Make It For Free

    Comment

    Working...
    X