boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Email posting to a friend, revisited
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    boardom Forum Index -> Hacks
View previous topic :: View next topic  
Author Message
cjc



Joined: 24 Dec 2002
Posts: 146
Location: New York

PostPosted: Wed Mar 19, 2003 8:41 pm    Post subject: Reply with quote

OK, two issues:

1. I left off a ?> to close the <?php in the install file.

2. There seems to be a spurious line break in the posted code, probably from the cutting and pasting I did when I posted. The line beginning with "$q = mysql_query" should all be one line, and the mysql_error() at the end of that line should, of course, be one command, not something broken across two lines.
Back to top
View user's profile Send private message Visit poster's website
blog17



Joined: 28 Jan 2003
Posts: 144
Location: London, UK

PostPosted: Fri Mar 21, 2003 4:10 pm    Post subject: Reply with quote

Excellent, it works perfectly now.

http://mjnewsonline.com
_________________
Check this out! The ULTIMATE site!
Back to top
View user's profile Send private message Visit poster's website
Sansnom



Joined: 31 Jan 2002
Posts: 94
Location: Paris

PostPosted: Wed Apr 09, 2003 3:18 am    Post subject: in fine Reply with quote

Could we have the good final version of the file ? I must made a mistake but when I follow corrections, it doesn't work ! Please Help !
Thankx
_________________
http://www.sansfin.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
cjc



Joined: 24 Dec 2002
Posts: 146
Location: New York

PostPosted: Wed Apr 09, 2003 4:10 am    Post subject: Re: in fine Reply with quote

Sansnom wrote:
Could we have the good final version of the file ? I must made a mistake but when I follow corrections, it doesn't work ! Please Help !
Thankx


OK, it should be available for download at:

http://www.cjc.org/blog/files/b2mailpost.zip
Back to top
View user's profile Send private message Visit poster's website
Edlef



Joined: 16 Mar 2002
Posts: 71

PostPosted: Sat Apr 19, 2003 9:40 am    Post subject: Error? Reply with quote

i've tried to install the final version, but i get this error:

Code:
Can not to execute query.SELECT post_title, cat_name, user_nickname, DATE_FORMAT(post_date, '%m/%d/%Y @ %l:%i%p') as post_date, post_content FROM b2users, b2posts, b2categories WHERE b2posts.post_category = b2categories.cat_ID AND b2posts.post_author = b2users.ID AND b2posts.ID=

The table b2mailpostlog exists...
You can see in on my Testblog at http://graf.netbib.de
Any hints?
Thankyou and greetings
Edlef
Back to top
View user's profile Send private message Visit poster's website
cjc



Joined: 24 Dec 2002
Posts: 146
Location: New York

PostPosted: Sat Apr 19, 2003 1:29 pm    Post subject: Re: Error? Reply with quote

Edlef wrote:
i've tried to install the final version, but i get this error:

Code:
Can not to execute query.SELECT post_title, cat_name, user_nickname, DATE_FORMAT(post_date, '%m/%d/%Y @ %l:%i%p') as post_date, post_content FROM b2users, b2posts, b2categories WHERE b2posts.post_category = b2categories.cat_ID AND b2posts.post_author = b2users.ID AND b2posts.ID=

The table b2mailpostlog exists...
You can see in on my Testblog at http://graf.netbib.de
Any hints?
Thankyou and greetings
Edlef


Strange. What hacks do you have in place?

Also, create a new file in your b2 directory with the following code:
Code:

<?
include ("b2config.php");
require_once ($b2inc.'/b2vars.php');
require_once ($b2inc.'/b2template.functions.php');
require_once ($b2inc.'/b2functions.php');

$query = "The ID is:'$p'";

print $query;
?>


Say, you name the file foo.php. The web address would then be something like http://graf.netbib.de/foo.php.

I'd like to see if the $p variable is being passed properly, so http://graf.netbib.de/foo.php?p=4000 will generate a web page that just says "The ID is: '4000'". The problem you're getting is that the $p variable, which identifies the post you want to email, isn't being passed to the b2mailpost.php script for some reason.
Back to top
View user's profile Send private message Visit poster's website
Edlef



Joined: 16 Mar 2002
Posts: 71

PostPosted: Sat Apr 19, 2003 2:07 pm    Post subject: foo.php Reply with quote

Hi cjc,

i have the file foo.php on the server, and the ID is not passed correct Sad
What makes me wonder is: I have also installed the Print-Hack, and this hack works wonderful.

Thanks for your support!
Greetings
Edlef
Back to top
View user's profile Send private message Visit poster's website
cjc



Joined: 24 Dec 2002
Posts: 146
Location: New York

PostPosted: Sat Apr 19, 2003 2:13 pm    Post subject: Re: foo.php Reply with quote

Edlef wrote:
Hi cjc,

i have the file foo.php on the server, and the ID is not passed correct Sad
What makes me wonder is: I have also installed the Print-Hack, and this hack works wonderful.

