Pm 2 all

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

    Pm 2 all

    Here are a xhtml pm2all i just fast made
    create a file pm2all and add the following
    PHP Code:
     <?php
    include("config.php");
    include("core.php");
    //include("xhtmlfunctions.php");
    //include("chkisdn.inc.php");
    echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
    echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
    
    ?>
    
    <body>
    <?php
    $bcon = connectdb();
    $uid = getuid_sid($sid);
    $lang = mysql_fetch_array(mysql_query("SELECT lang FROM ibwf_users WHERE id='".$uid."'"));
    include("language.php");
    if (!$bcon)
    {
            echo "<p align=\"center\">";
        echo "<img src=\"http://coding-talk.com/images/exit.gif\" alt=\"*\"/><br/>";
        echo "ERROR! cannot connect to database<br/><br/>";
        echo "This error happens usually when backing up the database, please be patient, The site will be up any minute<br/><br/>";
        echo "<b>THANK YOU VERY MUCH</b>";
        echo "</p>";
    echo "</font></body>";
    echo "</html>";
          exit();
    }
    $brws = explode("/",$_SERVER['HTTP_USER_AGENT']);
    $ubr = $brws[0];
    $uip = getip();
    $action = $_GET["action"];
    $sid = $_GET["sid"];
    $page = $_GET["page"];
    $who = $_GET["who"];
    cleardata();
    if(isipbanned($uip,$ubr))
        {
          if(!isshield(getuid_sid($sid)))
          {
          boxstart("Error!");
    
          echo "<p align=\"center\">";
          echo "<img src=\"http://coding-talk.com/images/notok.gif\" alt=\"x\"/><br/>";
          echo "This IP address is blocked<br/>";
          echo "<br/>";
          echo "How ever we grant a shield against IP-Ban for our great users, you can try to see if you are shielded by trying to log-in, if you kept coming to this page that means you are not shielded, so come back when the ip-ban period is over<br/><br/>";
          $banto = mysql_fetch_array(mysql_query("SELECT  timeto FROM ibwf_metpenaltiespl WHERE  penalty='2' AND ipadd='".$uip."' AND browserm='".$ubr."' LIMIT 1 "));
          //echo mysql_error();
          $remain =  $banto[0] - (time() - $timeadjust) ;
          $rmsg = gettimemsg($remain);
          echo "Time to unblock the IP: $rmsg<br/><br/>";
    
          echo "</p>";
          echo "<p>";
      echo "<form action=\"login.php\" method=\"get\">";
      echo "Username:<br/> <input name=\"loguid\" format=\"*x\" size=\"8\" maxlength=\"30\"/><br/>";
      echo "Password:<br/> <input type=\"password\" name=\"logpwd\" size=\"8\" maxlength=\"30\"/><br/>";
    echo "<input type=\"submit\" value=\"Login\"/>";
    echo "</form>";
      echo "</p>";
            boxend();
          exit();
          }
        }
    if(($action != "") && ($action!="terms"))
    {
        $uid = getuid_sid($sid);
        if((islogged($sid)==false)||($uid==0))
        {
        boxstart("Error!");
    
          echo "<p align=\"center\">";
          echo "You are not logged in<br/>";
          echo "Or Your session has been expired<br/><br/>";
          echo "<a href=\"index.php\">Login</a>";
          echo "</p>";
    boxend();
    echo "</font></body></html>";
          exit();
        }
    
    
    
    }
    //echo isbanned($uid);
    if(isbanned($uid))
        {
          $pstyle = gettheme($sid);
    
          echo "<p align=\"center\">";
          echo "<img src=\"http://coding-talk.com/images/notok.gif\" alt=\"x\"/><br/>";
          echo "You are <b>Banned</b><br/>";
          $banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_metpenaltiespl WHERE uid='".$uid."' AND penalty='1'"));
              $banres = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$uid."'"));
    
          $remain = $banto[0]- (time() - $timeadjust) ;
          $rmsg = gettimemsg($remain);
          echo "Time to finish your penalty: $rmsg<br/><br/>";
              echo "Ban Reason: $banres[0]";
          //echo "<a href=\"index.php\">Login</a>";
          echo "</p>";
      echo xhtmlfoot();
          exit();
        }
    $res = mysql_query("UPDATE ibwf_users SET browserm='".$ubr."', ipadd='".$uip."' WHERE id='".getuid_sid($sid)."'");
    
        if(!isowner(getuid_sid($sid)))
      {
       }
    ////////////////////////////////////////////////////
       if($action=="main")
    {
        addonline(getuid_sid($sid),"pm2all - xHTML","");
    
     echo "<p align=\"center\">";
        echo "<form action=\"pm2all.php?action=global&amp;sid=$sid\" method=\"post\">";
      echo "PM:<input name=\"pmtou\" maxlength=\"250\"/><br/>";
      echo "TO:<select name=\"who\">";
      echo "<option value=\"staff\">staff</option>";
      echo "<option value=\"all\">all members</option>";
      echo "</select><br/>";
      echo "<input type=\"submit\" value=\"Update\"/>";
      echo "</form>";
    
    
    
    
            /////////main menu footer
    echo "<div class=\"footer\"><center><small>";
            echo "5.<a href=\"index.php?action=online&amp;sid=$sid\" accesskey=\"5\">Online Users(".getnumonline().")</a> |";
             echo "<a href=\"index.php?action=main&amp;sid=$sid\">Main Menu</a> <br/>";
             echo "<a href=\"index.php?action=chbmsg&amp;sid=$sid\">Set Mood</a> |";
                 echo "<a href=\"index.php?action=stats&amp;sid=$sid\">Site Stats</a><br/>";
                   echo "<a href=\"index.php?action=logout&amp;sid=$sid\">Log out</a><br/>";
    
    echo "<b>© copyright 2009 ©</b><br/>www.WapLive.co.za<br/>";
               echo "</small></center></div>";
    
    
     }
    /////////////////////////////////////////////
      else if($action=="global")
    {
     addonline(getuid_sid($sid),"pm2all - xHTML","");
    
     echo "<p align=\"center\">";
    $who = $_POST["who"];
    $pmtou = $_POST["pmtou"];
    $byuid = getuid_sid($sid);
    
    $tm = time();
    if($who=="all"){
    $lastpm = mysql_fetch_array(mysql_query("SELECT MAX(timesent) FROM ibwf_private WHERE byuid='".$byuid."'"));
    echo "All users has been send a pm<br/>";
    $pms = mysql_query("SELECT id, name FROM ibwf_users WHERE lastact>'".$tm24."'");
    $tm = time();
    while($pm=mysql_fetch_array($pms))
    {
    mysql_query("INSERT INTO ibwf_private SET text='Public Anouncment:[br/]".$pmtou."[br/]This message was sent to all the members', byuid='".$byuid."', touid='".$pm[0]."', timesent='".$tm."'");
    }
    }else if($who=="staff"){
    $lastpm = mysql_fetch_array(mysql_query("SELECT MAX(timesent) FROM ibwf_private WHERE byuid='".$byuid."'"));
    echo "All users has been send a pm<br/>";
    $pms = mysql_query("SELECT id, name FROM ibwf_users WHERE perm>0");
    $tm = time();
    while($pm=mysql_fetch_array($pms))
    {
    mysql_query("INSERT INTO ibwf_private SET text='Staff Anouncment:[br/]".$pmtou."[br/]This message was sent to all staff', byuid='".$byuid."', touid='".$pm[0]."', timesent='".$tm."'");
    }
    }
             /////////main menu footer
    echo "<div class=\"footer\"><center><small>";
            echo "5.<a href=\"index.php?action=online&amp;sid=$sid\" accesskey=\"5\">Online Users(".getnumonline().")</a> |";
         echo "<a href=\"index.php?action=main&amp;sid=$sid\">Main Menu</a> <br/>";
             echo "<a href=\"index.php?action=chbmsg&amp;sid=$sid\">Set Mood</a> |";
                 echo "<a href=\"index.php?action=stats&amp;sid=$sid\">Site Stats</a><br/>";
                   echo "<a href=\"index.php?action=logout&amp;sid=$sid\">Log out</a><br/>";
    
    echo "<b>© copyright 2009 ©</b><br/>www.WapLive.co.za<br/>";
               echo "</small></center></div>";
    
    
    
    
    }
    ?>
    i dnt know if there are a error here if so please just correct it

    #2
    hey who can help me normal users can view this file i must edit it that owners only can view this page

    Comment


      #3
      got it right i just added this in the file

      if(!isowner(getuid_sid($sid)))
      {

      echo "<p align=\"center\">";
      echo "You are not an admin<br/>";
      echo "<br/>";
      echo "<a href=\"index.php\">Home</a>";
      echo "</p>";
      exit();
      }

      Comment


        #4
        The best way to send PM to all members:
        Code:
        INSERT INTO pms('from', 'uid', 'msg') SELECT uid, @msg := 'Hello' AS msg, @from := 'Admin' AS `from` FROM users

        Comment

        Working...
        X