vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Prevent Doubleposting (https://vborg.vbsupport.ru/showthread.php?t=40145)

Xenon 06-21-2002 10:00 PM

Prevent Doubleposting
 
This is why i really want a Mini-Hack section here, please Chen ;)

What this hack does:
When a User posts to a thread where he already has the lastpost, no new post will be added. The lastpost of him will be edited and the new text is put after his first message.
This would not be done, if he has an attachment in his new post or the old post is older than 1 hour (you can change this timespan yourself :))

Known bugs: None :)

Hope someone can use it, i do :)

Believe this hack includes just 1!! codehack.

darker1 06-22-2002 11:24 AM

sweet. been looking for something like this.

Chris M 06-22-2002 11:39 AM

Sweet hack!!

Satan

Xenon 06-22-2002 11:41 AM

thanx you 2 :)

ups, have seen one line is double in the attachment, delete one of the eval lines *gg*

have corrected it here :)

Chris M 06-22-2002 12:05 PM

Ok thanks:)

Satan

Link14716 06-22-2002 01:18 PM

Cool...

*Runs to install*
;)

MrLister 06-22-2002 02:57 PM

This is great, I'll just modify it a bit to be different per forum.

Xenon 06-22-2002 03:52 PM

feel free to do so, and please post the modifications here, who know who can use them else :)

Velocd 06-22-2002 07:18 PM

Excellent hack Xenon, this is truly userful ;)

One request: Can you make it so when the user does double post, and his post is merged with the first post, that on the bottom it will state:

Last edited by ... on 06-22-02 at 01:27 PM

This would be more useful, because in some ways if a user wants to add-on to their original post by bypassing the "edited by", all they would have to do is double post. This stops them though.

Logician 06-22-2002 07:20 PM

very nice idea Xenon. :)

May I suggest an improvement? Maybe you can add another query to $action=="newreply" section to check if he is the last poster to the thread. If he is, he can be pre-warned in the screen he writes his message that his last message will be replaced with this one.

This will add an extra query to newreply.php but it can save the user from losing his last message in the thread especially when the hack is new in the board.

BigJohnson 06-22-2002 07:29 PM

Ya that seems like a great feature. Both of them.

BigJohnson 06-22-2002 07:34 PM

When someone double posts does it bring the post back to the top of the Forum Display?

Velocd 06-22-2002 07:37 PM

No, the post will stay in its original position.

BigJohnson 06-22-2002 08:03 PM

Well how can you make it so that it goes back to the top. Wouldnt that make more sense? Can you please tell me how that can be done. Because what if someone wants to bump a topic that is far away down the Forum Display? Thanks

Velocd 06-23-2002 03:47 AM

There is a bump hack somewhere as I recall...
find it, install it, use it ;)

Lesane 06-23-2002 06:48 AM

Nice hack Xenon. Little but usefull.

Xenon 06-23-2002 11:12 AM

@Velocd: Ok, will do so :)

@Logician: Sorry, you have missunderstood something:
The old post won't be deleted, it would just became longer :)

@BigJonson: That's why theres also a timestamp in it, if the lastpost has been a long time ago then a real new post is put to the end of the thread, so it became bumped

Xenon 06-23-2002 12:08 PM

Velocd: i have updated the installation file, now it should add an edited by message :)

BigJohnson 06-23-2002 12:23 PM

Nope the txt file is not updated. No chages were made.

Xenon 06-23-2002 12:31 PM

???
it is, have just looked in it and it is updated.

$editsql="";....

if this line is in it it is updated, and as i can see here it is

Boofo 06-23-2002 12:40 PM

How about adding an Edit Reason, too (Like Firefly's Edit Reason hack)? That way we will know that they added to the message instead of just editing it. :)

Quote:

Originally posted by Xenon
Velocd: i have updated the installation file, now it should add an edited by message :)

BigJohnson 06-23-2002 12:42 PM

Ya can there be somewhere where it would say DOUBLE POSTING FEATURE and then under that it would show the message instead of just having a Break in the post and then the new edited message.

BigJohnson 06-23-2002 12:46 PM

Can you show the update. Maybe it has somehting to do with the cache. This is all i see
PHP Code:

      $lastpost $DB_site->query_first("SELECT * FROM post WHERE threadid = '$threadid' ORDER BY postid DESC");
      if(
$lastpost[userid]!=$bbuserinfo[userid] || (time()-$lastpost[dateline])>3600 || ($attachmentid and !$foruminfo[moderateattach])) {
            
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,attachmentid,pagetext,allowsmilie,showsignature,ipaddress,iconid,visible) VALUES (NULL,'$threadid','".addslashes(htmlspecialchars($title))."','".addslashes($postusername)."','$bbuserinfo[userid]','".time()."','$attachmentid','".addslashes($message)."','$allowsmilie','$signature','$ipaddress','$iconid','$visible')");
      } else {
            
$DB_site->query("UPDATE post SET pagetext='".addslashes($lastpost[pagetext]."\n\n".$message)."' WHERE postid=".$lastpost[postid]);
            if (
$visible) {
            
$goto="showthread.php?s=$session[sessionhash]&postid=".$lastpost[postid]."#post".$lastpost[postid];
              } else {
            
$goto="forumdisplay.php?s=$session[sessionhash]&forumid=$threadinfo[forumid]";
              }
              eval(
"standardredirect(\"".gettemplate("redirect_postthanks")."\",\"$goto\");");  
              exit;     
      } 


Xenon 06-23-2002 12:46 PM

