Pluses In Every Action

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

    Pluses In Every Action

    how to make a coding that user can get pluses or credit in every action such as adding polls, blogs, delete pm and others action..how?

    #2
    Use somethng like this in every action
    Code:
    $uipa = $uipa+1;
    $uip = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$uid."'"));
    $uip = $uipa + $uip[0];
    mysql_query("UPDATE ibwf_users SET plusses='".$uip."' WHERE id='".$uid."'");

    Comment


      #3
      where must i put that code?


      else if($action=="newtopic")
      {
      $fid = $_GET["fid"];
      if(!canaccess(getuid_sid($sid), $fid)) <------here?
      {
      echo "<card id=\"main\" title=\"$sitename\">"; <------here?
      echo "<p align=\"center\">";
      echo "You Don&#39;t Have A Permission To View The Contents Of This Forum

      ";
      echo "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a>";
      echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
      }
      addonline(getuid_sid($sid),"Creating new topic","index.php?action=online");
      echo "<card id=\"main\" title=\"New Topic\">";
      echo "<p align=\"center\">";
      echo "Title:<input name=\"ntitle\" maxlength=\"30\"/>
      ";
      echo "Text:<input name=\"tpctxt\" maxlength=\"500\"/>
      ";
      echo "<anchor>Create";
      echo "
      <go href=\"genproc.php?action=newtopic&amp;sid=$sid\" method=\"post\">
      <postfield name=\"fid\" value=\"$fid\"/>
      <postfield name=\"ntitle\" value=\"$(ntitle)\"/>
      <postfield name=\"tpctxt\" value=\"$(tpctxt)\"/>
      </go>
      ";
      echo "</anchor>";
      echo "

      <a href=\"index.php?action=viewfrm&amp;sid=$sid&amp;f id=$fid\">";
      $fname = getfname($fid);
      echo "$fname</a>
      ";
      echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"*\"/>";
      echo "Home</a>";

      echo "</p>";
      echo "</card>";
      }


      where?

      Comment


        #4
        Code:
        addonline(getuid_sid($sid),"Creating new topic","index.php?action=online");
        echo "<card id=\"main\" title=\"New Topic\">";
        echo "<p align=\"center\">";
        if(getplusses(getuid_sid($sid))<20)
        {
          echo "
        You need at least 20 plusses to create a topic!
        ";
          }
        else{
        
        echo "Title:<input name=\"ntitle\" maxlength=\"30\"/>
        ";
        echo "Text:<input name=\"tpctxt\" maxlength=\"500\"/>
        ";
        echo "<anchor>Create";
        echo "
        <go href=\"genproc.php?action=newtopic&amp;sid=$sid\" method=\"post\">
        <postfield name=\"fid\" value=\"$fid\"/>
        <postfield name=\"ntitle\" value=\"$(ntitle)\"/>
        <postfield name=\"tpctxt\" value=\"$(tpctxt)\"/>
        </go>
        ";
        echo "</anchor>";
        }

        Comment


          #5
          that help me nothing rukia..ur reply r not related to my post..im asking how to give user pluses in every action..white warrior have give me the code but i dont know where to place the code n i use create new topic action as example..but i want to know where i must put the code that white warrior give to me??

          Comment


            #6
            check in genproc.php not in index.php

            Comment


              #7
              ok this is the sample from my genproc.php.where must i put the code?


              else if($action=="post")
              {
              $tid = $_POST["tid"];
              $tfid = mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id=&#39;".$tid."&#39;"));
              <------here?------>
              if(!canaccess(getuid_sid($sid), $tfid[0]))
              {
              echo "<head>";
              echo "<title>$sitename</title>";
              echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
              echo "</head>";
              echo "<body>";
              echo "<p align=\"center\">";
              echo "You Don&#39;t Have A Permission To View The Contents Of This Forum

              ";
              echo "0 <a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
              echo "</p>";
              echo "</body>";
              echo "</html>";
              exit();
              }
              <------here?------>
              $reptxt = $_POST["reptxt"];
              $qut = $_POST["qut"];
              addonline(getuid_sid($sid),"Posted A reply","");
              echo "<head>";
              echo "<title>$sitename</title>";
              echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
              echo "</head>";
              echo "<body>";
              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=&#39;".$tid."&#39;"));

              if(($closed[0]!=&#39;1&#39;)||(ismod($uid)))
              {

              $lpost = mysql_fetch_array(mysql_query("SELECT dtpost FROM ibwf_posts WHERE uid=&#39;".$uid."&#39; ORDER BY dtpost DESC LIMIT 1"));
              global $post_af;
              $antiflood = time()-$lpost[0];
              if($antiflood>$post_af)
              {
              if(trim($reptxt)!="")
              {
              if(!isblocked($reptxt,$uid))
              {
              $res = mysql_query("INSERT INTO ibwf_posts SET text=&#39;".$reptxt."&#39;, tid=&#39;".$tid."&#39;, uid=&#39;".$uid."&#39;, dtpost=&#39;".$crdate."&#39;, quote=&#39;".$qut."&#39;");
              }else{
              $bantime = time() + (30*24*60*60);
              echo "<img src=\"../images/notok.gif\" alt=\"X\"/>";
              echo "Can&#39;t Post Reply

              ";
              echo "You just tried posting a reply with a link to one of the crapiest sites on earth
              The members of these sites spam here a lot, so go to that site and stay there if you don&#39;t like it here
              as a result of your stupid action:
              1. you have lost your sheild
              2. you have lost all your plusses
              3. You are BANNED!";
              $user = getnick_sid($sid);
              mysql_query("INSERT INTO ibwf_mlog SET action=&#39;autoban&#39;, details=&#39;Wap Desire auto banned $user for spamming forums&#39;, actdt=&#39;".time()."&#39;");
              mysql_query("INSERT INTO ibwf_penalties SET uid=&#39;".$uid."&#39;, penalty=&#39;1&#39;, exid=&#39;2&#39;, timeto=&#39;".$bantime."&#39;, pnreas=&#39;Banned: Automatic Ban for spamming for a crap site&#39;");
              mysql_query("UPDATE ibwf_users SET plusses=&#39;0&#39;, shield=&#39;0&#39; WHERE id=&#39;".$uid."&#39;");
              echo "</body>";
              echo "</html>";
              exit();
              }
              }
              if($res)
              {
              $usts = mysql_fetch_array(mysql_query("SELECT posts, plusses FROM ibwf_users WHERE id=&#39;".$uid."&#39;"));
              $res2 = mysql_fetch_array(mysql_query("SELECT name, authorid FROM ibwf_topics WHERE id=&#39;".$tid."&#39;"));
              $usr = getnick_uid($uid);
              $tname = htmlspecialchars($res2[0]);
              if(($res2[1]!=$uid)&&(automsgs($res2[1]))){
              $msg = "Your Topic $tname"." has been Replied to by $usr [br/][small]p.s: this is an automated pm[/small]";
              autopm($msg, $res2[1]);
              }
              $ups = $usts[0]+1;
              $upl = $usts[1]+1;
              mysql_query("UPDATE ibwf_users SET posts=&#39;".$ups."&#39;, plusses=&#39;".$upl."&#39; WHERE id=&#39;".$uid."&#39;");
              mysql_query("UPDATE ibwf_topics SET lastpost=&#39;".$crdate."&#39; WHERE id=&#39;".$tid."&#39;");
              echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Message Posted Successfully";
              echo "

              8 <a accesskey=\"8\" href=\"index.php?action=viewtpc&amp;sid=$sid&amp;t id=$tid&amp;go=last\">View Topic</a>";
              }else{
              echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Error Posting Message";
              }
              }else{
              $af = $post_af -$antiflood;
              echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Antiflood Control: $af";
              }
              }else{
              echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Topic is closed for posting";
              }

              $fname = getfname($fid);
              echo "

              9 <a accesskey=\"9\" href=\"index.php?action=viewfrm&amp;sid=$sid&amp;f id=$fid\">$fname</a>
              ";
              echo "0 <a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
              echo "</p>";
              echo "</body>";

              }

              where?

              Comment


                #8
                ok this is the sample from my genproc.php.where must i put the code?


                else if($action=="post")
                {
                $tid = $_POST["tid"];
                $tfid = mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id=&#39;".$tid."&#39;"));
                <------here?------>
                if(!canaccess(getuid_sid($sid), $tfid[0]))
                {
                echo "<head>";
                echo "<title>$sitename</title>";
                echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
                echo "</head>";
                echo "<body>";
                echo "<p align=\"center\">";
                echo "You Don&#39;t Have A Permission To View The Contents Of This Forum

                ";
                echo "0 <a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
                echo "</p>";
                echo "</body>";
                echo "</html>";
                exit();
                }
                <------here?------>
                $reptxt = $_POST["reptxt"];
                $qut = $_POST["qut"];
                addonline(getuid_sid($sid),"Posted A reply","");
                echo "<head>";
                echo "<title>$sitename</title>";
                echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
                echo "</head>";
                echo "<body>";
                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=&#39;".$tid."&#39;"));

                if(($closed[0]!=&#39;1&#39;)||(ismod($uid)))
                {

                $lpost = mysql_fetch_array(mysql_query("SELECT dtpost FROM ibwf_posts WHERE uid=&#39;".$uid."&#39; ORDER BY dtpost DESC LIMIT 1"));
                global $post_af;
                $antiflood = time()-$lpost[0];
                if($antiflood>$post_af)
                {
                if(trim($reptxt)!="")
                {
                if(!isblocked($reptxt,$uid))
                {
                $res = mysql_query("INSERT INTO ibwf_posts SET text=&#39;".$reptxt."&#39;, tid=&#39;".$tid."&#39;, uid=&#39;".$uid."&#39;, dtpost=&#39;".$crdate."&#39;, quote=&#39;".$qut."&#39;");
                }else{
                $bantime = time() + (30*24*60*60);
                echo "<img src=\"../images/notok.gif\" alt=\"X\"/>";
                echo "Can&#39;t Post Reply

                ";
                echo "You just tried posting a reply with a link to one of the crapiest sites on earth
                The members of these sites spam here a lot, so go to that site and stay there if you don&#39;t like it here
                as a result of your stupid action:
                1. you have lost your sheild
                2. you have lost all your plusses
                3. You are BANNED!";
                $user = getnick_sid($sid);
                mysql_query("INSERT INTO ibwf_mlog SET action=&#39;autoban&#39;, details=&#39;Wap Desire auto banned $user for spamming forums&#39;, actdt=&#39;".time()."&#39;");
                mysql_query("INSERT INTO ibwf_penalties SET uid=&#39;".$uid."&#39;, penalty=&#39;1&#39;, exid=&#39;2&#39;, timeto=&#39;".$bantime."&#39;, pnreas=&#39;Banned: Automatic Ban for spamming for a crap site&#39;");
                mysql_query("UPDATE ibwf_users SET plusses=&#39;0&#39;, shield=&#39;0&#39; WHERE id=&#39;".$uid."&#39;");
                echo "</body>";
                echo "</html>";
                exit();
                }
                }
                if($res)
                {
                $usts = mysql_fetch_array(mysql_query("SELECT posts, plusses FROM ibwf_users WHERE id=&#39;".$uid."&#39;"));
                $res2 = mysql_fetch_array(mysql_query("SELECT name, authorid FROM ibwf_topics WHERE id=&#39;".$tid."&#39;"));
                $usr = getnick_uid($uid);
                $tname = htmlspecialchars($res2[0]);
                if(($res2[1]!=$uid)&&(automsgs($res2[1]))){
                $msg = "Your Topic $tname"." has been Replied to by $usr [br/][small]p.s: this is an automated pm[/small]";
                autopm($msg, $res2[1]);
                }
                Code:
                $ups = $usts[0]+1;
                $upl = $usts[1]+1;
                mysql_query("UPDATE ibwf_users SET posts=&#39;".$ups."&#39;, plusses=&#39;".$upl."&#39; WHERE id=&#39;".$uid."&#39;");
                mysql_query("UPDATE ibwf_topics SET lastpost=&#39;".$crdate."&#39; WHERE id=&#39;".$tid."&#39;");
                echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Message Posted Successfully";
                echo "

                8 <a accesskey=\"8\" href=\"index.php?action=viewtpc&amp;sid=$sid&amp;t id=$tid&amp;go=last\">View Topic</a>";
                }else{
                echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Error Posting Message";
                }
                }else{
                $af = $post_af -$antiflood;
                echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Antiflood Control: $af";
                }
                }else{
                echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Topic is closed for posting";
                }

                $fname = getfname($fid);
                echo "

                9 <a accesskey=\"9\" href=\"index.php?action=viewfrm&amp;sid=$sid&amp;f id=$fid\">$fname</a>
                ";
                echo "0 <a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
                echo "</p>";
                echo "</body>";

                }

                Comment


                  #9
                  you already get pluses whenever you post ... if you want to give pluses for creating a topic just add that code WHERE you see topic successfully created.... if you want to add it on other actions just look in genproc.php and add it at the success areas..

                  R.M.C
                  ----------
                  PHP Adovocate B)

                  Comment


                    #10
                    ok i give a new example of sign guestbook coding..where must i put that code??

                    else if($action=="signgb")
                    {
                    $who = $_POST["who"];

                    if(!cansigngb(getuid_sid($sid), $who))
                    {
                    echo "<head>";
                    echo "<title>$sitename</title>";
                    echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
                    echo "</head>";
                    echo "<body>";
                    echo "<p align=\"center\">";
                    echo "You cant Sign this user guestbook

                    ";
                    echo "0 <a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
                    echo "</p>";
                    echo "</body>";
                    echo "</html>";
                    exit();
                    }
                    $msgtxt = $_POST["msgtxt"];
                    //$qut = $_POST["qut"];
                    addonline(getuid_sid($sid),"Signing a guestbook","");
                    echo "<head>";
                    echo "<title>$sitename</title>";
                    echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
                    echo "</head>";
                    echo "<body>";
                    echo "<p align=\"center\">";
                    $crdate = time();
                    //$uid = getuid_sid($sid);
                    $res = false;

                    if(trim($msgtxt)!="")
                    {

                    $res = mysql_query("INSERT INTO ibwf_gbook SET gbowner=&#39;".$who."&#39;, gbsigner=&#39;".$uid."&#39;, dtime=&#39;".$crdate."&#39;, gbmsg=&#39;".$msgtxt."&#39;");
                    }
                    if($res)
                    {
                    echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Message Posted Successfully";
                    }else{
                    echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Error Posting Message";
                    }

                    echo "

                    ";
                    echo "0 <a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
                    echo "</p>";
                    echo "</body>";

                    }


                    where?

                    Comment


                      #11
                      if you read what i said you wouldn&#39;t ask such question...i said you should add that code in genproc.php WHERE ever the result is success
                      eg that code you got there
                      you would add it WHERE it says
                      if($res)
                      {
                      >>HERE<<
                      echo "message post successful";
                      }

                      R.M.C
                      ----------
                      PHP Adovocate B)

                      Comment


                        #12
                        Code:
                        else if($action=="signgb")
                        {
                        $who = $_POST["who"];
                        
                        if(!cansigngb(getuid_sid($sid), $who))
                        {
                        echo "<head>";
                        echo "<title>$sitename</title>";
                        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
                        echo "</head>";
                        echo "<body>";
                        echo "<p align=\"center\">";
                        echo "You cant Sign this user guestbook
                        
                        ";
                        echo "[b]0 [/b]<a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
                        echo "</p>";
                        echo "</body>";
                        echo "</html>";
                        exit();
                        }
                        $msgtxt = $_POST["msgtxt"];
                        //$qut = $_POST["qut"];
                        addonline(getuid_sid($sid),"Signing a guestbook","");
                        echo "<head>";
                        echo "<title>$sitename</title>";
                        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
                        echo "</head>";
                        echo "<body>";
                        echo "<p align=\"center\">";
                        $crdate = time();
                        //$uid = getuid_sid($sid);
                        $res = false;
                        
                        if(trim($msgtxt)!="")
                        {
                        
                        $res = mysql_query("INSERT INTO ibwf_gbook SET gbowner=&#39;".$who."&#39;, gbsigner=&#39;".$uid."&#39;, dtime=&#39;".$crdate."&#39;, gbmsg=&#39;".$msgtxt."&#39;");
                        }
                        if($res)
                        {
                        $uipa = $uipa+1;
                        $uip = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id=&#39;".$uid."&#39;"));
                        $uip = $uipa + $uip[0];
                        mysql_query("UPDATE ibwf_users SET plusses=&#39;".$uip."&#39; WHERE id=&#39;".$uid."&#39;");
                        echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Message Posted Successfully";
                        }else{
                        echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Error Posting Message";
                        }
                        
                        echo "
                        
                        ";
                        echo "[b]0 [/b]<a accesskey=\"0\" href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
                        echo "</p>";
                        echo "</body>";
                        
                        }
                        where you see the

                        if($res)
                        {
                        $uipa = $uipa+1;
                        $uip = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id=&#39;".$uid."&#39;"));
                        $uip = $uipa + $uip[0];
                        mysql_query("UPDATE ibwf_users SET plusses=&#39;".$uip."&#39; WHERE id=&#39;".$uid."&#39;");
                        echo "<img src=\"../images/ok.gif\" alt=\"O\"/>Message Posted Successfully";
                        }

                        add the code under that and it will update plusses on Success of posting new roply if you know what i mean?

                        Comment


                          #13
                          owh..i got it..!! thanks white warrior n mckeny..

                          Comment


                            #14
                            and i want to add plussses in chatroom i mean 5 chat msg get 1 plusses so how?

                            Comment


                              #15
                              try this
                              Code:
                              $uid = getuid_sid($sid);
                              
                              $info = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chat WHERE uid=&#39;".$uid."&#39;"));
                              if($info[0]>5)
                              {
                              
                              $uipa = $uipa+1; 
                              $uip = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id=&#39;".$uid."&#39;")); 
                              $uip = $uipa +  $uip[0]; 
                              mysql_query("UPDATE ibwf_users SET plusses=&#39;".$uip."&#39; WHERE id=&#39;".$uid."&#39;"); 
                              }

                              R.M.C
                              ----------
                              PHP Adovocate B)

                              Comment

                              Working...
                              X