Guess accedd

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

No replies · 674 views · started 17 years ago · 6 min read

riderz Lead · 975 posts #1

i have this code but not working 100% so please do help usage

echo "<a href=\"index.php?action=gforumindx\">Guest Access</a><br/>";

anyplace in the index or its own index

////////////////////////////////// GUEST View category

else if($action=="gviewcat")
{
      echo "<head>\n";
          echo "<title>SpiderWap</title>\n";
      echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/style.css\" />";
                    echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />\n";
      echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />\n";
      echo "<meta http-equiv=\"Pragma\" content=\"no-cache\" />\n";

          echo "</head>";
      echo "<body>";

  $uid = getuid_sid($sid);  $cid = $_GET["cid"];
  addonline(getuid_sid($sid),"Viewing Forum Category","index.php?action=gviewcat&cid=$cid");
  $cinfo = mysql_fetch_array(mysql_query("SELECT name from ibwf_fcats WHERE id='".$cid."'"));
  echo "<p align=\"center\">";
  echo "<img src=\"images/logo.gif\" alt=\"Forums\"/>";
  echo "Catagory\n";
  echo "</p>";
  echo "<div align=\"left\" style=\"border:#CC3300 medium solid\">\n";
  $forums = mysql_query("SELECT id, name FROM ibwf_forums WHERE cid='".$cid."' AND clubid='0' ORDER BY position, id, name");
  while($forum = mysql_fetch_array($forums))
  {
  $notp = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$forum[0]."'"));
  $nops = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts a INNER JOIN ibwf_topics b ON a.tid = b.id WHERE b.fid='".$forum[0]."'"));
  $iml = "<img src=\"images/1.gif\" alt=\"*\"/>";
  echo "<a href=\"index.php?action=gviewfrm&sid=$sid&fid=$forum[0]\">$iml$forum[1]($notp[0]/$nops[0])</a><br/>";
  $lpt = mysql_fetch_array(mysql_query("SELECT id, name FROM ibwf_topics WHERE fid='".$forum[0]."' ORDER BY lastpost DESC LIMIT 0,1"));
  $nops = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$lpt[0]."'"));
  if($nops[0]==0)
  {
  $pinfo = mysql_fetch_array(mysql_query("SELECT authorid FROM ibwf_topics WHERE id='".$lpt[0]."'"));
  $tluid = $pinfo[0];
  }else{
  $pinfo = mysql_fetch_array(mysql_query("SELECT  uid  FROM ibwf_posts WHERE tid='".$lpt[0]."' ORDER BY dtpost DESC LIMIT 0, 1"));
  $tluid = $pinfo[0];
  }
  $tlnm = htmlspecialchars($lpt[1]);
  $tlnick = getnick_uid($tluid);
  $tpclnk = "<a href=\"index.php?action=gviewtpc&sid=$sid&tid=$lpt[0]&go=last\">$tlnm</a>";
  $vulnk = "<a href=\"index.php?action=viewuser&sid=$sid&who=$tluid\">$tlnick</a>";
  if($pinfo[0]>0)
  {
  echo "Last Post: $tpclnk<br/>By: $vulnk<br/>";
  }
  }
  echo "<br/>";
  echo "</div>";
  echo "<p align=\"center\">";
  echo "<br/><a href=\"register.php\">Register</a><br/>";
  echo "<br/><a href=\"index.php?action=gforumindx&sid=$sid\">Forums</a><br/>";
  echo "<br/><a href=\"index.php\"><img src=\"images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
  echo "</body>";
  echo "</html>";
  exit();
}

///////////

////////////////////////////////// GUEST View Topic