Normally you can simply add this for yourself.

I won't add it to the hack because it's no standart in vb, so who hasn't installed chens hack would get an error.

I haven't installed chens hack so i don't know exactly how it works, but as i think adding one line and changing one should be enough

BigJohnson 06-23-2002 12:47 PM

bump. we both posted at the same time hehe.

Xenon 06-23-2002 12:49 PM

@Big: hmm, must have something to do with the cache thats what i have in the attachment:
PHP Code:

      $lastpost $DB_site->query_first("SELECT * FROM post WHERE threadid = '$threadid' ORDER BY postid DESC");
      if(
$lastpost[userid]!=$bbuserinfo[userid] || (time()-$lastpost[dateline])>3600 || ($attachmentid and !$foruminfo[moderateattach])) {
            
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,attachmentid,pagetext,allowsmilie,showsignature,ipaddress,iconid,visible) VALUES (NULL,'$threadid','".addslashes(htmlspecialchars($title))."','".addslashes($postusername)."','$bbuserinfo[userid]','".time()."','$attachmentid','".addslashes($message)."','$allowsmilie','$signature','$ipaddress','$iconid','$visible')");
      } else {
            
$editedbysql="";
            if (
$showeditedby and $lastpost[dateline]<(time()-($noeditedbytime*60))) {
               
$editedbysql=",edituserid='$bbuserinfo[userid]',editdate='".time()."'";
            }            

            
$DB_site->query("UPDATE post SET pagetext='".addslashes($lastpost[pagetext]."\n\n".$message)."'".$editedbysql." WHERE postid=".$lastpost[postid]);
            if (
$visible) {
            
$goto="showthread.php?s=$session[sessionhash]&postid=".$lastpost[postid]."#post".$lastpost[postid];
              } else {
            
$goto="forumdisplay.php?s=$session[sessionhash]&forumid=$threadinfo[forumid]";
              }
              eval(
"standardredirect(\"".gettemplate("redirect_postthanks")."\",\"$goto\");");  
              exit;     
      } 

Quote:

Ya can there be somewhere where it would say DOUBLE POSTING FEATURE and then under that it would show the message instead of just having a Break in the post and then the new edited message.
UPDATE post SET pagetext='".addslashes($lastpost[pagetext]."\n\n".$message)

replace the \n\n with whatever you want

BigJohnson 06-23-2002 01:18 PM

O thanks so much worked amazingly well.

Neo 06-23-2002 05:37 PM

amazing someone finally made this hack Oo... i had this like 4 month ago funny. Nice job.

Xenon 06-23-2002 06:33 PM

:)
and i has also wondered why no one has made that already ;)

X-Fan 06-24-2002 12:21 PM

I'm not finding this:

PHP Code:

(NULL,'$threadid','".addslashes(htmlspecialchars($title))."' 

in newreply.php - I've got:

PHP Code:

(NULL,'$threadid','".addslashes(htmlspecialchars($subject))."' 

Where $title should be. Any suggestions?

Xenon 06-24-2002 03:21 PM

hmm, which version of vb are you using?

try just change the $title in $subject in my replacements and implement it.

Link14716 06-24-2002 03:24 PM

Nice hack..... Thanks ;)

Smoothie 06-24-2002 04:30 PM

I'm finding the same as X-Fan. We should change $subject to $title?

Xenon 06-24-2002 04:43 PM

no change the $title in my instructions into $subject :)

i think it should work, but i don't really know, here at my files its $title :)

Smoothie 06-24-2002 05:05 PM

To change the time that the post would be new "new" instead of added to, is this the line that needs to be changed?
PHP Code:

$lastpost[dateline])>3600 


X-Fan 06-24-2002 11:54 PM

Well I don't really want to go installing a hack and changing a string value if noone is certain that it will work or not!

Can someone please check it first on a test board to make sure that changing $title to $subject works?

Xenon 06-25-2002 02:01 PM

@Smothie yes :)

@X-Fan: just make a backup of your newreply.php, if it doesn't work, you can upload your backup agin without any problems.

tell me what vb-version you use, because i couldn't find $subject in my newreply.php (except of the one which is used to send email to mods)

X-Fan 06-25-2002 02:14 PM

I'm using v2.2.5 if that helps any.

Xenon 06-25-2002 02:22 PM

arg, problems on this server now, can't acces to page 2 anymore....

hmm, i also use v2.2.5.
this is the part of the original file:
PHP Code:

if ($attachmentid and !$foruminfo[moderateattach]) {
        
$DB_site->query("UPDATE thread SET attach = attach + 1 WHERE threadid = '$threadid'");
      }
      
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,attachmentid,pagetext,allowsmilie,showsignature,ipaddress,iconid,visible) VALUES (NULL,'$threadid','".addslashes(htmlspecialchars($title))."','".addslashes($postusername)."','$bbuserinfo[userid]','".time()."','$attachmentid','".addslashes($message)."','$allowsmilie','$signature','$ipaddress','$iconid','$visible')");
      
$postid=$DB_site->insert_id();

      
indexpost($postid,0); 

if every $title is canged in $subject in your file, then it won' be a problem.
just replace evere $title in my hack with $subject. but i'm wondering why you have differen files then.

X-Fan 06-25-2002 02:32 PM

I've got that in my newreply.php as well. My board is a heavily-hacked one, so I'm wondering if it may be another hack that has changed that line?


All times are GMT. The time now is 01:40 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01673 seconds
  • Memory Usage 1,851KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete