Mindcontroll Forum Index
Mindcontroll Forum Index FAQ Memberlist Search

Mindcontroll Forum Index » Programs/Programming Development » Help Goto Last thread.
Post new topic  Reply to topic View previous topic :: View next topic 
Help Goto Last thread.
PostPosted: 11-05-2002 11:55 PM Reply with quote
M0nKeY
- Remember -
Joined: 09 Feb 2002
Posts: 1235




Can somone turn this into "Goto Last THREAD"?
Code:

// goto last post
if ($goto=="lastpost") {
  if (isset($threadid) and $threadid!=0) {
    $threadid = verifyid("thread",$threadid);

    if ($getlastpost=$DB_site->query_first("SELECT postid,post.dateline FROM post,thread WHERE post.threadid=thread.threadid AND thread.threadid='$threadid' AND post.visible=1 AND thread.visible=1 ORDER BY post.dateline DESC LIMIT 1")) {
      header("Location: shownews.php?s=$session[sessionhash]&postid=$getlastpost[postid]");
      exit;
    }
  }
  if (isset($forumid) and $forumid!=0) {
    $foruminfo=verifyid("forum",$forumid,1,1);
    $forumid=$foruminfo['forumid'];

      $forumslist = "";
      $getchildforums=$DB_site->query("SELECT forumid,parentlist FROM forum WHERE INSTR(CONCAT(',',parentlist,','),',$forumid,')>0");
      while ($getchildforum=$DB_site->fetch_array($getchildforums)) {
         if ($getchildforum[forumid]==$forumid) {
            $parentlist=$getchildforum[parentlist];
         }
         $forumslist.=",$getchildforum[forumid]";
      }

    $thread=$DB_site->query_first("SELECT threadid FROM thread WHERE forumid IN (0$forumslist) AND visible=1 AND (sticky=1 OR sticky=0) AND lastpost>='".($foruminfo[lastpost]-30)."' AND open<>10 ORDER BY lastpost DESC LIMIT 1");

    if ($getlastpost=$DB_site->query_first("SELECT postid FROM post WHERE threadid='$thread[threadid]' AND visible=1 ORDER BY postid DESC LIMIT 1")) {
      header("Location: shownews.php?s=$session[sessionhash]&postid=$getlastpost[postid]");
      exit;
    }
  }
}

_________________
"Am I a man dreaming of a butterfly or a butterfly dreaming of a man?"
View user's profile Find all posts by %s Send private message Send e-mail Visit poster's website AIM Address

PostPosted: 11-06-2002 01:32 AM Reply with quote
TuMTuM
Will code HTML for food!
Joined: 17 Feb 2002
Posts: 425




Try changing:
Code:

header("Location: shownews.php?s=$session[sessionhash]&postid=$getlastpost[postid]");


to:

Code:

header("Location: shownews.php?s=$session[sessionhash]&postid=$getlastpost[postid]&#$getlastpost[postid]");


(Oh my god, is that vb code, cause they could have made it look so much better... tsk. tsk. )
View user's profile Find all posts by %s Send private message Send e-mail

PostPosted: 11-06-2002 01:38 AM Reply with quote
M0nKeY
- Remember -
Joined: 09 Feb 2002
Posts: 1235




Um no... I want it to return the last THREAD number.. not goto a POSt. Dur.
View user's profile Find all posts by %s Send private message Send e-mail Visit poster's website AIM Address

PostPosted: 11-06-2002 02:21 AM Reply with quote
TuMTuM
Will code HTML for food!
Joined: 17 Feb 2002
Posts: 425




Well, the piece of code you pasted is for going to the last post, I dont think it has anything to do with the last thread on the board. But, threads and posts are seperated in the database, so all you have to do is query the database to give you the last (or 10) thread(s) where the forumid is the forumid of the news page. (I am right here, am I not?)

I cant really help tough, I have to work on some stuff first, after that comes some more stuff, and after that I am free to do whatever I want.

Code:

$query = "SELECT * FROM threads WHERE forumid = '".$forumid."' ORDER BY threadid LIMIT 0, 5";
View user's profile Find all posts by %s Send private message Send e-mail

PostPosted: 11-06-2002 06:16 AM Reply with quote
Dawgy
Burn your flag.
Joined: 09 Feb 2002
Posts: 463




VB is satan (according to pezko)

Oh, and if you really want to see BAD BAD php, look at phpnuke
View user's profile Find all posts by %s Send private message Send e-mail

PostPosted: 11-06-2002 08:14 AM Reply with quote
TuMTuM
Will code HTML for food!
Joined: 17 Feb 2002
Posts: 425