else if($action=="gviewtpc")
{

      echo "<head>\n";
          echo "<title>SpiderWap</title>\n";
      echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/style.css\" />";
                    echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />\n";
      echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />\n";
      echo "<meta http-equiv=\"Pragma\" content=\"no-cache\" />\n";

          echo "</head>";
      echo "<body>";

  $tid = $_GET["tid"];
  $go = $_GET["go"];
  addonline(getuid_sid($sid),"Viewing Forum Topic","index.php?action=gviewtpc&tid=$tid");
  $tfid = mysql_fetch_array(mysql_query("SELECT fid FROM ibwf_topics WHERE id='".$tid."'"));
  
  $uid =getuid_sid($sid);  
  if($uid>0)

    {
      echo "<p align=\"center\">";
      echo "You Don't Have A Permission To View The Contents Of This Forum<br/><br/>";
      echo "<a href=\"index.php?action=gmain&sid=$sid\">Home</a>";
      echo "</p>";
      echo "</body>";
      echo "</html>";
      exit();
    }
    
    $tinfo = mysql_fetch_array(mysql_query("SELECT name, text, authorid, crdate, views, fid, pollid from ibwf_topics WHERE id='".$tid."'"));
    $tnm = htmlspecialchars($tinfo[0]);
    echo "<p align=\"center\">";
        echo "Viewing Topic";
        echo "</p>";
        echo "<div align=\"left\" style=\"border:#CC3300 medium solid\">\n";
    $num_pages = getnumpages($tid);
    if($page==""||$page<1)$page=1;
    if($go!="")$page=getpage_go($go,$tid);
    $posts_per_page = 5;
    if($page>$num_pages)$page=$num_pages;
    $limit_start = $posts_per_page *($page-1);

    $lastlink = "<a href=\"index.php?action=$action&tid=$tid&sid=$sid&go=last\">Last Page</a>";
    $firstlink = "<a href=\"index.php?action=$action&tid=$tid&sid=$sid&page=1\">First Page</a> ";
    $golink = "";
    if($page>1)
    {
      $golink = $firstlink;
    }
    if($page<$num_pages)
    {
      $golink .= $lastlink;
    }
    if($golink !="")
    {
      echo "<br/>$golink";
    }
    $vws = $tinfo[4]+1;
    $rpls = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$tid."'"));
    echo "Replies: $rpls[0] - Views: $vws<br/>";
    ///fm here
    
    if($page==1)
    {
      $posts_per_page=4;
      mysql_query("UPDATE ibwf_topics SET views='".$vws."' WHERE  id='".$tid."'");
      $ttext = mysql_fetch_array(mysql_query("SELECT authorid, text, crdate, pollid FROM ibwf_topics WHERE id='".$tid."'"));
      $unick = getnick_uid($ttext[0]);
      if(isonline($ttext[0]))
    {
      $iml = "<img src=\"images/onl.gif\" alt=\"+\"/>";
    }else{
        $iml = "<img src=\"images/ofl.gif\" alt=\"-\"/>";
    }
    $usl = "<br/><a href=\"index.php?action=viewuser&sid=$sid&who=$ttext[0]\">$iml$unick</a>";
    $topt = "<a href=\"index.php?action=tpcopt&sid=$sid&tid=$tid\">*</a>";
    if($go==$tid)
    {
      $fli = "<img src=\"images/flag.gif\" alt=\"!\"/>";
    }else{
      $fli ="";
    }
    $pst = parsemsg($ttext[1],$sid);
    echo "$usl: $fli$pst $topt<br/>";
    $dtot = date("d-m-y - H:i:s",$ttext[2]);
    echo $dtot;
    echo "<br/>";
    if($ttext[3]>0)
    {
      echo "<a href=\"index.php?action=viewtpl&sid=$sid&who=$tid\">POLL</a><br/>";
    }
  }
  if($page>1)
  {
    $limit_start--;
  }
  $sql = "SELECT id, text, uid, dtpost, quote FROM ibwf_posts WHERE tid='".$tid."' ORDER BY dtpost LIMIT $limit_start, $posts_per_page";
  $posts = mysql_query($sql);
  while($post = mysql_fetch_array($posts))
  {
    $unick = getnick_uid($post[2]);
    if(isonline($post[2]))
    {
      $iml = "<img src=\"images/onl.gif\" alt=\"+\"/>";
    }else{
        $iml = "<img src=\"images/ofl.gif\" alt=\"-\"/>";
    }
    $usl = "<br/><a href=\"index.php?action=viewuser&sid=$sid&who=$post[2]\">$iml$unick</a>";
    $pst = parsemsg($post[1], $sid);
    $topt = "<a href=\"index.php?action=pstopt&sid=$sid&pid=$post[0]&page=$page&fid=$tinfo[5]\">*</a>";
    if($post[4]>0)
    {
        $qtl = "<small><i><a href=\"index.php?action=gviewtpc&sid=$sid&tid=$tid&pst=\">(quote:p=blaze,d=16-04-2006)</a></i></small>";
    }
    if($go==$post[0])
    {
      $fli = "<img src=\"images/flag.gif\" alt=\"!\"/>";
    }else{
      $fli ="";
    }
    echo "$usl: $fli$pst $topt<br/>";
    $dtot = date("d-m-y - H:i:s",$post[3]);
    echo $dtot;
    echo "<br/>";
  }
    ///to here
    echo "</div>";
    echo "<p align=\"center\">";
    if($page>1)
    {
      $ppage = $page-1;
      echo "<a href=\"index.php?action=gviewtpc&page=$ppage&sid=$sid&tid=$tid\">«PREV</a> ";
    }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"index.php?action=gviewtpc&page=$npage&sid=$sid&tid=$tid\">Next»</a>";
    }
    echo "<br/>$page/$num_pages<br/>";
    if($num_pages>2)
    {
      $rets = "<form action=\"index.php\" method=\"get\">";
        $rets .= "<input name=\"page\" style=\"-wap-input-format: '*N'\" size=\"2\"/>";
        $rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
        $rets .= "<input type=\"hidden\" name=\"tid\" value=\"$tid\"/>";
        $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
        $rets .= "<input type=\"Submit\" value=\"Go To Page\" Name=\"Submit\"/></form>";

        echo $rets;
    }
  echo "<br/>";

  $fid = $tinfo[5];
  $fname = getfname($fid);
  $cid = mysql_fetch_array(mysql_query("SELECT cid FROM ibwf_forums WHERE id='".$fid."'"));
  $cinfo = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_fcats WHERE id='".$cid[0]."'"));
  $cname = $cinfo[0];
  $cid = mysql_fetch_array(mysql_query("SELECT cid FROM ibwf_forums WHERE id='".$fid."'"));
  $fname = htmlspecialchars($fname);
  echo "<a href=\"index.php?action=gviewfrm&sid=$sid&fid=$fid\">Back To $fname</a><br/>";
  if($cid[0]>0)
  {
  $cinfo = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_fcats WHERE id='".$cid[0]."'"));
  $cname = htmlspecialchars($cinfo[0]);
  echo "<br/><a href=\"index.php?action=gviewcat&sid=$sid&cid=$cid[0]\">$cname</a><br/>";

echo "<br/><a href=\"register.php\">Register</a><br/>";

  echo "<br/><a href=\"index.php?action=gforumindx\">Forums</a><br/>";

  }else{
  $cid = mysql_fetch_array(mysql_query("SELECT clubid FROM ibwf_forums WHERE id='".$fid."'"));
  $cinfo = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_clubs WHERE id='".$cid[0]."'"));
  $cname = htmlspecialchars($cinfo[0]);
  echo "<a href=\"index.php?action=gocl&sid=$sid&clid=$cid[0]\">$cname Club</a><br/>";
  
  }
  
   
  echo "<br/>";
  
  echo "</p>";
  
  echo "<p align=\"center\">";
  
  echo "<br/><a href=\"index.php\"><img src=\"images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
    echo "</body>";
        echo "</html>";
        exit();
}
////////////////////////////////// GUEST View Forum

