Smilies limit in the post

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

    Smilies limit in the post

    How to restrict to the post in the topic, only type 2 Smile? I am tried with this function, which is in the [ if (nose>2) ]in chat.php, but not work ..Is there any idea how to do this? Here's how I tried ..
    else if($action=="post")
    {
    if (istrashed(getuid_sid($sid))){

    echo "<card id=\"main\" title=\"HAPPY\">";
    echo "<p align=\"center\">";
    echo "Blokada pisanja od strane moderatora!<br/><br/>";
    echo "<a href=\"index.php?action=main&amp;sid=$sid\">HAPPY</a>";
    echo "</p>";
    echo "</card>";
    echo "</wml>";
    exit();

    }

    $tid = $_POST["tid"];
    $tfid = mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id='".$tid."'"));
    if(!canaccess(getuid_sid($sid), $tfid[0]))
    {
    echo "<card id=\"main\" title=\"HAPPY\">";
    echo "<p align=\"center\">";
    echo "Nemate saglasnost da vidite ovaj Forum!<br/><br/>";
    echo "<a href=\"index.php?action=main&amp;sid=$sid\">HAPPY</a>";
    echo "</p>";
    echo "</card>";
    echo "</wml>";
    exit();
    }
    $reptxt = $_POST["reptxt"];
    $qut = $_POST["qut"];
    addonline(getuid_sid($sid),"<b>Replika</b>","");
    echo "<card id=\"main\" title=\"HAPPY Forum\">";
    echo "<p align=\"center\">";
    $crdate = time();
    $fid = getfid($tid);
    //$uid = getuid_sid($sid);
    $res = false;
    $closed = mysql_fetch_array(mysql_query("SELECT closed FROM ibwf_topics WHERE id='".$tid."'"));
    $postinfo = $reptxt;
    $number = strlen($postinfo);

    if(($closed[0]!='1')||(ismod($uid)))
    {

    $lpost = mysql_fetch_array(mysql_query("SELECT dtpost FROM ibwf_posts WHERE uid='".$uid."' ORDER BY dtpost DESC LIMIT 1"));
    global $post_af;
    $antiflood = time()-$lpost[0];
    if($antiflood>$post_af)
    {
    if(trim($reptxt)!="")
    {
    $res = mysql_query("INSERT INTO ibwf_posts SET text='".$reptxt."', tid='".$tid."', uid='".$uid."', dtpost='".$crdate."', quote='".$qut."'");
    }

    if($res)
    {
    if($nos>2){

    $usts = mysql_fetch_array(mysql_query("SELECT posts, plusses FROM ibwf_users WHERE id='".$uid."'"));
    $ups = $usts[0]+1;
    $upl = $usts[1]+1;
    mysql_query("UPDATE ibwf_users SET posts='".$ups."', plusses='".$upl."' WHERE id='".$uid."'");
    mysql_query("UPDATE ibwf_topics SET lastpost='".$crdate."' WHERE id='".$tid."'");

    $unop = mysql_fetch_array(mysql_query("SELECT posts FROM ibwf_users WHERE id='".$uid."'"));

    $chs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline"));
    echo " <center> <a href=\"chat.php?rid=100&amp;sid=$sid\">HAPPY KVIZ</a>($chs[0])<br/><br/></center>";

    echo "Prisutni su : <a href=\"index.php?action=online&amp;sid=$sid\">".ge tnumonline()."</a><br/>";



    echo "<img src=\"http://coding-talk.com/images/ok.gif\" alt=\"O\"/> <br/>Uspešno ste upisali vaš <b>$unop[0]</b>. Komentar";
    echo "<br/><br/><a href=\"index.php?action=viewtpc&amp;sid=$sid&amp;t id=$tid&amp;go=last\">";
    echo "Pogledaj temu</a>";
    else{
    $nos = substr_count($text,"<img src=");
    echo "<img src=\"http://coding-talk.com/images/notok.gif\" alt=\"X\"/><b> Forum sistem: Dozvoljeno je samo 2 smajlija po poruci</b>";
    }


    }else{
    echo "<img src=\"http://coding-talk.com/images/notok.gif\" alt=\"X\"/>Nemoguce postovati poruku!";
    }
    }

    else{
    $af = $post_af -$antiflood;
    echo "<img src=\"http://coding-talk.com/images/notok.gif\" alt=\"X\"/>Antiflood Kontrola: $af";
    }
    }
    else{
    echo "<img src=\"http://coding-talk.com/images/notok.gif\" alt=\"X\"/>Tema zatvorena za pisanje!";
    }




    $fname = getfname($fid);
    echo "<br/><br/><a href=\"index.php?action=viewfrm&amp;sid=$sid&amp;f id=$fid\">";
    echo "$fname</a><br/>";
    echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"http://coding-talk.com/images/home.gif\" alt=\"*\"/>";
    echo "HAPPY</a>";
    echo "</p>";
    echo "</card>";

    }
    sigpichttp://happy.srecnica.com/web

    #2
    Code:
    else if($action=="post")
    {
    if (istrashed(getuid_sid($sid))){
    
    echo "<card id=\"main\" title=\"HAPPY\">";
    echo "<p align=\"center\">";
    echo "Blokada pisanja od strane moderatora!<br/><br/>";
    echo "<a href=\"index.php?action=main&amp;sid=$sid\">HAPPY</a>";
    echo "</p>";
    echo "</card>";
    echo "</wml>";
    exit();
    
    }
    
    $tid = $_POST["tid"];
    $tfid = mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id='".$tid."'"));
    if(!canaccess(getuid_sid($sid), $tfid[0]))
    {
    echo "<card id=\"main\" title=\"HAPPY\">";
    echo "<p align=\"center\">";
    echo "Nemate saglasnost da vidite ovaj Forum!<br/><br/>";
    echo "<a href=\"index.php?action=main&amp;sid=$sid\">HAPPY</a>";
    echo "</p>";
    echo "</card>";
    echo "</wml>";
    exit();
    }
    $reptxt = $_POST["reptxt"];
    $qut = $_POST["qut"];
    addonline(getuid_sid($sid),"<b>Replika</b>","");
    echo "<card id=\"main\" title=\"HAPPY Forum\">";
    echo "<p align=\"center\">";
    $crdate = time();
    $fid = getfid($tid);
    //$uid = getuid_sid($sid);
    $res = false;
    $closed = mysql_fetch_array(mysql_query("SELECT closed FROM ibwf_topics WHERE id='".$tid."'"));
    $postinfo = $reptxt;
    $number = strlen($postinfo);
    
    if(($closed[0]!='1')||(ismod($uid)))
    {
    
    $lpost = mysql_fetch_array(mysql_query("SELECT dtpost FROM ibwf_posts WHERE uid='".$uid."' ORDER BY dtpost DESC LIMIT 1"));
    global $post_af;
    $antiflood = time()-$lpost[0];
    if($antiflood>$post_af)
    {
    if(trim($reptxt)!="")
    {
    
    $nos = substr_count($reptxt,"<img src=");
    if($nos>2){
    echo "<img src=\"http://coding-talk.com/images/notok.gif\" alt=\"X\"/><b> Forum sistem: Dozvoljeno je samo 2 smajlija po poruci</b>";
    }else{
    $res = mysql_query("INSERT INTO ibwf_posts SET text='".$reptxt."', tid='".$tid."', uid='".$uid."', dtpost='".$crdate."', quote='".$qut."'");
    }
    }
    if($res)
    {
    
    
    $usts = mysql_fetch_array(mysql_query("SELECT posts, plusses FROM ibwf_users WHERE id='".$uid."'"));
    $ups = $usts[0]+1;
    $upl = $usts[1]+1;
    mysql_query("UPDATE ibwf_users SET posts='".$ups."', plusses='".$upl."' WHERE id='".$uid."'");
    mysql_query("UPDATE ibwf_topics SET lastpost='".$crdate."' WHERE id='".$tid."'");
    
    $unop = mysql_fetch_array(mysql_query("SELECT posts FROM ibwf_users WHERE id='".$uid."'"));
    
    $chs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline"));
    echo " <center> <a href=\"chat.php?rid=100&amp;sid=$sid\">HAPPY KVIZ</a>($chs[0])<br/><br/></center>";
    
    echo "Prisutni su : <a href=\"index.php?action=online&amp;sid=$sid\">".ge tnumonline()."</a><br/>";
    
    
    
    echo "<img src=\"http://coding-talk.com/images/ok.gif\" alt=\"O\"/> <br/>Uspešno ste upisali vaš <b>$unop[0]</b>. Komentar";
    echo "<br/><br/><a href=\"index.php?action=viewtpc&amp;sid=$sid&amp;t id=$tid&amp;go=last\">";
    echo "Pogledaj temu</a>";
    
    }else{
    echo "<img src=\"http://coding-talk.com/images/notok.gif\" alt=\"X\"/>Nemoguce postovati poruku!";
    }
    }
    
    else{
    $af = $post_af -$antiflood;
    echo "<img src=\"http://coding-talk.com/images/notok.gif\" alt=\"X\"/>Antiflood Kontrola: $af";
    }
    }
    else{
    echo "<img src=\"http://coding-talk.com/images/notok.gif\" alt=\"X\"/>Tema zatvorena za pisanje!";
    }
    
    
    
    
    $fname = getfname($fid);
    echo "<br/><br/><a href=\"index.php?action=viewfrm&amp;sid=$sid&amp;f id=$fid\">";
    echo "$fname</a><br/>";
    echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"http://coding-talk.com/images/home.gif\" alt=\"*\"/>";
    echo "HAPPY</a>";
    echo "</p>";
    echo "</card>";
    
    }
    something like this lol

    Comment


      #3
      Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/srecnica/domains/srecnica.com/public_html/happy/genproc.php on line 398
      sigpichttp://happy.srecnica.com/web

      Comment


        #4
        I settle parse Error, but this one does not work this code ... no limit smilies to 2
        sigpichttp://happy.srecnica.com/web

        Comment


          #5
          PHP Code:
          $postxt parsepm($reptxt,$sid);  
          $nrom substr_count($postxt,"<img src=");
              if(
          $nrom>2){
                echo 
          "<small>";
          echo 
          "Only two smilies per post!<br/><br/>";
          echo 
          "<a href=\"index.php?action=forum&amp;sid=$sid\">Forum</a><br/>";
          echo 
          "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a>";
          echo 
          "</small></p>";
          echo 
          "</card>";
          echo 
          "</wml>";
          exit();
              } 
          <?php unlink('World/Europe/Romania.country'); ?>

          Comment


            #6
            i0nutzxp yes !!!! this work, thank you very much!!!
            sigpichttp://happy.srecnica.com/web

            Comment


              #7
              Taken form chat.php

              Comment


                #8
                Originally posted by rukiya View Post
                Taken form chat.php
                yes but thei forget to transform the smiley code into image else no <img src= in the text msg .....
                <?php unlink('World/Europe/Romania.country'); ?>

                Comment


                  #9
                  Originally posted by i0nutzxp View Post
                  PHP Code:
                  $postxt parsepm($reptxt,$sid);  
                  $nrom substr_count($postxt,"<img src=");
                      if(
                  $nrom>2){
                        echo 
                  "<small>";
                  echo 
                  "Only two smilies per post!<br/><br/>";
                  echo 
                  "<a href=\"index.php?action=forum&amp;sid=$sid\">Forum</a><br/>";
                  echo 
                  "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a>";
                  echo 
                  "</small></p>";
                  echo 
                  "</card>";
                  echo 
                  "</wml>";
                  exit();
                      } 
                  Don't work shouts.... What's wrong?
                  $postxt = parsepm($reptxt,$sid);
                  $nrom = substr_count($postxt,"<img src=");

                  Comment


                    #10
                    Can be that hard to take a code from chat.php ? It is something like:
                    PHP Code:
                    if ($nosm>2)
                    {
                    echo 
                    "You can use max. 2 smilies";
                    }else{
                    POST CODE

                    Is so hard to do that?? If it is, post your $action=post and I will mod it for you :D
                    whatmp3.name - search mp3 on mobile

                    Comment


                      #11
                      i fink they can do it, just pass ur text thru parsepm() first b4 using d substr_count function.

                      Comment


                        #12
                        Originally posted by mazalo View Post
                        Don't work shouts.... What's wrong?

                        change $reptxt whit $shtxt
                        <?php unlink('World/Europe/Romania.country'); ?>

                        Comment


                          #13
                          Post the full $action="post" and I will help you ...
                          whatmp3.name - search mp3 on mobile

                          Comment


                            #14
                            $shtxt = parsepm($shtxt,$sid);
                            $nrom = substr_count($shtxt,"<img src=");
                            if($nrom>1){
                            echo "<card id=\"main\" title=\"Razglas\">";
                            echo "<p align=\"center\">";

                            echo "<small>";
                            echo "<b>Forum system:ยป<i>Allowed only one Smiley</i></b><br/>";

                            echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"http://coding-talk.com/images/home.gif\" alt=\"*\"/>";
                            echo "HAPPY</a>";
                            echo "</small></p>";
                            echo "</card>";
                            echo "</wml>";
                            exit();
                            }


                            change >>> $postxt = parsepm($reptxt,$sid);
                            $nrom = substr_count($postxt,"<img src="); <<< with >>>$shtxt = parsepm($shtxt,$sid);
                            $nrom = substr_count($shtxt,"<img src=");
                            Last edited by srecnica; 29.07.09, 11:00.
                            sigpichttp://happy.srecnica.com/web

                            Comment


                              #15
                              TNX Srecnice

                              Comment

                              Working...
                              X