Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 7.6 Bugs/Fixes
Author Message
Trubador
Regular
Regular



Joined: Dec 28, 2004
Posts: 94

PostPosted: Mon Nov 12, 2007 5:26 pm Reply with quote

Hi all,

Using RavenNuke 2.10.01 but this is more of a Nuke in general problem.

I've been racking my tiny little mind on this one for some time. I use the built in Nuke Subscriptions function on my site.

All seems to work well with it apart from when the subscription time ends. I think this has been a problem for many Nuke installs in the past.

There should be a mail sent to the user to explain that their Subs has finished but it gets bounced back from my own mail server (I've put X's in some parts):

Code:
A message that you sent contained no recipient addresses, and therefore no delivery could be attempted. 


------ This is a copy of your message, including all the headers. ------

To:
Subject: XXXXXXXX XXXXX XXXX: Your Subscription Has Expired
From: XXX XXXXXX XXXXXXXXX <webmaster@XXXXXXXX.com>
X-Mailer: PHP/4.4.2
Message-Id: <E1Iqg5e-0007Ne-8y@XXX.XXXXXXXXXXX.com>
Date: Sat, 10 Nov 2007 02:28:54 +0000

Hello XXXXXXXXX:

This is an automated message to let you know that your subscription at XXXXXXXXXXXX has now expired.
If you want to renew your subscription please go to: http://www.XXXXXXXXXXXXX.com/modules.php?name=Content&pa=showpage&pid=7

Hope to have served you with satisfaction...

XXXXXXXXXXXXXXX _TEAM
http://www.XXXXXXXXX.com



As you can see the To: line is empty.

The function is located in mainfile.php

Code:
function paid() {

    global $db, $user, $cookie, $adminmail, $sitename, $nukeurl, $subscription_url, $user_prefix, $prefix;
    if (is_user($user)) {
        if (!empty($subscription_url)) {
            $renew = _SUBRENEW.' '.$subscription_url;
        } else {
            $renew = '';
        }
        cookiedecode($user);
        $sql = 'SELECT * FROM '.$prefix.'_subscriptions WHERE userid=\''.$cookie[0].'\'';
        $result = $db->sql_query($sql);
        $numrows = $db->sql_numrows($result);
        $row = $db->sql_fetchrow($result);
        if ($numrows == 0) {
            return 0;
        } elseif ($numrows != 0) {
            $time = time();
            if ($row['subscription_expire'] <= $time) {
                $db->sql_query('DELETE FROM '.$prefix.'_subscriptions WHERE userid=\''.$cookie[0].'\' AND id=\''.intval($row['id']).'\'');
                $from = $sitename.' <'.$adminmail.'>';
                $subject = $sitename.': '._SUBEXPIRED;
                $body = _HELLO." $cookie[1]:\n\n"._SUBSCRIPTIONAT.' '.$sitename.' '._HASEXPIRED."\n$renew\n\n"._HOPESERVED."\n\n$sitename "._TEAM."\n$nukeurl";
                $row = $db->sql_fetchrow($db->sql_query('SELECT user_email FROM '.$user_prefix.'_users WHERE id=\''.$cookie[0].'\' AND nickname=\''.$cookie[1].'\' AND password=\''.$cookie[2].'\''));
                mail($row['user_email'], $subject, $body, "From: $from\r\nX-Mailer: PHP/" . phpversion());
            }
            return 1;
        }
    } else {
        return 0;
    }
}