else if($action=="gviewfrm")
{

       echo "<head>\n";
          echo "<title>SpiderWap</title>\n";
      echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/style.css\" />";
                    echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />\n";
      echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />\n";
      echo "<meta http-equiv=\"Pragma\" content=\"no-cache\" />\n";

          echo "</head>";
      echo "<body>";

  
  
                $uid = getuid_sid($sid);
                $fid = $_GET["fid"];
    $view = $_GET["view"];
   $uid =getuid_sid($sid);
  if($uid>0)
    
    {
      addonline(getuid_sid($sid),"im viewing admin forum naughty me","");
      echo "<p align=\"center\">";
      echo "You Don't Have A Permission To View The Contents Of This Forum<br/><br/>";
      echo "<a href=\"index.php?action=gmain&sid=$sid\">Home</a>";
      echo "</p>";
      echo "</body>";
      echo "</html>";
      exit();
    }
    addonline(getuid_sid($sid),"Viewing Forum","index.php?action=gviewfrm&sid=$sid&fid=$fid");
    $finfo = mysql_fetch_array(mysql_query("SELECT name from ibwf_forums WHERE id='".$fid."'"));
    $fnm = htmlspecialchars($finfo[0]);
    echo "<p align=\"center\">";
    $norf = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_rss WHERE fid='".$fid."'"));
    if($norf[0]>0)
    {
    echo "<a href=\"rwrss.php?action=showfrss&sid=$sid&fid=$fid\"><img src=\"images/rss.gif\" alt=\"rss\"/>$finfo[0] Extras</a><br/>";
    }

    echo "<form action=\"index.php\" method=\"get\">";
    echo "View: <select name=\"view\">";
    echo "<option value=\"all\">All</option>";
    echo "<option value=\"new\">Since Last Visit</option>";
    echo "<option value=\"myps\">I posted In</option>";
    echo "</select>";
    echo "<input type=\"submit\" value=\"Go\"/>";
    echo "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
    echo "<input type=\"hidden\" name=\"fid\" value=\"$fid\"/>";
    echo "<input type=\"hidden\" name=\"sid\"  value=\"$sid\"/>";
    echo "</form>";
    echo "<br/>";
        if($view=="new")
        {
                echo "<small>Viewing topics that has no new posts since your last visit</small>";
        }else if($view=="myps")
        {
                echo "<small>Viewing topics contain posts by you</small>";
        }else {
        echo "<small>Viewing All topics</small>";
        }
    echo "</p>";
    echo "<p align=\"center\">";
    if($page=="" || $page<=0)$page=1;
    if($page==1)
    {
      ///////////pinned topics
      $topics = mysql_query("SELECT id, name, closed, views, pollid FROM ibwf_topics WHERE fid='".$fid."' AND pinned='1' ORDER BY lastpost DESC, name, id LIMIT 0,5");
      while($topic = mysql_fetch_array($topics))
    {
      $iml = "<img src=\"images/normal.gif\" alt=\"*\"/>";
      $iml = "*";
      $atxt ="";
      if($topic[2]=='1')
      {
        //closed
        $atxt = "(X)";
      }
      if($topic[4]>0)
      {
        $pltx = "(P)";
      }else{
        $pltx = "";
      }
      $tnm = htmlspecialchars($topic[1]);
      $nop = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$topic[0]."'"));
      echo "<a href=\"index.php?action=gviewtpc&sid=$sid&tid=$topic[0]\">$iml$pltx$tnm($nop[0])$atxt</a><br/>";

    }
    echo "<br/>";
  }
  $uid = getuid_sid($sid);
  if($view=="new")
  {
  
  $ulv = mysql_fetch_array(mysql_query("SELECT lastvst FROM ibwf_users WHERE id='".$uid."'"));
  $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$fid."' AND pinned='0' AND lastpost >='".$ulv[0]."'"));
  }
  else if($view=="myps")
  {
        $noi = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT a.id) FROM ibwf_topics a INNER JOIN ibwf_posts b ON a.id = b.tid WHERE a.fid='".$fid."' AND a.pinned='0' AND b.uid='".$uid."'"));
  }
  else{
  $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$fid."' AND pinned='0'"));
  }
    $num_items = $noi[0]; //changable
    $items_per_page= 10;
    $num_pages = ceil($num_items/$items_per_page);
    if($page>$num_pages)$page= $num_pages;
    $limit_start = ($page-1)*$items_per_page;
    if($limit_start<0)$limit_start=0;
        if($view=="new")
        {
        $ulv = mysql_fetch_array(mysql_query("SELECT lastvst FROM ibwf_users WHERE id='".$uid."'"));
    $topics = mysql_query("SELECT id, name, closed, views, moved, pollid FROM ibwf_topics WHERE fid='".$fid."' AND pinned='0' AND lastpost >='".$ulv[0]."' ORDER BY lastpost DESC, name, id LIMIT $limit_start, $items_per_page");
        }
        else if($view=="myps"){
        $topics = mysql_query("SELECT a.id, a.name, a.closed, a.views, a.moved, a.pollid FROM ibwf_topics a INNER JOIN ibwf_posts b ON a.id = b.tid WHERE a.fid='".$fid."' AND a.pinned='0' AND b.uid='".$uid."' GROUP BY a.id ORDER BY a.lastpost DESC, a.name, a.id  LIMIT $limit_start, $items_per_page");
        }
        else{
        $topics = mysql_query("SELECT id, name, closed, views, moved, pollid FROM ibwf_topics WHERE fid='".$fid."' AND pinned='0' ORDER BY lastpost DESC, name, id LIMIT $limit_start, $items_per_page");
        }
    
    while($topic = mysql_fetch_array($topics))
    {
      
      $nop = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$topic[0]."'"));
      $iml = "<img src=\"images/normal.gif\" alt=\"*\"/>";
      if($nop[0]>24)
      {
        $iml = "<img src=\"images/hot.gif\" alt=\"*\"/>";
      }
      if($topic[4]=='1')
      {
        $iml = "<img src=\"images/moved.gif\" alt=\"*\"/>";
      }
      if($topic[2]=='1')
      {
        $iml = "<img src=\"images/closed.gif\" alt=\"*\"/>";
      }
      if($topic[5]>0)
      {
        $iml = "<img src=\"images/poll.gif\" alt=\"*\"/>";
      }
      $atxt ="";
      if($topic[2]=='1')
      {
        //closed
        $atxt = "(X)";
      }
      $tnm = htmlspecialchars($topic[1]);
      echo "<a href=\"index.php?action=gviewtpc&sid=$sid&tid=$topic[0]\">$iml$tnm($nop[0])$atxt</a><br/>";

    }

    echo "</p>";
    echo "<p align=\"center\">";

    if($page>1)
    {
      $ppage = $page-1;
      echo "<a href=\"index.php?action=gviewfrm&page=$ppage&sid=$sid&fid=$fid&view=$view\">«PREV</a> ";
    }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "<a href=\"index.php?action=gviewfrm&page=$npage&sid=$sid&fid=$fid&view=$view\">Next»</a>";
    }
    echo "<br/>$page/$num_pages<br/>";
    if($num_pages>2)
    {
        $rets = "<form action=\"index.php\" method=\"get\">";
        $rets .= "<input name=\"page\" style=\"-wap-input-format: '*N'\" size=\"2\"/>";
        $rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
        $rets .= "<input type=\"hidden\" name=\"fid\" value=\"$fid\"/>";
        $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
          $rets .= "<input type=\"hidden\" name=\"view\" value=\"$view\"/>";
        $rets .= "<input type=\"submit\" value=\"Go To Page\"/>";
        $rets .= "</form>";

        echo $rets;
    }

    $cid = mysql_fetch_array(mysql_query("SELECT cid FROM ibwf_forums WHERE id='".$fid."'"));
    if($cid[0]>0)
    {

    $cinfo = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_fcats WHERE id='".$cid[0]."'"));
    $cname = htmlspecialchars($cinfo[0]);
    echo "<a href=\"index.php?action=gviewcat&sid=$sid&cid=$cid[0]\">$cname</a><br/>";

    }else{

        $cid = mysql_fetch_array(mysql_query("SELECT clubid FROM ibwf_forums WHERE id='".$fid."'"));
        $cinfo = mysql_fetch_array(mysql_query("SELECT name FROM ibwf_clubs WHERE id='".$cid[0]."'"));
        $cname = htmlspecialchars($cinfo[0]);
    echo "<a href=\"index.php?action=gocl&sid=$sid&clid=$cid[0]\">$cname Club</a><br/>";

    }

         //echo mobads();
  echo "<br/>";
  echo "</p>";
  echo "<p align=\"center\">";
  
  echo "<br/><a href=\"register.php\">Register</a><br/>";
  echo "<br/><a href=\"index.php?action=gforumindx\">Forums</a><br/>";
  echo "<br/><a href=\"index.php\"><img src=\"images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
    echo "</body>";
        echo "</html>";
}

when i click on the link it say u not loged in what could be wrong


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

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