Soon, very, very soon, ill start working on my own CMS, ala djammhaus and shn's system, only with a personal forum and and ratings! So basically im gonna try making what we discussed earlier, and im already writing classes for it, cause im using that code in my current project as well. (CMS for my dads company).
I dont want any help tough! Working alone is so much easier then working in a group. Dont count on seeing it before I finished it as well, wich will take quite some time.
View user's profile Find all posts by %s Send private message Send e-mail

PostPosted: 11-06-2002 10:09 AM Reply with quote
Pezko
Senior Member
Joined: 09 Feb 2002
Posts: 186




*questions the relevance of TumTum's latest post in this thread*

*points out that working in group is much more efficient if properly managed*
View user's profile Find all posts by %s Send private message

PostPosted: 11-06-2002 12:13 PM Reply with quote
TuMTuM
Will code HTML for food!
Joined: 17 Feb 2002
Posts: 425




lol, pezko, you think you could handle a group with all the lunatics we have in the chan? Anyway, mine will just be something simple.
View user's profile Find all posts by %s Send private message Send e-mail

PostPosted: 11-06-2002 02:26 PM Reply with quote
Shn
R.I.P.
Joined: 10 Feb 2002
Posts: 738




TuMTuM wrote:

Code:

$query = "SELECT * FROM threads WHERE forumid = '".$forumid."' ORDER BY threadid LIMIT 0, 5";


taking tumtum's code as a base, here's the last thread:

Code:

$query = "SELECT * FROM threads WHERE forumid = '$forumid' ORDER BY threadid DESC LIMIT 1;";


what i changed: putting ".$forumid." is useless cause the query is between 2 "... at least i think it works like echo, print,...

i added 'DESC' so it'll be ordered in DESCending order...
and LIMIT 1 cause you just want one thread.
View user's profile Find all posts by %s Send private message Send e-mail

PostPosted: 11-06-2002 02:30 PM Reply with quote
TuMTuM
Will code HTML for food!
Joined: 17 Feb 2002
Posts: 425




Its called proper coding, I have all my strings outside of the "s or 's. And I tought stuff got sorted DESC automatically. anyway, i was at work when I posted that and didnt bother looking anything up.
View user's profile Find all posts by %s Send private message Send e-mail

PostPosted: 11-06-2002 02:59 PM Reply with quote
Pezko
Senior Member
Joined: 09 Feb 2002
Posts: 186




Quote:
Its called proper coding, I have all my strings outside of the "s or 's.

K. Proper coding... And why isn't it proper coding to do like Shn did?

Quote:
lol, pezko, you think you could handle a group with all the lunatics we have in the chan?

Withdraws statement... Very Happy
View user's profile Find all posts by %s Send private message

PostPosted: 11-06-2002 05:26 PM Reply with quote
Shn
R.I.P.
Joined: 10 Feb 2002
Posts: 738




i always use ' for queries and echos... except for a few very rare exceptions.

And, if it isn't proper coding to put echo "$boop";
then MANY php programmers don't code properly.

Oh, and proper coding requires to know what the stuff you code does, don't you think ?


Now, about the group work. There are indeed some people in the chan that couldn't work as a group (or at all). But some of us are able to share ideas and code and help each other in an intelligent way.
I'm sure a few of the people in the chan are able to communicate correctly their ideas.

k, bye.

_________________

The Shning, more useful than The Useful Site
View user's profile Find all posts by %s Send private message Send e-mail

PostPosted: 11-06-2002 05:50 PM Reply with quote
Pezko
Senior Member
Joined: 09 Feb 2002
Posts: 186




Shn wrote:

Now, about the group work. There are indeed some people in the chan that couldn't work as a group (or at all). But some of us are able to share ideas and code and help each other in an intelligent way.
I'm sure a few of the people in the chan are able to communicate correctly their ideas.

k, bye.


Yes, few...
View user's profile Find all posts by %s Send private message

PostPosted: 11-07-2002 02:36 AM Reply with quote
TuMTuM
Will code HTML for food!
Joined: 17 Feb 2002
Posts: 425




Can I close this thread? Its gone way off topic and is starting to become a flame war. Yeah, ill close it, if you want to reopen it, only do so because you want to get back ontopic.
View user's profile Find all posts by %s Send private message Send e-mail

Help Goto Last thread.
 Mindcontroll Forum Index » Programs/Programming Development
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You can vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Post new topic  Reply to topic  


Video Games Suck - XXXSwim - Archive
  Powered by phpBB © 2001-2005 phpBB Group. Designed for Trushkin.net | Themes Database