Thanks for your support!
Greetings
Edlef


I'm going to modify my code to make the variable passing a bit more explicit (as well as do a POST method; silly of me not to). I'll have something by later today, if my errands don't distract me too much.
Back to top
View user's profile Send private message Visit poster's website
Edlef



Joined: 16 Mar 2002
Posts: 71

PostPosted: Sat Apr 19, 2003 2:18 pm    Post subject: WHOW Reply with quote

THAT was quick!!!! Very Happy

Thanks
Back to top
View user's profile Send private message Visit poster's website
cjc



Joined: 24 Dec 2002
Posts: 146
Location: New York

PostPosted: Sat Apr 19, 2003 9:53 pm    Post subject: Reply with quote

OK, it's a register_globals issue. I haven't written it so that it can be run with register_globals turned off (which is bad on my part).

You'll need to put the following up near the top, say, just above the $antispamtimer line:

Code:
$b2varstoreset = array('p', 'submit', 'email_from', 'email_to', 'shortmsg');

   for ($i=0; $i<count($b2varstoreset); $i += 1) {
      $b2var = $b2varstoreset[$i];
      if (!isset($$b2var)) {
         if (empty($HTTP_POST_VARS[$b2var])) {
            if (empty($HTTP_GET_VARS[$b2var])) {
               $$b2var = '';
            } else {
               $$b2var = $HTTP_GET_VARS[$b2var];
            }
         } else {
            $$b2var = $HTTP_POST_VARS[$b2var];
         }
      }
   }


This will get the correct variables.

Also, for neatness, at around line 107 of the new file, you'll see a like that looks like:
Code:

<form action="<?php echo $siteurl . '/b2mailpost.php?p=' . $p ; ?>">


Let's use the POST method, which is a better way of doing things. So, your line will now look like:

Code:

  <form method="post" action="<?php echo $siteurl . '/b2mailpost.php?p=' . $p ; ?>">


In any case, a new version of the .ZIP file is up at:

http://www.cjc.org/blog/files/b2mailpost.zip
Back to top
View user's profile Send private message Visit poster's website
Edlef



Joined: 16 Mar 2002
Posts: 71

PostPosted: Sun Apr 20, 2003 2:59 pm    Post subject: GREAT!! Reply with quote

Wonderful! Now it works perfect!
There is one little thing i have to checkout: the mail-dialog opens in the same window. If i press "close this window" the whole window is gone Cool I like to have another button like "Back to the weblog"...
I think i can work it out

Anyway, 1000 thanks an greetings from Lueneburg
Edlef
Back to top
View user's profile Send private message Visit poster's website
cjc



Joined: 24 Dec 2002
Posts: 146
Location: New York

PostPosted: Sun Apr 20, 2003 8:34 pm    Post subject: Re: GREAT!! Reply with quote

Edlef wrote:
Wonderful! Now it works perfect!
There is one little thing i have to checkout: the mail-dialog opens in the same window.


Take a look at: http://www.tidakada.com/board/viewtopic.php?p=12120#12120

You can set up a target for your href, so that it opens up a new window.
Back to top
View user's profile Send private message Visit poster's website
Edlef



Joined: 16 Mar 2002
Posts: 71

PostPosted: Tue Apr 22, 2003 5:31 pm    Post subject: Problem Reply with quote

a little problem occured: when i use the hack on my index page, everything works fine, the link spells
Code:
http://log.netbib.de/b2mailpost.php?p=78594374

If i use it on my archiv page or a "paged" page, the link spells
Code:
http://log.netbib.de/archives/m/b2mailpost.php?p=78594374

I use the "/archives/p/X instead of /?p=X"-hack ( http://tidakada.com/board/viewtopic.php?t=1273&start=0)
I think i have to change only one little thing, but what?

Thanks and greetings
Edlef
Back to top
View user's profile Send private message Visit poster's website
cjc



Joined: 24 Dec 2002
Posts: 146
Location: New York

PostPosted: Tue Apr 22, 2003 6:22 pm    Post subject: Reply with quote

You can hardcode the URL to b2mailpost.php into the form statement on line 152 or thereabouts. Right now, it looks like:

Code:
  <form method="post" action="<?php echo $siteurl . '/b2mailpost.php?p=' . $p ; ?>">


For the action clause, hardcode the URL, i.e.,

Code:

<?php echo 'http://log.netbib.de/b2mailpost.php?p=' . $p ; ?>
Back to top
View user's profile Send private message Visit poster's website
Edlef



Joined: 16 Mar 2002
Posts: 71

PostPosted: Wed Apr 23, 2003 10:42 am    Post subject: stupid me.... Reply with quote

Thanks for the help!! Very Happy
I've changed my index.php-template from relative to absolute URLs to the b2mailpost.php instead ... works fine!!
Greetings
Edlef
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> Hacks All times are GMT + 1 Hour
Goto page Previous  1, 2, 3, 4  Next
Page 2 of 4

 
Jump to:  
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 cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group