NineChime forum

Furry stuff, oekaki stuff, and other stuff.

You are not logged in.

Post a reply

Write your message and submit
Options
Humanity test

What is seven + three?

Go back

Topic review (newest first)

rainbow
09-09-2008 22:29:24

Waccoon wrote:

Well...it's about time! The mass OPMail feature worked!

Are you sure about that?  Did everyone (not just admins) get the notice?

The new code you gave me just doesn't let you see any errors because it redirects back to the mailbox.  That doesn't mean it worked as it should.  I'm trying to figure out the specific reason why your database was throwing errors in the first place.

Yes. I'm totally sure about that. Everyone got the OPMail notice (including myself). The new code that I gave you shouldn't throw out errors at all and return to the mailbox.

I have a feeling that the original Mass OPMail code in the functions.php file might not work on some databases.

I was unaware of this problem until I first tested out out the Mass OPMail feature in the first place.

Waccoon
09-09-2008 17:01:44

Well...it's about time! The mass OPMail feature worked!

Are you sure about that?  Did everyone (not just admins) get the notice?

The new code you gave me just doesn't let you see any errors because it redirects back to the mailbox.  That doesn't mean it worked as it should.  I'm trying to figure out the specific reason why your database was throwing errors in the first place.

rainbow
09-09-2008 02:34:44

Waccoon wrote:

Well, this is definitely a database issue.  We just have to get the error.  Note that this code WILL print something no matter what, so once we know what the database is complaining about, we'll have to get rid of all those "web_line()" calls.

I'm trying to be careful, here, so we don't accidentally send notices to a whole group of people multiple times.

I also had the count in the wrong place, so now it will correctly count the total number of failures.

Code:

Obsolete.

See final fix for the Mass OPMail snippet below.

Well...it's about time! The mass OPMail feature worked! big_smile

However, after the Mass OPMail mail has been sent to all users and administrators, it's supposed to return to the Mailbox (mailbox.php). But it didn't, instead, the web_line variable sent me this comment when the mass OPMail actions inserted rows in the op_oekakimailbox? :?

INSERT INTO op_oekakimailbox SET sender='rainbow', reciever='{name}', subject='Test 3.', body='...', senddate=NOW()

Is there a way to fix that even though the Mass OPMail feature is functioning again?


Edit: I finally got it right this time around after doing some further editing with the functions.php file and rigorous mass OPmail testing. Here's my snippet of the Mass OPMail feature from the functions.php file:

Code:

// Mass OPMail
if ($action == 'massmail') {
    $send_to = w_gpc('send_to');
    $body    = w_gpc('body');
    $subject = w_gpc('subject');

    if ($flags['owner']) {
        // To whom do we send the messages?
        $sql_where = "WHERE usrflags != 'P'";

        // If we narrow the mass mail to a certain group, we must also update the log
        if ($send_to != 'G') {
            if ($send_to == 'A') {
                $sql_where = "WHERE rank >= ".RANK_MOD;
            } elseif ($send_to == 'S') {
                $sql_where = "WHERE rank >= ".RANK_SADMIN;
            } else {
                $sql_where = "WHERE usrflags LIKE '%{$send_to}%'";
            }
            w_log(WLOG_MASS_MAIL, "flags({$send_to}): {$subject}");
        }

        if (!empty ($send_to) && !empty ($OekakiU)) {
            if (empty ($subject)) {
                report_err($langop_functions_err1);
            }
            $result = mysql_query ("SELECT usrname FROM {$OekakiPoteto_MemberPrefix}oekaki ".$sql_where);
            if ($result) {
                $count = 0;

                while ($row = mysql_fetch_array ($result)) {
                    $result3 = mysql_query ("INSERT INTO {$OekakiPoteto_MemberPrefix}oekakimailbox SET sender='{$OekakiU}', reciever='".addslashes($row['usrname'])."', subject='{$subject}', body='{$body}', senddate=NOW()");
                    if (!$result3) {
                        $count++;
                        web_line('No insert for '.$row['usrname'].': '.mysql_error());
                    }
                }
                if ($count > 0) {
                    all_done('mailbox.php');
                }
            }
        }
        all_done('mailbox.php');
    } else {
        report_err($langop_functions_err2);
    }
}

There are two things that I had to remove...the web_line() and the w_exit() variables upon the insertion of rows into the op_oekakimailbox table when mass sending OPmails to administrators, super administrators or all of the available users. While it only sent me to the message where it inserted rows for a specific action. It went directly to the Mailbox (mailbox.php).

The only thing that the web_line variable will throw at is that it cannot insert rows for a specific username thus returning a MySQL error.

I'm hoping that you include this snippet as a fix real soon. This piece of code is important if someone wants to mass send OPmail to users incase they really have to. One important example is moving the oekaki to a different host.

The Mass OPmail feature will now be used for real to send my members notices regarding the cosmetic changes to the site once I'm all done working on my oekaki. Most importantly, some of my members will need to be e-mailed, because they have not logged on to the site for more than a month or so and that they didn't know what has changed on the oekaki since it was upgraded.

Waccoon
09-08-2008 23:27:14

Well, this is definitely a database issue.  We just have to get the error.  Note that this code WILL print something no matter what, so once we know what the database is complaining about, we'll have to get rid of all those "web_line()" calls.

I'm trying to be careful, here, so we don't accidentally send notices to a whole group of people multiple times.

I also had the count in the wrong place, so now it will correctly count the total number of failures.

Code:

// Mass OPMail
if ($action == 'massmail') {
    $send_to = w_gpc('send_to');
    $body    = w_gpc('body');
    $subject = w_gpc('subject');

    if ($flags['owner']) {
        // To whom do we send the messages?
        $sql_where = "WHERE usrflags != 'P'";

        // If we narrow the mass mail to a certain group, we must also update the log
        if ($send_to != 'G') {
            if ($send_to == 'A') {
                $sql_where = "WHERE rank >= ".RANK_MOD;
            } elseif ($send_to == 'S') {
                $sql_where = "WHERE rank >= ".RANK_SADMIN;
            } else {
                $sql_where = "WHERE usrflags LIKE '%{$send_to}%'";
            }
            w_log(WLOG_MASS_MAIL, "flags({$send_to}): {$subject}");
        }

        if (!empty ($send_to) && !empty ($OekakiU)) {
            if (empty ($subject)) {
                report_err($langop_functions_err1);
            }
            $result = mysql_query ("SELECT usrname FROM {$OekakiPoteto_MemberPrefix}oekaki ".$sql_where);
            if ($result) {
                $count = 0;
                web_line("INSERT INTO {$OekakiPoteto_MemberPrefix}oekakimailbox SET sender='{$OekakiU}', reciever='{name}', subject='{$subject}', body='{$body}', senddate=NOW()");
                web_line('');

                while ($row = mysql_fetch_array ($result)) {
                    $result3 = mysql_query ("INSERT INTO {$OekakiPoteto_MemberPrefix}oekakimailbox SET sender='{$OekakiU}', reciever='".addslashes($row['usrname'])."', subject='{$subject}', body='{$body}', senddate=NOW()");
                    if (!$result3) {
                        $count++;
                        web_line('No insert for '.$row['usrname'].': '.mysql_error());
                    }
                }
                if ($count > 0) {
                    w_exit();
                }
            }
        }
        w_exit();
        // all_done('mailbox.php');
    } else {
        report_err($langop_functions_err2);
    }
}
rainbow
09-08-2008 00:03:10

Wac, the mass OPMail notice is indeed working a bit. However. it only sent to the test account that was made as a super administrator. Plus, I received this message when attempting to send the mass OPmail notice to everyone:

No insert for :

Still, sending mass OPmail to all 350 of my members isn't working. sad


Update : Apparently, there was a typo in the $row['usrname'] variable and now it comes up as:

No insert for test:

