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)
-   -   Download PMs to File (for all 2.x.x versions)" (https://vborg.vbsupport.ru/showthread.php?t=15859)

bart 04-06-2002 03:41 PM

I changed the script a little:

Code:

if ($what=="download") {
  if (is_array($privatemessage)) {
//                header("Content-disposition: filename=messages.txt");
//                header("Content-type: application/octet-stream");
//                header("Pragma: no-cache");
//                header("Expires: 0");
       
    while(list($key,$val)=each($privatemessage)) {
            $downloads=$DB_site->query_first("SELECT touserid,fromuserid,dateline,title,message FROM privatemessage WHERE privatemessageid='$key' AND userid=$bbuserinfo[userid]");
            $tousername=$DB_site->query_first("SELECT username FROM user WHERE userid='$downloads[touserid]'");
            $fromusername=$DB_site->query_first("SELECT username FROM user WHERE userid='$downloads[fromuserid]'");
            $msgdt = vbdate($dateformat,$downloads[dateline]);
            $msgtm = vbdate($timeformat,$downloads[dateline]);
            $wordwrap = wordwrap($downloads[message],75,"\r\n");
                   
  $dump .= "\r\nDate/Time Sent: $msgdt, $msgtm\r\n";
  $dump .= "from: $fromusername[username]\r\n";
  $dump .= "To: $tousername[username]\r\n";
  $dump .= "Subject: $downloads[title]\r\n\r\n";
  $dump .= "$wordwrap\r\n";
  $dump .= "\r\n==========================================================================\r\n";

} //end while

  mail("$bbuserinfo[email]","Download Private Messages","$dump","From: Title of your board <no_reply_emailaddress>");

  eval("standarderror(\"".gettemplate("pm_download_complete")."\");");
 exit;
           
} else {
  eval("standarderror(\"".gettemplate("error_pmnoselected")."\");");
  exit;
  }
}

Now the messages are send to the users emailaddress. In the template "pm_download_complete" you can warn them to check the email before deleting the messages.

LouChipher 04-06-2002 06:02 PM

@ bart, search the bug...
every user can see and download all pns... ;)

bart 04-06-2002 07:19 PM

Guess you're right, Lou. Thanks for your warning (though less for making it a puzzle).

Does this solve it?

Code:

        if ($what=="download") {
            if (is_array($privatemessage)) {
                        $pms = implode(",",array_keys($privatemessage));
                        $downloads=$DB_site->query("SELECT touserid,fromuserid,dateline,title,message FROM privatemessage WHERE privatemessageid IN ($pms) AND userid=$bbuserinfo[userid]");
                        while ($pm = mysql_fetch_array($downloads)) {
                            $tousername=$DB_site->query_first("SELECT username FROM user WHERE userid='$pm[touserid]'");
                            $fromusername=$DB_site->query_first("SELECT username FROM user WHERE userid='$pm[fromuserid]'");
                            $msgdt = vbdate($dateformat,$downloads[dateline]);
                            $msgtm = vbdate($timeformat,$downloads[dateline]);
                            $wordwrap = wordwrap($pm[message],75,"\r\n");
                           
                            $dump .= "\r\nDate/Time Sent: $msgdt, $msgtm\r\n";
                            $dump .= "From: $fromusername[username]\r\n";
                            $dump .= "To: $tousername[username]\r\n";
                            $dump .= "Subject: $pm[title]\r\n\r\n";
                            $dump .= "$wordwrap\r\n";
                            $dump .= "\r\n==========================================================================\r\n";
                        } //end while
                        mail("$bbuserinfo[email]","Download Private Messages","$dump","From: BOARD-TITLE <EMAILADDRESS>");
                  eval("standarderror(\"".gettemplate("pm_download_complete")."\");");
                  exit;   
            } else {
              eval("standarderror(\"".gettemplate("error_pmnoselected")."\");");
              exit;
          }
        }


LouChipher 04-07-2002 08:15 AM

looks bad... one of my moderators tell u what's wrong. btw he release a secure template version (save pms as a html file) in a few days.

lou

Cano2 04-08-2002 08:16 PM

Hi,
sorry forposting so late... didn't have much time


The most importent rule in web-programming is "never trust user input". But this rule is ignored here, so injection of SQL statements is possible...

[detailed description removed]

I have postet a very simmilar hack with enhanced functionality (templates...), which should be safe (uses verifyid() ) here: https://vborg.vbsupport.ru/showthrea...threadid=37172

bart 04-08-2002 09:33 PM

Oops.

Thanks for your reply Cano. I'll switch to your version soon as I have the time.

I couldn't do what you suggest is possible, but the thought of it maybe being possible is more then enough.

Maybe you should remove your post to not give someone a bad idea.

Boofo 04-29-2002 05:04 PM

Thanks zarkov, that fixed it. :-)

Boofo 04-29-2002 05:09 PM

Thanks for the great hack, bira! I am in the process of getting the board ready to go up and this will be a great addition and surprise for everyone. Keep up the great work!

Dark Shogun 08-21-2002 12:59 AM

I got a error. Does anyone know how to fix this? I have Ver. 2.2.6.

PHP Code:

Parse errorparse errorunexpected in /home/blarg/public_html/forum/member.php on line 1638 

Dark Shogun

Boofo 08-21-2002 01:21 AM

Show us the code a few lines up and a few lines after the error and we'll see if we can spot the problem.

Quote:

Originally posted by Dark Shogun
I got a error. Does anyone know how to fix this? I have Ver. 2.2.6.

PHP Code:

Parse errorparse errorunexpected in /home/blarg/public_html/forum/member.php on line 1638 

Dark Shogun


Dark Shogun 08-21-2002 08:31 AM

That reply via email thing double posted.

Dark Shogun

Dark Shogun 08-21-2002 03:20 PM

Problem fixed. It had nothing to do with this hack after all.

Dark Shogun

Dark Shogun 08-21-2002 03:38 PM

1 Problem with the hack. When it emails it to me it says it is from my server email address not my domain email address.

It says:

Quote:

From: EMAILADDRESS@server10.alwayswebhosting.com (BOARD-TITLE)
Dark Shogun

gmarik 06-24-2003 05:24 PM

Is there a way not to change the icon?
I mean the one with the floppy-disk or is it only on vb.org?


All times are GMT. The time now is 01:16 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.01227 seconds
  • Memory Usage 1,764KB
  • 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
  • (2)bbcode_code_printable
  • (2)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
  • (14)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