Bookmark Topic

Started on the old forum in July 2009 · view the original in the archive · old links redirect here

4 replies · 1,032 views · started 17 years ago · 2 min read

2 participants
riderz Lead · 975 posts #1

genproc.php

/////////////////////////////////////////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&sid=$sid&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/>»You Have Already Bookmarked This Topic!<br/>
  »You Have Reached The Limit Of Total Allowed Bookmarks!<br/>
 »Other Unknown Error!<br/>
 <br/><a href=\"index.php?action=viewtpc&sid=$sid&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&sid=$sid&tid=$tpcid\">Back To Topic</a>";
        echo "<br/><br/><a href=\"index.php?action=bookmarks&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&sid=$sid&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&sid=$sid\">Back To Bookmarks</a></center><br/><br/>";
}

index.php

////////////////////////////////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&sid=$sid&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&sid=$sid&tpcid=$item[2]\">(Remove)</a><br/><br/>";
}
          echo "<p>";
    if($page>1)
    {
      $ppage = $page-1;
        $rets = "<form action=\"index.php?action=$action&sid=$sid&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&sid=$sid&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

echo "<a href=\"index.php?action=bookmarks&sid=$sid\">Manage Bookmarks</a><br/>";

in else if($action=="tpcopt")

echo "<a href=\"genproc.php?action=bkmrk&sid=$sid&tid=$tid\">Bookmark This Topic</a><br/>";

sql

--
-- 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

riderz Lead · 975 posts #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

Loony Senior · 258 posts #4
////////////////////////////////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&sid=$sid&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&sid=$sid&tpcid=$item[2]\">(Remove)</a><br/><br/>";
}
          echo "<p>";
    if($page>1)
    {
      $ppage = $page-1;
        $rets = "<form action=\"index.php?action=$action&sid=$sid&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&sid=$sid&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-forums/marketplace/153110-free-features-for-your-wapsite

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close