I did a check on the $count variable and something is still not working right.

Waccoon
09-07-2008 20:09:00

Yet still, it didn't even insert the SQL entry into the op_oekakimailbox table.

Good.  It wasn't supposed to do that -- only to print messages.

It seems that the massmail code is working fine, but the information just isn't getting into the database.

Here's a new version.  It prints SQL errors in the specific area that's causing trouble.  I does try to insert into the database, so if this code works for some reason, you don't need to replace it again.

Code:

(Obsolete)
rainbow
09-07-2008 04:31:00

Waccoon wrote:

OK, first we need to determine if this is a database problem, or if there is something screwy going on with the input.  Replace the massmail routine with this, send a message to "Everyone", and copy/paste what is printed to the forum.

Code:

// Mass OPMail
if ($action == 'massmail') {
    $send_to = w_gpc('send_to');
    $body    = w_gpc('body');
    $subject = w_gpc('subject');

    web_line('In massmail');

    if ($flags['owner']) {
        // To whom do we send the messages?
        $sql_where = "WHERE usrflags != 'P'";

        // If we narrow the mass mail to a certain group, we must also update the log
        if ($send_to != 'G') {
            web_line('Send to: specific');
            if ($send_to == 'A') {
                $sql_where = "WHERE rank >= ".RANK_MOD;
            } elseif ($send_to == 'S') {
                $sql_where = "WHERE rank >= ".RANK_SADMIN;
            } else {
                $sql_where = "WHERE usrflags LIKE '%{$send_to}%'";
            }
            web_line('SQL condition: '.$sql_where);
            // w_log(WLOG_MASS_MAIL, "flags({$send_to}): {$subject}");
        } else {
            web_line('Send to: everyone');
        }

        if (!empty ($send_to) && !empty ($OekakiU)) {
            if (empty ($subject)) {
                report_err($langop_functions_err1);
            }
            $result = mysql_query ("SELECT usrname FROM {$OekakiPoteto_MemberPrefix}oekaki ".$sql_where);
            if ($result) {
                $count = 0;
                while ($row = mysql_fetch_array ($result)) {
                    if ($count < 10) {
                        web_line("INSERT reciever='{$row['usrname']}'");
                    }
                    $count++;
                }
                if ($count > 9) {
                    web_line('...');
                }
                web_line('Count: '.$count);
            } else {
                web_line('No usrname collect result: '.mysql_error());
            }
        } else {
            web_line('No send or OekakiU');
        }
        w_exit();
    } else {
        report_err($langop_functions_err2);
    }
}

Alright, I checked the mySQL database and I got this notice from the functions.php file when attempting to mass-mail a test account:

In massmail
Send to: specific
SQL condition: WHERE rank >= 7
INSERT reciever='test'
INSERT reciever='rainbow'
Count: 2

Yet still, it didn't even insert the SQL entry into the op_oekakimailbox table. sad

Waccoon
09-07-2008 03:51:19

OK, first we need to determine if this is a database problem, or if there is something screwy going on with the input.  Replace the massmail routine with this, send a message to "Everyone", and copy/paste what is printed to the forum.

Code:

(Obsolete)
rainbow
09-07-2008 00:07:04

Waccoon wrote:

Do you have this in boot.php?

Code:

// Admin rank numbers
define ('RANK_MOD',    4);
define ('RANK_ADMIN',  5);
define ('RANK_SADMIN', 7);
define ('RANK_OWNER',  9);

Yep. I certainly do.

The code snippet remains intact. However, there appears to be problem that causes the Mass OPMail to not send users OPMail at all even if the snippet that you mentioned is there in my boot.php file. sad

Waccoon
09-06-2008 23:18:47

Do you have this in boot.php?

Code:

// Admin rank numbers
define ('RANK_MOD',    4);
define ('RANK_ADMIN',  5);
define ('RANK_SADMIN', 7);
define ('RANK_OWNER',  9);

Board footer

Yep, still running PunBB
© Copyright 2002–2008 PunBB