Bookmark Topic

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

    Bookmark Topic

    genproc.php
    Code:
    /////////////////////////////////////////Bookmark Topic/////////////////////////
    else if($action=="bkmrk")
    {
    addonline(getuid_sid($sid),"Bookmarking a Topic","");
        $tpcid = $_GET["tid"];
        $uid = getuid_sid($sid);
        $indiatime = time() + (addhours());
        $blah = "SELECT name FROM ibwf_topics WHERE id = '".$tpcid."'";
        $blah2 = mysql_query($blah);
        while($blah3=mysql_fetch_array($blah2)){
        $topicname=$blah3[0];
        }
        $sql = "SELECT COUNT(*) FROM ibwf_bookmarks WHERE userid='".$uid."'";
        $result = mysql_query($sql);
        while($blah4=mysql_fetch_array($result))
    {
        $used=$blah4[0];
    }
      if($used=='50')
    {
         echo "<img src=\"images/notok.gif\" alt=\"x\"/><b> Unable To Bookmark Topic!</b><br/>";
        echo "<br/>You have reached the limit of total Bookmarks Allowed!<br/>Delete existing bookmarks if you want to bookmark more topics!";
        echo "<br/><br/><a href=\"index.php?action=viewtpc&amp;sid=$sid&amp;tid=$tpcid\">Back To Topic</a><br/><br/>";
    boxend();
        echo "</div></div>".getfooter($sid)."</font></body></html>";
        exit();
    }
    else {
      $res = "INSERT INTO `ibwf_bookmarks` (`userid` ,`topic` ,`name` ,`time`) VALUES ('".$uid."', '".$tpcid."', '".$topicname."', '".$indiatime."')";
      $result = mysql_query($res) or die("<img src=\"images/notok.gif\" alt=\"x\"/><b>Unable To Bookmark Topic!</b><br/><br/> 
      <b>Possible Reasons could be -</b> <br/>&#187;You Have Already Bookmarked This Topic!<br/>
      &#187;You Have Reached The Limit Of Total Allowed Bookmarks!<br/>
     &#187;Other Unknown Error!<br/>
     <br/><a href=\"index.php?action=viewtpc&amp;sid=$sid&amp;tid=$tpcid\">Back To Topic</a><br/><br/>
    </center></div></div>".getfooter($sid)."</font></body></html>
    ");
      if($res)
     {
                echo "<img src=\"images/ok.gif\" alt=\"o\"/>Topic Bookmarked successfully!<br/>";
               echo "<br/><a href=\"index.php?action=viewtpc&amp;sid=$sid&amp;tid=$tpcid\">Back To Topic</a>";
            echo "<br/><br/><a href=\"index.php?action=bookmarks&amp;sid=$sid\">Go To Bookmarks</a><br/>";
     }
        else
            {
                echo "<img src=\"images/notok.gif\" alt=\"x\"/>Unable To Bookmark Topic!<br/>";
                echo "<br/><a href=\"index.php?action=viewtpc&amp;sid=$sid&amp;tid=$tpcid\">Back To Topic</a>";
           }
    }}
    /////////////////////////Delete Bookmark////////////////////////
    else if($action=="kaltibkmrk")
    {
    addonline(getuid_sid($sid),"Deleting a Bookmark","");
    $tpcid=$_GET["tpcid"];
    $sql="DELETE FROM `ibwf_bookmarks` WHERE `id`='$tpcid'";
    $res = mysql_query($sql);
    if($res){
    echo "<img src=\"images/ok.gif\" alt=\"O\"/>Bookmark deleted!";
    }else{
    echo "<img src=\"images/notok.gif\" alt=\"X\"/>Error Deleting Bookmark!";
    }
    echo "<br/><br/><center><a href=\"index.php?action=bookmarks&amp;sid=$sid\">Back To Bookmarks</a></center><br/><br/>";
    }
    index.php
    Code:
    ////////////////////////////////Bookmarks//////////////////////
    else if($action=="bookmarks"){
    addonline($uid,"Viewing Bookmarks","index.php?action=$action");
    gettimebar();
    getnewmsg($sid);
    getalert($sid);
    getshouts($sid);
    boxstart("My Bookmarks");
    $limit = 50;
    $noi = "SELECT COUNT(*) FROM ibwf_bookmarks WHERE userid = '".$uid."'";
    $noiq = mysql_query($noi);
    while($noinum=mysql_fetch_array($noiq))
    { $total=$noinum[0]; }
    $bal=$limit-$total;
    echo "<p>Your Bookmarked Topics!<br/>You have $bal bookmarks remaining, out of a total of $limit allowed!<div class=\"iblock\" align=\"center\">";
    if($page=="" || $page<1)$page=1;
    $num_items = $total;
    $items_per_page = 10;
    $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 topic,name,id,time FROM ibwf_bookmarks WHERE userid = '".$usid."' ORDER BY time DESC LIMIT $limit_start, $items_per_page";
    $items = mysql_query($sql);
    while($item=mysql_fetch_array($items))
    {
                   $tlink = "<a href=\"index.php?action=viewtpc&amp;sid=$sid&amp;tid=$item[0]\">".$item[1]."</a>";
                   echo "$tlink [Added on ".date("d/m/Y", $item[3])." at ".date("h:i A", $item[3])."]<br/><a href=\"genproc.php?action=kaltibkmrk&amp;sid=$sid&amp;tpcid=$item[2]\">(Remove)</a><br/><br/>";
    }
              echo "<p>";
        if($page>1)
        {
          $ppage = $page-1;
            $rets = "<form action=\"index.php?action=$action&amp;sid=$sid&amp;page=$ppage\" method=\"post\">";
            $rets .= "<input type=\"hidden\" name=\"sname\" value=\"$fname\"/>";
            $rets .= "<input type=\"hidden\" name=\"stype\" value=\"$ftype\"/>";
            $rets .= "<input type=\"hidden\" name=\"sdec\" value=\"$fdec\"/>";
            $rets .= "<input type=\"hidden\" name=\"sby\" value=\"$fby\"/>";
            $rets .= "<input type=\"submit\" value=\"Previous\"/></form> ";
            echo $rets;
          
        }
        if($page<$num_pages)
        {
          $npage = $page+1;
           $rets = "<form action=\"index.php?action=$action&amp;sid=$sid&amp;page=$npage\" method=\"post\">";
            $rets .= "<input type=\"hidden\" name=\"sname\" value=\"$fname\"/>";
            $rets .= "<input type=\"hidden\" name=\"stype\" value=\"$ftype\"/>";
            $rets .= "<input type=\"hidden\" name=\"sdec\" value=\"$fdec\"/>";
            $rets .= "<input type=\"hidden\" name=\"sby\" value=\"$fby\"/>";
              $rets .= "<input type=\"submit\" value=\"Next\"/></form> ";
            echo $rets;
          
        }
        echo "<br/>Page $page of $num_pages<br/>";
    echo "</div></p>";
    getfooter($sid);
    }
    usage
    Code:
    echo "<a href=\"index.php?action=bookmarks&amp;sid=$sid\">Manage Bookmarks</a><br/>";
    in else if($action=="tpcopt")
    Code:
    echo "<a href=\"genproc.php?action=bkmrk&amp;sid=$sid&amp;tid=$tid\">Bookmark This Topic</a><br/>";
    sql
    Code:
    --
    -- Table structure for table `ibwf_bookmarks`
    --
    
    CREATE TABLE IF NOT EXISTS `ibwf_bookmarks` (
      `id` int(6) NOT NULL auto_increment,
      `userid` int(6) NOT NULL default '0',
      `topic` int(8) NOT NULL default '0',
      `name` varchar(30) NOT NULL default '',
      `time` bigint(30) NOT NULL default '0',
      PRIMARY KEY  (`id`),
      UNIQUE KEY `userid` (`userid`,`topic`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
    
    --
    -- Dumping data for table `ibwf_bookmarks`
    --
    the problem i have when u click bookmark its added succesfull but when go to bookamerk topics there nothing to show
    ________________
    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
    have u checked to see if the bookmark is being added into the database there could be a few difrent problems but check to see if the bookmark is being recoreded
    Creator of
    Epix.Mobi

    Keep an Eye on us Big things coming soon!!!!
    Need something for your site hit me up here

    http://coding-talk.com/forum/main-fo...r-your-wapsite

    Comment


      #3
      yea the bookmarks are added in the ibwf_bookmarks
      ________________
      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

      Comment


        #4
        Code:
        ////////////////////////////////Bookmarks//////////////////////
        else if($action=="bookmarks"){
        addonline($uid,"Viewing Bookmarks","index.php?action=$action");
        gettimebar();
        getnewmsg($sid);
        getalert($sid);
        getshouts($sid);
        boxstart("My Bookmarks");
        $limit = 50;
        $noi = "SELECT COUNT(*) FROM ibwf_bookmarks WHERE userid = '".$uid."'";
        $noiq = mysql_query($noi);
        while($noinum=mysql_fetch_array($noiq))
        { $total=$noinum[0]; }
        $bal=$limit-$total;
        echo "<p>Your Bookmarked Topics!<br/>You have $bal bookmarks remaining, out of a total of $limit allowed!<div class=\"iblock\" align=\"center\">";
        if($page=="" || $page<1)$page=1;
        $num_items = $total;
        $items_per_page = 10;
        $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 topic,name,id,time FROM ibwf_bookmarks WHERE userid = '".$uid."' ORDER BY time DESC LIMIT $limit_start, $items_per_page";
        $items = mysql_query($sql);
        while($item=mysql_fetch_array($items))
        {
                       $tlink = "<a href=\"index.php?action=viewtpc&amp;sid=$sid&amp;tid=$item[0]\">".$item[1]."</a>";
                       echo "$tlink [Added on ".date("d/m/Y", $item[3])." at ".date("h:i A", $item[3])."]<br/><a href=\"genproc.php?action=kaltibkmrk&amp;sid=$sid&amp;tpcid=$item[2]\">(Remove)</a><br/><br/>";
        }
                  echo "<p>";
            if($page>1)
            {
              $ppage = $page-1;
                $rets = "<form action=\"index.php?action=$action&amp;sid=$sid&amp;page=$ppage\" method=\"post\">";
                $rets .= "<input type=\"hidden\" name=\"sname\" value=\"$fname\"/>";
                $rets .= "<input type=\"hidden\" name=\"stype\" value=\"$ftype\"/>";
                $rets .= "<input type=\"hidden\" name=\"sdec\" value=\"$fdec\"/>";
                $rets .= "<input type=\"hidden\" name=\"sby\" value=\"$fby\"/>";
                $rets .= "<input type=\"submit\" value=\"Previous\"/></form> ";
                echo $rets;
              
            }
            if($page<$num_pages)
            {
              $npage = $page+1;
               $rets = "<form action=\"index.php?action=$action&amp;sid=$sid&amp;page=$npage\" method=\"post\">";
                $rets .= "<input type=\"hidden\" name=\"sname\" value=\"$fname\"/>";
                $rets .= "<input type=\"hidden\" name=\"stype\" value=\"$ftype\"/>";
                $rets .= "<input type=\"hidden\" name=\"sdec\" value=\"$fdec\"/>";
                $rets .= "<input type=\"hidden\" name=\"sby\" value=\"$fby\"/>";
                  $rets .= "<input type=\"submit\" value=\"Next\"/></form> ";
                echo $rets;
              
            }
            echo "<br/>Page $page of $num_pages<br/>";
        echo "</div></p>";
        getfooter($sid);
        }
        usage
        try that on index.php
        Creator of
        Epix.Mobi

        Keep an Eye on us Big things coming soon!!!!
        Need something for your site hit me up here

        http://coding-talk.com/forum/main-fo...r-your-wapsite

        Comment


          #5
          tanx loony work perfect
          ________________
          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

          Comment

          Working...
          X