Now I'm thinking it may be a cookie issue as
Code:
mail($row['user_email']


is what the To: line should be and

Code:
$row = $db->sql_fetchrow($db->sql_query('SELECT user_email FROM '.$user_prefix.'_users WHERE id=\''.$cookie[0].'\' AND nickname=\''.$cookie[1].'\' AND password=\''.$cookie[2].'\''));


is where the users email is gathered from.

Cookie 1 works, as the users nick is displayed in the mail.

Im also using CNBYA 442, where I think there may be a clash with the cookies but unsure.

I really need a Guru for this problem.

Cheers all

Trub

P.s. There was and is a language problem with _TEAM at the end of the mail, but that I fixed by editing /language/lang-english.php


Last edited by Trubador on Fri Nov 16, 2007 1:41 am; edited 1 time in total 
View user's profile Send private message
fkelly
Former Moderator in Good Standing



Joined: Aug 30, 2005
Posts: 3312
Location: near Albany NY

PostPosted: Mon Nov 12, 2007 6:49 pm Reply with quote

That's really a can of worms you've opened. There are a ton of bugs buried down in the deep recesses of PHPnuke which have been carried forward into RN. Many were fixed with RN2.10 but many remain and it looks like you found one. But then adding CNBYA into the mix makes it very difficult to isolate for the core RN team.

In addition, Montego and others are working on a new mailing system for RN2.20. If you can possibly live with the current situation I'd suggest waiting for the test period for RN2.20 and seeing if you can replicate the problem there. Probably it would be better to use the native YA functionality and see if the problem occurs, then add CNBYA in if it doesn't and see what happens.

And totally coincidentally we just eliminated a bunch of _TEAM constant problems from 2.20 today. So test that one when the release is available for testing.

If you really need to fix this immediately I'd start by echoing out the results in that first block of code you quoted. I'd also have a separate window up with PHPmyadmin pointed to the subscriptions table. See if it is finding any rows in the subscriptions table. If not, stop right there and see what the value of $cookie[0] is and look in the subscriptions table and see if the userid field matches that. If you do find records in the subscriptions table then I'd echo out the value of $row['user_email'] and see what's in there.

Hope that helps a bit. I know it's not a total solution but it is a lot of work to try to replicate all the different uses to which Nuke is put. I've never used subscriptions on my sites and hopefully never will.
 
View user's profile Send private message Visit poster's website
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Mon Nov 12, 2007 7:48 pm Reply with quote

fkelly, just saw the _TEAM comment. Didn't realize it was a problem throughout. I just removed this define from use within NSN Groups' mail function while working on SMTP. If we really need it back (in Groups), I can put it back. But, to be honest, in that one particular usage of it, it really wasn't adding value.

Glad you corrected it throughout RN though. Thank you sir!

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
fkelly







PostPosted: Mon Nov 12, 2007 7:59 pm Reply with quote

M. Thanks. But I just removed it from /ya/admin/language files in a bunch of language files that were generating errors from having it in. It was very inconsistent throughout the language files. I didn't look in any other modules. Then Guardian made some other language file changes, primarily I think in web links for errors that showed up when I was testing YA/admin. When the dust settles on 2.20 maybe we could talk about having a database of language file defines so that duplication would be impossible and maintenance would not be so difficult.
 
Trubador







PostPosted: Tue Nov 13, 2007 7:36 pm Reply with quote

This is the funny thing with CNBYA.

Subscription wise I can safely say that 442 is definitely sorted with the way an admin can update subscribed users "Subscription Period" and to update initial subscription. It also sends the correct email notification of these events to the subscriber. Also _TEAM is defined correctly in the email.

What it does however rely on, and from looking for several hours, is the default "end of subscription" period that is written in to mainfile.php

In mainfile.php the default _TEAM written to /language/lang_english.php and other languages is not present. In CNBYA /modules/Your_Account/language/ it is, and please keep it so (there may be a few others like me that use the CNBYA subscription tools to a very good effect, although "Team" such 'n' such can be a bit cheasy Wink ).

fkelly: Thanks for the info m8. I have already started to look in to how the cookies are handled. I really believe this is why the To: feild is not being populated and may also be a conflict with CNBYA. The thing is...... I am without a doubt an amateur at PHP and Nuke, so it will probably take me weeks if not months to come to a conclusion. All I can think of at the moment is to remove the cookie[0] and [2] from the fetchrow. But would love to know why these are there to start with, surely just the nickname would suffice and not id and password?

Also, it is really hard for me to replicate an end of subs, even with a test account. db table "prefix_subscriptions" lists "subscription_expires" in a ten digit numerical. All I can think of is the way PHP handles time codes, (well beyond me). Linking a test account username to the id is not a problem.

So I dont mind giving this a shot to rectifying my problem, but the stumbling block for me is now replicating a subs expired user.

Thanks for the replys both,

Trub

P.s. Its not a case of charging people for the use of the site or information with the subscription, but the knowledge of who they are and who they know they are talking to. Hope you will never use subscription also...... its a right pain in the arse. Shocked but a necessity for us with our community.
 
Trubador







PostPosted: Tue Nov 13, 2007 7:50 pm Reply with quote

P.p.s. My hosts informed me the other day to update my version 7.6 of Nuke to the latest..... LMAO. I shot them back in the arse by informing them that I was already using the most secure version called RavenNuke...... 10 minutes later...... "Oh......... OK" Smile

Although there are and will be bugs in Nuke, you fellas have worked bloody hard in developing a sound and stable version and future versions that can and will be relied on. worship


Last edited by Trubador on Fri Nov 16, 2007 1:42 am; edited 1 time in total 
gizmo2
Hangin' Around



Joined: Sep 15, 2007
Posts: 34
Location: Germany

PostPosted: Thu Nov 15, 2007 2:03 pm Reply with quote

Cool, a version from Nuke with integrated music... Cool

Trubador wrote:
the most secure version called RaveNuke
 
View user's profile Send private message
Trubador







PostPosted: Fri Nov 16, 2007 1:43 am Reply with quote

killing me

Ooooops
 
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Fri Nov 16, 2007 6:46 am Reply with quote

The use of the constant _TEAM is not required in the nukeroot/language/*.* for core RavenNuke which is why I removed it when going through all the language files.
There were literally thousands of re declared constants due to poor way that the language files are handled within nuke and even some cross module function - that is to say a function in one module may be called from outside of that specific module and therefore need the language constants for that part of nuke.

The root language files are always loaded and therefore always already declared constants. Whenever you go to a module, the language files for that module are also loaded and thus you can easily get re declared constants error messages.

Obvoiusly I could only test using the RN core code so if another module is added like CNBYA or even some of the third party blocks, there may be a problem.

If you need to add a language constant back it should always take the form of;
Code:
if (!defined ('_CONSTANT')) { define ('_CONSTANT','Your constant text') } ;

This will prevent it clashing in other modules etc.

As an example, if you install virgin nuke 7.6, turn error reporting up full and then load the Weblinks module you see about three pages (around 200) re-declared language constants.
Although it won't break nuke, it was done for efficiency.
 
View user's profile Send private message Send e-mail
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 7.6 Bugs/Fixes

View next topic
View previous topic
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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©