wall on profile and status comments and likes

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

    wall on profile and status comments and likes

    as the topic sugests lol im guna share this code i came up with there are a couple bugs ill work on it a bit more this week

    but for those of you who want status comments and a profile wall where users can like unlike posts here is the code in beta mode at the moment
    Code:
    <?php
     sql tables
    
     --
    -- Table structure for table `wallcomlike`
    --
    
    CREATE TABLE IF NOT EXISTS `wallcomlike` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `who` int(11) NOT NULL,
      `refid` int(11) NOT NULL,
      `sent` int(100) NOT NULL DEFAULT '0',
      PRIMARY KEY (`id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
    
    --
    -- Dumping data for table `wallcomlike`
    --
    -- Table structure for table `status`
    --
    
    CREATE TABLE IF NOT EXISTS `status` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `user` int(11) NOT NULL,
      `text` varchar(255) NOT NULL,
      `sent` int(100) NOT NULL DEFAULT '0',
      `who` char(100) NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
    
    --
    -- Dumping data for table `status`
    --
    
    INSERT INTO `status` (`id`, `user`, `text`, `sent`, `who`) VALUES
    (1, 1, 'testststts', 1368786866, ''),
    (2, 1, 'testststts', 1368786866, ''),
    (3, 1, 'blah fkn blah', 1368786949, ''),
    (4, 1, 'wwrwr', 1368787186, '');
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `statuscomment`
    --
    
    CREATE TABLE IF NOT EXISTS `statuscomment` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `who` int(11) NOT NULL,
      `refid` int(11) NOT NULL,
      `text` varchar(255) NOT NULL,
      `sent` int(100) NOT NULL DEFAULT '0',
      PRIMARY KEY (`id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
    
    --
    -- Dumping data for table `statuscomment`
    --
    
    INSERT INTO `statuscomment` (`id`, `who`, `refid`, `text`, `sent`) VALUES
    (3, 1, 5, 'iohoih', 1368787009),
    (4, 1, 1, 'wwewwe', 1368787207);
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `statuslike`
    --
    
    CREATE TABLE IF NOT EXISTS `statuslike` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `who` int(11) NOT NULL,
      `refid` int(11) NOT NULL,
      `sent` int(100) NOT NULL DEFAULT '0',
      PRIMARY KEY (`id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
    
    --
    -- Dumping data for table `statuslike`
    --
    --------------------------------------------------------------
    
    
    /////////////////////////////////////////////
    in core add
    function cansignwall($uid, $who)
    {
      if(arebuds($uid, $who))
      {
        return true;
      }
    
      if(getplusses($uid)>=75)
      {
        return true;
      }
      return false;
    }
    ///////////////////////////////////////////////////////////////////////////
    main script for statuses
    
     if($action=="main")
    {
    addvisitor();
      addonline(getuid_sid($sid),"Buddies Menu","buddies.php?mzonez=$action");
      //saveuinfo($sid);
      $nick = getnick_sid($sid);
      $who = $_GET["who"];
      echo "<head>";
      echo "<title>$nick@$sitename</title>";
      echo "</head>";
      echo "<body>";
    pagehead();
      navstart("Buddies Menu");
      echo "Buddies Is Under Construction<br />" ;
         $uid = getuid_sid($sid);
      $statmsg = mysql_fetch_array(mysql_query("SELECT id, user, text, sent, who FROM status WHERE user='".$uid."'"));
    
      $noim = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM statuscomment WHERE refid='".$uid."'"));
      $lnk = "<a href=\"buddies.php?action=comments&amp;id=$uid\">[$noim[0]]</a>";
             echo "• Your Status: $statmsg[2] $lnk";
             echo "<div class=\"hr\"></div>";
                  echo "<form action=\"buddies.php?action=upstatus&amp;who=$who&amp;stat=1\" method=\"post\">";
     echo "Whats on your mind?<br/><textarea rows=\"2\" cols=\"12\" name=\"pmtext\" maxlength=\"250\"/></textarea><br/>";
      echo "<input type=\"submit\" value=\"Update\"/></form>";
    
          if($page=="" || $page<=0)$page=1;
    
        $num_items = getnbuds($uid); //changable
    
        $items_per_page= 5;
    
        $num_pages = ceil($num_items/$items_per_page);
    
        if(($page>$num_pages)&&$page!=1)$page= $num_pages;
    
        $limit_start = ($page-1)*$items_per_page;
    
    
    
        //changable sql
    
             $tm24 = time() - (60*60);
    
            $sql = "SELECT a.lastact, a.name, a.id, b.uid, b.tid, b.reqdt, a.sex FROM ibwf_users a INNER JOIN ibwf_buddies b ON (a.id = b.uid) OR (a.id=b.tid) WHERE (b.uid='".$uid."' OR b.tid='".$uid."') AND b.agreed='1' GROUP BY 1,2  ORDER BY a.lastact='".$tm24."' DESC LIMIT $limit_start, $items_per_page";
    
    
    
        $items = mysql_query($sql);
    
        echo mysql_error();
    
        if(mysql_num_rows($items)>0)
    
        {
    
        while ($item = mysql_fetch_array($items))
    
        {
    
            if($uid!=$item[2])
    
            {
    
              if(isonline($item[2]))
    
      {
    
        $iml = "<img src=\"images/online.png\" alt=\"\"/>";
    
        $uact = "WHERE: ";
    
        $plc = mysql_fetch_array(mysql_query("SELECT place FROM ibwf_online WHERE userid='".$item[2]."'"));
    
        $uact .= $plc[0];
    
      }else{
    
        $iml = "<img src=\"images/ofline.png\" alt=\"\"/>";
    
        $uact = "Last Active: ";
    
        $itime = $item[0] + (addhours());
    
        $ladt = date("d/m/Y h:i:s A", $itime);
    
        $uact .= $ladt;
    
      }
    
          $lnk = "$iml<a href=\"profile.php?action=viewuser&amp;who=$item[2]\">$item[1]</a>";
    
          echo "$lnk<br/>";
    
    
    
          $itime = $item[5] + (addhours());
    
          $bs = date("d/m/Y h:i:s A",$itime);
    
          echo "Buddy since:$bs<br/>";
    
          echo "$uact<br/>";
    
          echo "Mood: ";
    
          //$bdmsg = mysql_fetch_array(mysql_query("SELECT id, user, text, sent, who FROM status WHERE user='".$item[2]."'"));
            $bmsg = mysql_fetch_array(mysql_query("SELECT id, user, text, sent, who FROM status WHERE user='".$item[2]."'"));
    
           $noim2 = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM statuscomment WHERE refid='".$item[2]."'"));
      $lnk2 = "<a href=\"buddies.php?action=comments&amp;id=$item[2]\">W</a>:[$noim2[0]]";
             echo "$bmsg[2] $lnk2<br/>";
    
          }
    
        }
         }
            else {
              echo "<img src=\"smilies/cry.gif\" alt=\"-\"/>Awwww You Have No Freinds !<br />";
    
            }
           $nick = getnick_sid($sid);
       navstart("Back To Where? $nick");
    echo "<a href=\"home.php?action=main&amp;is=awsum\">Home</a> | Buddies Menu<br/>";
    
    pagefoot();
    
     }
    
     else if($action=="upstatus")
    {
       $uid =getuid_sid($sid);
      addonline(getuid_sid($sid),"Viewing  List","");
            pagehead();
    navstart("Updating Status");
           $who = $_GET["who"];
           $nick = getnick_uid($who);
           $pmtext = $_POST["pmtext"];
           $crdate = time();
           $uid =getuid_sid($sid);
           $res = false;
          if(trim($pmtext)!="")
          {
          $res = mysql_query("INSERT into status SET user='".$uid."', text='".$pmtext."', sent='".$crdate."'");
          }
           if($res)
    
          {
            //////////////////////////////
            echo "<img src=\"images/ok.gif\" alt=\"O\"/><b>Status Post Successfully</b>";
          }else{
            //////////////////////////////
            echo "<img src=\"images/notok.gif\" alt=\"X\"/><b>Error Updating Status</b>";
          }
    
    
    
    $nick = getnick_sid($sid);
       navstart("Back To Where? $nick");
    echo "<a href=\"home.php?action=main&amp;is=awsum\">Home</a><br/>";
       pagefoot();
        echo "</body>";
    }
    else if($action=="comments")
    {
       $uid =getuid_sid($sid);
      addonline(getuid_sid($sid),"Viewing  List","");
            pagehead();
    navstart("Status Comments");
    
        $id = $_GET["id"];
        $who = $_GET["who"];
           $stat = $_GET["stat"];
    
           $status = mysql_fetch_array(mysql_query("SELECT user, text, sent FROM status WHERE id='".$_GET["id"]."'"));
        $online = mysql_fetch_array(mysql_query("SELECT sex, uicon FROM ibwf_users WHERE id='".$status[0]."'"));
    
     if($online[1]=="")
     {
     $seximg = "";
    }else{
     $seximg = "<img src=\"$online[1]\" alt=\"*\"/>";
     }
    
      $tmstamp = $status[2];
      $remain = time() - $tmstamp;
      $idle = gettimemsg2($remain);
      $back = "$idle ago";
      $foto = idle($status[0], 45, 45);
      $cname = cname($status[0]);
      if(($cname == "000000")||($cname == "")){ $texto = "";
     $textc = ""; }else{ $texto = "<font color=\"$cname\">";
     $textc = "</font>"; }
     $ctext = ctext($status[0]);
     if(($ctext == "000000")||($ctext == "")){ $textoo = "";
     $textco = ""; }else{ $textoo = "<font color=\"$ctext\">";
     $textco = "</font>"; }
      $pmtext = parsepm($status[1], $sid);
    
          if(candelw($uid, $midd))
          {
            $delnk = "<a href=\"buddies.php?action=delstatus&amp;midd=$id\">[x]</a>";
          }else{
            $delnk = "";
          }
      $statlike = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM statuslike WHERE who='".$uid."' AND refid='".$_GET["id"]."'"));
    
      if($statlike[0]==0)
     {
     $like = "<a href=\"buddies.php?action=statuslike&amp;id=$id&amp;do=like&amp;stat=2\">Like</a>";
     }else{
     $like = "<a href=\"buddies.php?action=statusunlike&amp;id=$id&amp;stat=1\">Unlike</a>";
    }
    
      $statlikess = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM statuslike WHERE refid='".$uid."'"));
         $statmsg = mysql_fetch_array(mysql_query("SELECT id, user, text, sent, who FROM status WHERE user='".$id."'"));
    
             echo "• Your Status: $statmsg[2] $delnk<br />";
      //$comment = "<a href=\"buddies.php?action=addcom&amp;id=$id\">Comments</a>";
          $lnk = "$seximg<a href=\"prov.php?show=viewuser&amp;who=$status[0]\">$texto".getnick_uid($status[0])."$textc</a> $textoo$pmtext$textco $delnk";
          //echo "<table><tr><td>$foto</td><td>$lnk<br/>$back • $comment • $like</td></tr></table><div class=\"hr\"></div><br/>";
             $uid = getuid_sid($sid);
      $statmsg = mysql_fetch_array(mysql_query("SELECT id, user, text, sent, who FROM status WHERE user='".$uid."'"));
    
            //echo "• Your Status: $statmsg[2] <br />";
    
        $statlikess = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM statuslike WHERE refid='".$id."'"));
    
      $comment = "<a href=\"index.php?show=addcom&amp;id=$id\">Comments</a>";
          $lnk = "$seximg<a href=\"prov.php?show=viewuser&amp;who=$status[0]\">$texto".getnick_uid($status[0])."$textc</a> $textoo$pmtext$textco $delnk";
             echo "$lnk<br />";
          //echo "<table><tr><td>$foto</td><td>$lnk<br/>$back • $comment • $like</td></tr></table><br/><hr>";
    
        if($page=="" || $page<=0)$page=1;
      $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM statuscomment WHERE refid='".$id."'"));
        $num_items = $noi[0]; //changable
        $items_per_page= 8;
        $num_pages = ceil($num_items/$items_per_page);
        if(($page>$num_pages)&&$page!=1)$page= $num_pages;
        $limit_start = ($page-1)*$items_per_page;
            $sql = "SELECT id, who, refid, text, sent  FROM statuscomment WHERE refid='".$id."' ORDER BY sent DESC LIMIT $limit_start, $items_per_page";
        $items = mysql_query($sql);
    
        echo mysql_error();
        if(mysql_num_rows($items)>0)
        {
        while ($item = mysql_fetch_array($items))
        {
    
        $online = mysql_fetch_array(mysql_query("SELECT sex, uicon FROM ibwf_users WHERE id='".$item[1]."'"));
           //echo "$item[0]<br />";
     if($online[1]=="")
     {
     $seximg = "";
    }else{
     $seximg = "<img src=\"$online[1]\" alt=\"*\"/>";
     }
      $foto = idle($item[1], 45, 45);      $snick = getnick_uid($item[1]);
      $cname = cname($item[1]);
     if(($cname == "000000")||($cname == ""))
     {
     $fonto = "";
     $fontc = "";
     }else{
     $fonto = "<font color=\"$cname\">";
     $fontc = "</font>";
     }
          $lnk = "$seximg<a href=\"profile.php?action=viewuser&amp;who=$item[1]\">$fonto$snick$fontc</a>";
      $remain = time() - $item[4];
      $idle = gettimemsg2($remain);
      $bila = "$idle ago";
          if(candelwc($uid, $item[1], $id))
          {
            $delnk = "<a href=\"buddies.php?action=delstatcom&&amp;mid=$item[0]&amp;midd=$id\">[x]</a>";
          }else{
            $delnk = "";
          }
     $ctext = ctext($item[1]);
     if(($ctext == "000000")||($ctext == "")){ $textoo = "";
     $textco = ""; }else{ $textoo = "<font color=\"$ctext\">";
     $textco = "</font>"; }
          $text = parsepm($item[3], $uid);
          $statlike = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM statuslike WHERE who='".$uid."' AND refid='".$_GET["id"]."'"));
    
      if($statlike[0]==0)
     {
     $like = "<a href=\"buddies.php?action=statuslike&amp;id=$id&amp;do=like&amp;stat=2\">Like</a>";
     }else{
     $like = "<a href=\"buddies.php?action=statusunlike&amp;id=$id&amp;stat=1\">Unlike</a>";
    }
          echo "<table><tr><td>$foto</td><td>$lnk $textoo$text$textco $like $delnk<br/>$bila</td></tr></table><div class=\"hr\"></div>";
        }
        }
    
        echo "Add Comment:<form action=\"buddies.php?action=commentadd&amp;id=$id&amp;stat=$id\" method=\"post\">";
        echo "<textarea rows=\"2\" cols=\"12\" name=\"text\" maxlength=\"250\" size=\"12\"/></textarea>";
        echo "<br/><input type=\"submit\" value=\"Submit\"/></form>";
        //echo "</div></div>";
     //echo "<div class=\"box_sub\" align=\"center\">";
        if($page>1)
        {
          $ppage = $page-1;
          echo "<a href=\"index.php?show=$show&amp;page=$ppage&amp;id=$id\">&#171;PREV</a> ";
        }
        if($page<$num_pages)
        {
          $npage = $page+1;
          echo "<a href=\"index.php?show=$show&amp;page=$npage&amp;id=$id\">Next&#187;</a>";
        }
        echo "<br/>Page $page of $num_pages<br/>";
        if($num_pages>2)
        {
            $rets = "<form action=\"index.php\" method=\"get\">";
          $rets .= "Page<input name=\"pg\" format=\"*N\" size=\"3\"/>";
            $rets .= "<input type=\"hidden\" name=\"show\" value=\"$show\"/>";
            $rets .= "<input type=\"hidden\" name=\"id\" value=\"$id\"/>";
            $rets .= "<input type=\"hidden\" name=\"hits\" value=\"$hits\"/>";
            $rets .= "<input type=\"submit\" value=\"[GO]\"/></form>";
            echo $rets;
        }
    $nick = getnick_sid($sid);
       navstart("Back To Where? $nick");
    echo "<a href=\"home.php?action=main&amp;is=awsum\">Home</a><br/>";
       pagefoot();
        echo "</body>";
    }
    else if($action=="commentadd")
    {
    
       $uid =getuid_sid($sid);
      addonline(getuid_sid($sid),"Replying To A Status","");
            pagehead();
    navstart("Adding Comment");
       $stat = $_GET["stat"];
        $id = $_GET["id"];
        $who = $_GET["who"];
         $text = $_POST["text"];
          $texts = parsepm($text, $sid);
           $crdate = time();
          //$uid = getuid_hits($hits);
          $res = false;
    
          if(trim($text)!="")
          {
            $usts = mysql_fetch_array(mysql_query("SELECT plusses FROM ibwf_users WHERE id='".$uid."'"));
            $upl = $usts[0]+1;
            mysql_query("UPDATE ibwf_users SET plusses='".$upl."' WHERE id='".$uid."'");
               $res = mysql_query("INSERT into statuscomment SET refid='".$_GET["id"]."', who='".$uid."', sent='".$crdate."', text='".$text."'");
    
    
      echo "<img src=\"images/ok.gif\" alt=\"O\"/><b>Comment Add Successfully</b>";
           }
    
      else{
    
            echo "<img src=\"images/notok.gif\" alt=\"X\"/><b>Error Add Comment</b>";
          }
    $nick = getnick_sid($sid);
       navstart("Back To Where? $nick");
    echo "<a href=\"home.php?action=main&amp;is=awsum\">Home</a><br/>";
       pagefoot();
        echo "</body>";
    }
    
    else if($action=="wall")
    {
       $who=$_GET["who"];
       $nick =getuid_sid($sid);
    
      addonline(getuid_sid($sid),"Viewing $nick's wall","");
            pagehead();
    navstart("Viewing $who's Wall");
    
    if($page=="" || $page<=0)$page=1;
    
        $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM status WHERE user='".$who."'"));
    
        $num_items = $noi[0]; //changable
    
        $items_per_page= 5;
    
        $num_pages = ceil($num_items/$items_per_page);
    
        if(($page>$num_pages)&&$page!=1)$page= $num_pages;
    
        $limit_start = ($page-1)*$items_per_page;
    
    
    
    
    
            $sql = "SELECT id, user, text, sent  FROM status  WHERE user='".$who."' ORDER BY sent DESC LIMIT $limit_start, $items_per_page";
    
    
    
    
    
        echo "<p>";
    
        $items = mysql_query($sql);
    
        echo mysql_error();
    
        if(mysql_num_rows($items)>0)
    
        {
    
        while ($item = mysql_fetch_array($items))
    
        {
    
    
    
              if(isonline($item[1]))
    
      {
    
        $iml = "<img src=\"images/onl.gif\" alt=\"+\"/>";
    
    
    
      }else{
    
        $iml = "<img src=\"images/ofl.gif\" alt=\"-\"/>";
    
      }
    
        $snick = getnick_uid($item[1]);
    
          $lnk = "<a href=\"index.php?action=viewuser&amp;who=$item[1]&amp;sid=$sid\">$iml$snick</a>";
    
          $bs = date("d/m/y h:i:s A",$item[3]);
    
          echo "$lnk<br/>";
          echo "";
          if(candelgb($uid, $item[1]))
    
          {
    
            $delnk = "<a href=\"profile.php?action=delfgb&amp;mid=$item[4]\">[x]</a>";
    
          }else{
    
            $delnk = "";
    
          }
    
          $text = parsepm($item[2]);
                $uid = getuid_sid($sid);
    
    
    
          echo "<b>Wrote:</b> $text <br/><b>Date</b> $bs $delnk<br/><br />";
    
    
    
    
    
        }
    
         }
    
        echo "</p>";
    
        echo "<p align=\"center\">";
    
        if($page>1)
    
        {
    
          $ppage = $page-1;
    
          echo "<a href=\"profile.php?action=action&amp;page=$ppage&amp;who=$who\">&#171;PREV</a> ";
    
        }
    
        if($page<$num_pages)
    
        {
    
          $npage = $page+1;
    
          echo "<a href=\"profile.php?action=action&amp;page=$npage&amp;who=$who\">Next&#187;</a>";
    
        }
    
        echo "<br/>$page/$num_pages<br/>";
    
        if($num_pages>2)
    
        {
    
          $rets = "Jump to page<input id=\"inputText\" name=\"pg\" format=\"*N\" size=\"3\"/>";
    
             $rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
    
            $rets .= "<input type=\"hidden\" name=\"who\" value=\"$who\"/>";
    
            $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
    
    		$rets .= "<input id=\"inputButton\" type=\"submit\" value=\"Post\"/>";
    
    
    
            $rets .= "</form>";
    
            echo $rets;
    
        }
    
        echo "</p>
    
        <p align=\"center\">";
    
        if(cansigngb($uid, $who))
    
        {
    
        echo "<a href=\"profile.php?action=writewall&amp;who=$who\">";
    
    echo "Add your comment</a><br/>";
    
    }
    
    
    $nick = getnick_sid($sid);
     if($uid>0)
      {
      $chs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline"));
      $tmsg = getpmcount(getuid_sid($sid));
      $umsg = getunreadpm(getuid_sid($sid));
      $mybuds = getnbuds($uid);
      $onbuds = getonbuds($uid);
    $allbuds = getnbuds($uid);
    $reqs = getnreqs($uid);
      $topics = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics"));
      $posts = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts"));
      $nick = getnick_sid($sid);
    echo "<center>";
      navstart("Back TO Where? $nick");
    echo "<a href=\"index.php\">Home</a> ";
    echo "&#187;Viewing $whonick's Profile<br />";
     echo "</center>";
    
    }else{
      $chs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline"));
      $tmsg = getpmcount(getuid_sid($sid));
      $umsg = getunreadpm(getuid_sid($sid));
      $mybuds = getnbuds($uid);
      $onbuds = getonbuds($uid);
    $allbuds = getnbuds($uid);
    $reqs = getnreqs($uid);
      $topics = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics"));
      $posts = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts"));
      $nick = getnick_sid($sid);
    echo "<center>";
      navstart("Back TO Where? Guest");
    echo "<a href=\"index.php\">Home</a> ";
    echo "&#187;Viewing $whonick's Profile<br />";
     echo "</center>";
      echo "<div class=\"error\"><img src=\"images/no.gif\" alt=\"-\"/>";
                    echo "<b><strong>You  Are Not Logged In </strong></b>";
             echo "</div>";
      echo "<div align=\"center\">";
      echo "Please <a href=\"logon.php\">Login</a> | <a href=\"register.php\">Register</a>";
     echo "</div>";
    }
       pagefoot();
    
    }
    else if($action=="statuslike")
    {
       $uid =getuid_sid($sid);
      addonline(getuid_sid($sid),"Viewing Status","");
            pagehead();
    navstart("Status Like");
         $stat = $_GET["stat"];
        $id = $_GET["id"];
        $who = $_GET["who"];
    
        if($stat == '2'){
        $do = $_GET["do"];
       $refid  = $_GET["id"];
     echo "<div class=\"box_sub\" align=\"center\">";
       if($do=="like")
     {
     $vb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM statuslike WHERE refid='".$refid."' AND who='".$uid."'"));
      if($vb[0]==0)
      {
          $res = mysql_query("INSERT INTO statuslike SET who='".$uid."', refid='".$refid."', sent='".time()."'");
    
      if($res)
      {
    
        echo "<img src=\"images/ok.gif\" alt=\"o\"/>Status Like Successfully!";
      }else{
    
        echo "<img src=\"images/notok.gif\" alt=\"x\"/>Status Like Error";
      }
     }else{
    
      echo "<img src=\"images/notok.gif\" alt=\"x\"/>You already like this status!";
    }
    
      }else{
    
        $res = mysql_query("DELETE FROM statuslike WHERE refid='".$refid."' AND who='".$uid."'");
    
     if($res)
      {
    
        echo "<img src=\"images/ok.gif\" alt=\"o\"/>Status Unlike Successfully!";
      }else{
    
        echo "<img src=\"images/notok.gif\" alt=\"x\"/>Status Unlike Error";
      }
     }
       }
    
    $nick = getnick_sid($sid);
       navstart("Back To Where? $nick");
    echo "<a href=\"home.php?action=main&amp;is=awsum\">Home</a><br/>";
       pagefoot();
        echo "</body>";
    }
    else if($action=="statusunlike")
    {
       $uid =getuid_sid($sid);
      addonline(getuid_sid($sid),"Unliking A Status","");
            pagehead();
    navstart("Unliking A Status");
    
         $stat = $_GET["stat"];
        $id = $_GET["id"];
        $who = $_GET["who"];
    
        if($stat == '1'){
        $do = $_GET["do"];
       $refid  = $_GET["id"];
       $stat = $_GET["stat"];
        $id = $_GET["id"];
        $who = $_GET["who"];
     $res = mysql_query("DELETE FROM statuslike WHERE refid='".$refid."' AND who='".$uid."'");
    
     if($res)
      {
    
        echo "<img src=\"images/ok.gif\" alt=\"o\"/>Status Unliked Successfully!";
      }else{
    
        echo "<img src=\"images/notok.gif\" alt=\"x\"/>Status Unlike Error";
      }
       }
    $nick = getnick_sid($sid);
       navstart("Back To Where? $nick");
    echo "<a href=\"home.php?action=main&amp;is=awsum\">Home</a><br/>";
       pagefoot();
        echo "</body>";
    }
    else if($action=="delstatus")
    {
            pagehead();
    navstart("Deleting Status");
          $uid =getuid_sid($sid);
        $midd = $_GET["mid"];
    
      addonline(getuid_sid($sid),"Deleting GB Message","");
    
      if(candelwc(getuid_sid($sid), $uid, $midd))
    
      {
         $res = mysql_query("DELETE FROM statuscomment WHERE id='".$uid."' AND who='".$midd."'");
        $res = mysql_query("DELETE FROM status WHERE user='".$mid."'");
    
        if($res)
    
            {
    
                echo "<img src=\"images/ok.gif\" alt=\"o\"/>Message Deleted From Status<br/>";
    
            }else{
    
              echo "<img src=\"images/notok.gif\" alt=\"x\"/>Database Error!<br/>";
    
            }
    
      }else{
    
        echo "<img src=\"images/notok.gif\" alt=\"X\"/>You can't delete this message";
    
      }
    
    $nick = getnick_sid($sid);
       navstart("Back To Where? $nick");
    echo "<a href=\"home.php?action=main&amp;is=awsum\">Home</a><br/>";
       pagefoot();
        echo "</body>";
    }
    else if($action=="delstatcom")
    {
       $uid =getuid_sid($sid);
      addonline(getuid_sid($sid),"Deleting Comment","");
            pagehead();
    navstart("Deleting Comment");
    
        $mid = $_GET["mid"];
         $midd = $_GET["midd"];
      addonline(getuid_sid($sid),"Deleting GB Message","");
    
      if(candelwc(getuid_sid($sid), $midd, $mid))
    
      {
    
        $res = mysql_query("DELETE FROM statuscomment WHERE id='".$mid."' AND who='".$midd."'");
    
        if($res)
    
            {
    
                echo "<img src=\"images/ok.gif\" alt=\"o\"/>Message Deleted From Status<br/>";
    
            }else{
    
              echo "<img src=\"images/notok.gif\" alt=\"x\"/>Database Error!<br/>";
    
            }
    
      }else{
    
        echo "<img src=\"images/notok.gif\" alt=\"X\"/>You can't delete this message";
    
      }
    
    $nick = getnick_sid($sid);
       navstart("Back To Where? $nick");
    echo "<a href=\"home.php?action=main&amp;is=awsum\">Home</a><br/>";
       pagefoot();
        echo "</body>";
    }
    else if($action=="addstatcom")
    {
       $uid =getuid_sid($sid);
      addonline(getuid_sid($sid),"Viewing  List","");
            pagehead();
    navstart("Buddies List");
    
    $nick = getnick_sid($sid);
       navstart("Back To Where? $nick");
    echo "<a href=\"home.php?action=main&amp;is=awsum\">Home</a><br/>";
       pagefoot();
        echo "</body>";
    }
    
    
    ////////////////////////////////////////////////////////////////
    
    now for wall on profiles
    
    on profiles add
    
     navstart("Wall Messages");
        $sql = "SELECT gbowner, gbsigner, gbmsg, dtime FROM ibwf_wall WHERE gbowner='".$who."' ORDER BY dtime DESC LIMIT 4";
    
        $items = mysql_query($sql);
        echo mysql_error();
        if(mysql_num_rows($items)>0)
        {
        if(mysql_num_rows($items)>1)
        {
     $br = "<br/>";
      }else{
     $hr = "";
     }
        while ($item = mysql_fetch_array($items))
        {
          $hr ="<div class=\"hr\"></hr>";
    
             $snick = getnick_uid($item[1]);
          $text = parsepm($item[2], $sid);
     echo "<table><tr><td>$foto</td><td>$seximg<a href=\"profile.php?action=viewuser&amp;who=$item[1]\">$snick</a><br/>$text</td></tr></table>";
    
       }
        }else{
     echo "<i>*No Messages</i><br/>";
     }
        if(cansigngb($uid, $who))
        {
        echo "<br/><a href=\"profile.php?action=writewall&amp;who=$who\">";
     echo "Sign Wall</a> | ";
    }else{
        echo "<br/>";
     }
       $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_wall WHERE gbowner='".$who."'"));
       echo "<a href=\"profile.php?action=wall&amp;who=$who\">Comments</a> [$noi[0]]";
    
       ////////////////////////////////////////////////////////////////////////////////
    
       else if($action=="writewall")
    {
      $who=$_GET["who"];
       $uid =getuid_sid($sid);
      addonline(getuid_sid($sid),"Commenting on ".getuid_nick($who)."'s wall","");
            pagehead();
    navstart("Writing On A Wall");
     if(!cansigngb($uid, $who)){
    	boxstart("Error!");
    echo "
    <p align=\"center\">
    You need to be this user's buddy for commenting blog.<br/><br/>
    <a href=\"home.php?action=main\">home</a>
    </p></font></body>
    </html>";
    exit();
    }
    echo "<p align=\"center\">
    Text:<form action=\"profile.php?action=signwall\" method=\"post\">
    <input id=\"inputText\" name=\"msgtxt\" maxlength=\"500\"/><br/>
    <input type=\"hidden\" name=\"who\" value=\"$who\"/>
    <input id=\"inputButton\" type=\"submit\" value=\"submit\"/></form>
    </p>";
    
    
    $nick = getnick_sid($sid);
     if($uid>0)
      {
      $chs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline"));
      $tmsg = getpmcount(getuid_sid($sid));
      $umsg = getunreadpm(getuid_sid($sid));
      $mybuds = getnbuds($uid);
      $onbuds = getonbuds($uid);
    $allbuds = getnbuds($uid);
    $reqs = getnreqs($uid);
      $topics = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics"));
      $posts = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts"));
      $nick = getnick_sid($sid);
    echo "<center>";
      navstart("Back TO Where? $nick");
    echo "<a href=\"index.php\">Home</a> ";
    echo "&#187;Viewing $whonick's Profile<br />";
     echo "</center>";
    
    }else{
      $chs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline"));
      $tmsg = getpmcount(getuid_sid($sid));
      $umsg = getunreadpm(getuid_sid($sid));
      $mybuds = getnbuds($uid);
      $onbuds = getonbuds($uid);
    $allbuds = getnbuds($uid);
    $reqs = getnreqs($uid);
      $topics = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics"));
      $posts = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts"));
      $nick = getnick_sid($sid);
    echo "<center>";
      navstart("Back TO Where? Guest");
    echo "<a href=\"index.php\">Home</a> ";
    echo "&#187;Viewing $whonick's Profile<br />";
     echo "</center>";
      echo "<div class=\"error\"><img src=\"images/no.gif\" alt=\"-\"/>";
                    echo "<b><strong>You  Are Not Logged In </strong></b>";
             echo "</div>";
      echo "<div align=\"center\">";
      echo "Please <a href=\"logon.php\">Login</a> | <a href=\"register.php\">Register</a>";
     echo "</div>";
    }
       pagefoot();
    
    }
    else if($action=="signwall")
    {
      $who=$_GET["who"];
       $uid =getuid_sid($sid);
      addonline(getuid_sid($sid),"Commenting on ".getuid_nick($who)."'s wall","");
            pagehead();
    navstart("Signing $who's Wall");
    $who = $_POST["who"];
    
    
    
    if(!cansigngb(getuid_sid($sid), $who))
    
        {
    
          echo "You cant post comment in this user's blog because you are not in his/her buddy list.<br/><br/>";
    
          echo "<a href=\"profile.php?action=wall&amp;who=$who\">My wall</a><br/>";
    
          echo "<a href=\"index.php?action=main&amp;sid=$sid\">Main Menu</a>";
    
          echo "</body>";
    
    
    
          echo "</html>";
    
          exit();
    
        }
    
      $msgtxt = $_POST["msgtxt"];
    
      //$qut = $_POST["qut"];
    
      addonline(getuid_sid($sid),"Commenting on a wall post","");
    
          $crdate = time();
    
          //$uid = getuid_sid($sid);
    
          $res = false;
    
    
    
          if(trim($msgtxt)!="")
    
          {
    
    
    
          $res = mysql_query("INSERT INTO ibwf_wall SET gbowner='".$who."', gbsigner='".$uid."', dtime='".$crdate."', gbmsg='".$msgtxt."'");
    
          }
    
          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 "<br/><a href=\"profile.php?action=wall&amp;who=$who\">".getnick_uid($who)."'s wall</a><br/>";
    
          echo "<br/>";
    
    
    
    $nick = getnick_sid($sid);
     if($uid>0)
      {
      $chs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline"));
      $tmsg = getpmcount(getuid_sid($sid));
      $umsg = getunreadpm(getuid_sid($sid));
      $mybuds = getnbuds($uid);
      $onbuds = getonbuds($uid);
    $allbuds = getnbuds($uid);
    $reqs = getnreqs($uid);
      $topics = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics"));
      $posts = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts"));
      $nick = getnick_sid($sid);
    echo "<center>";
      navstart("Back TO Where? $nick");
    echo "<a href=\"index.php\">Home</a> ";
    echo "&#187;Viewing $whonick's Profile<br />";
     echo "</center>";
    
    }else{
      $chs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline"));
      $tmsg = getpmcount(getuid_sid($sid));
      $umsg = getunreadpm(getuid_sid($sid));
      $mybuds = getnbuds($uid);
      $onbuds = getonbuds($uid);
    $allbuds = getnbuds($uid);
    $reqs = getnreqs($uid);
      $topics = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics"));
      $posts = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts"));
      $nick = getnick_sid($sid);
    echo "<center>";
      navstart("Back TO Where? Guest");
    echo "<a href=\"index.php\">Home</a> ";
    echo "&#187;Viewing $whonick's Profile<br />";
     echo "</center>";
      echo "<div class=\"error\"><img src=\"images/no.gif\" alt=\"-\"/>";
                    echo "<b><strong>You  Are Not Logged In </strong></b>";
             echo "</div>";
      echo "<div align=\"center\">";
      echo "Please <a href=\"logon.php\">Login</a> | <a href=\"register.php\">Register</a>";
     echo "</div>";
    }
       pagefoot();
    
    }
    else if($action=="wall")
    {
       $who=$_GET["who"];
       $uid =getuid_sid($sid);
    
      addonline(getuid_sid($sid),"Viewing $nick's wall","");
            pagehead();
    navstart("Viewing $nick's Wall");
    
    if($page=="" || $page<=0)$page=1;
    
        $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_wall WHERE gbowner='".$who."'"));
    
        $num_items = $noi[0]; //changable
    
        $items_per_page= 5;
    
        $num_pages = ceil($num_items/$items_per_page);
    
        if(($page>$num_pages)&&$page!=1)$page= $num_pages;
    
        $limit_start = ($page-1)*$items_per_page;
    
    
    
    
    
            $sql = "SELECT gbowner, gbsigner, gbmsg, dtime, id FROM ibwf_wall WHERE gbowner='".$who."' ORDER BY dtime DESC LIMIT $limit_start, $items_per_page";
    
    
    
    
    
        echo "<p>";
    
        $items = mysql_query($sql);
    
        echo mysql_error();
    
        if(mysql_num_rows($items)>0)
    
        {
    
        while ($item = mysql_fetch_array($items))
    
        {
    
    
    
              if(isonline($item[1]))
    
      {
    
        $iml = "<img src=\"images/onl.gif\" alt=\"+\"/>";
    
    
    
      }else{
    
        $iml = "<img src=\"images/ofl.gif\" alt=\"-\"/>";
    
      }
    
        $snick = getnick_uid($item[1]);
    
          $lnk = "<a href=\"index.php?action=viewuser&amp;who=$item[1]&amp;sid=$sid\">$iml$snick</a>";
    
          $bs = date("d/m/y h:i:s A",$item[3]);
    
          echo "$lnk<br/>";
          echo "";
          if(candelgb($uid, $item[4]))
    
          {
    
            $delnk = "<a href=\"profile.php?action=delfgb&amp;mid=$item[4]\">[x]</a>";
    
          }else{
    
            $delnk = "";
    
          }
    
          $text = parsepm($item[2]);
    
          $query = mysql_query("SELECT referid FROM wallcomlike WHERE who='".$who."'");
    while ($links2 = mysql_fetch_array($query))
      {
       $like = "<a href=\"home.php?action=viewuser&amp;who=$links2[0]\">".getnick_uid($links2[0])."</a>";
    
    
       }
       $likes = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM wallcomlike WHERE refid='".$who[0]."'"));
                 echo "$like,$query[1],$query[2],$query[3]";
          echo "<b>Wrote:</b> $text likes [$likes[0]]<br/><b>Date</b> $bs $delnk<br/><br />";
    
    
    
    
    
        }
    
        }
    
        echo "</p>";
    
        echo "<p align=\"center\">";
    
        if($page>1)
    
        {
    
          $ppage = $page-1;
    
          echo "<a href=\"profile.php?action=action&amp;page=$ppage&amp;who=$who\">&#171;PREV</a> ";
    
        }
    
        if($page<$num_pages)
    
        {
    
          $npage = $page+1;
    
          echo "<a href=\"profile.php?action=action&amp;page=$npage&amp;who=$who\">Next&#187;</a>";
    
        }
    
        echo "<br/>$page/$num_pages<br/>";
    
        if($num_pages>2)
    
        {
    
          $rets = "Jump to page<input id=\"inputText\" name=\"pg\" format=\"*N\" size=\"3\"/>";
    
             $rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
    
            $rets .= "<input type=\"hidden\" name=\"who\" value=\"$who\"/>";
    
            $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
    
    		$rets .= "<input id=\"inputButton\" type=\"submit\" value=\"Post\"/>";
    
    
    
            $rets .= "</form>";
    
            echo $rets;
    
        }
    
        echo "</p>
    
        <p align=\"center\">";
    
        if(cansigngb($uid, $who))
    
        {
    
        echo "<a href=\"profile.php?action=writewall&amp;who=$who\">";
    
    echo "Add your comment</a><br/>";
    
    }
    
    
    $nick = getnick_sid($sid);
     if($uid>0)
      {
      $chs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline"));
      $tmsg = getpmcount(getuid_sid($sid));
      $umsg = getunreadpm(getuid_sid($sid));
      $mybuds = getnbuds($uid);
      $onbuds = getonbuds($uid);
    $allbuds = getnbuds($uid);
    $reqs = getnreqs($uid);
      $topics = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics"));
      $posts = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts"));
      $nick = getnick_sid($sid);
    echo "<center>";
      navstart("Back TO Where? $nick");
    echo "<a href=\"index.php\">Home</a> ";
    echo "&#187;Viewing $whonick's Profile<br />";
     echo "</center>";
    
    }else{
      $chs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline"));
      $tmsg = getpmcount(getuid_sid($sid));
      $umsg = getunreadpm(getuid_sid($sid));
      $mybuds = getnbuds($uid);
      $onbuds = getonbuds($uid);
    $allbuds = getnbuds($uid);
    $reqs = getnreqs($uid);
      $topics = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics"));
      $posts = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts"));
      $nick = getnick_sid($sid);
    echo "<center>";
      navstart("Back TO Where? Guest");
    echo "<a href=\"index.php\">Home</a> ";
    echo "&#187;Viewing $whonick's Profile<br />";
     echo "</center>";
      echo "<div class=\"error\"><img src=\"images/no.gif\" alt=\"-\"/>";
                    echo "<b><strong>You  Are Not Logged In </strong></b>";
             echo "</div>";
      echo "<div align=\"center\">";
      echo "Please <a href=\"logon.php\">Login</a> | <a href=\"register.php\">Register</a>";
     echo "</div>";
    }
       pagefoot();
    
    }
    
    ?>









    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


    #2
    re

    91 views and 4 likes alot of leachers here and us experianced coders give u guys crap for free and nd the leechers cant even say thankyou









    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


      #3
      re

      thats ok mate the likes part has a bug if u like one status it likes all but that can be fixed by adding more in the url and a new field im guessing so it just likes that one post and not everyones in that post lol









      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


        #4
        What is the use ?

        For what should I use it ?
        It doesn't looks like a standalone script...

        Comment


          #5
          Originally posted by ozziemale31 View Post
          thats ok mate the likes part has a bug if u like one status it likes all but that can be fixed by adding more in the url and a new field im guessing so it just likes that one post and not everyones in that post lol
          just create another db table with rows id,cid,time
          when you like post or whatever it will be stored in separathed db and caled when needed in post using post id or comment id

          My bad didn't see ozzie's post bellow
          Last edited by chelios; 05.06.13, 20:25. Reason: sorry my bad

          Comment

          Working...
          X