Guest Posted August 21, 2008 Share Posted August 21, 2008 Hi. Since my host's server upgrade, I have a problem with cron birthday contribution. I receive by email this error instead of the emails the customers should get: FATAL ERROR: register_globals is disabled in php.ini, please enable it! What do I need to change in cron_birthday.php in order for it to be compatible with php and mysql 5? This is the file: <?php /* $Id: cron_birthday.php,v 1.0.1.2 2005/02/03 12:46:52 davistan Exp $ Contribution based on: osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2005 Davis Tan - www.datumcorp.com Released under the GNU General Public License */ include('includes/application_top.php'); //Settings - changes made here $offset = '+2'; //Send birthday email how many days after(-)/during(blank)/before(+) $subject = 'Happy Birthday %s!'; $msg = 'Dear %s,'. "\n\n" . 'From our records, we found that your birthday is on %s. Therefore, we from '.STORE_NAME.' would like take this opportunity to wish you Happy Birthday!!! ** MAY ALL YOUR DREAMS COMES TRUE ! ** ** and buy more for less money ** '; /* $msg .= ' We have a birthday present for you :) '.STORE_NAME.' would like to give you a birthday present: ';*/ $msg .= ' We hope that this little email have lighten up your day (a little if not much) :-) Have a nice day and hope to see you again at '. STORE_NAME .'! Yours truly, '.STORE_OWNER . "\n" . STORE_NAME . ' - ' . HTTP_SERVER . DIR_WS_CATALOG . "\n" . TEXT_SLOGAN . "\n"; //prevent script from running more than once a day $prev = tep_db_query("SELECT * FROM ".TABLE_CONFIGURATION." WHERE CONFIGURATION_KEY='CRON_BD_RUN'"); if (tep_db_num_rows($prev) > 0) { $prev_val = tep_db_fetch_array($prev); if($prev_val['configuration_value'] == date("Ymd")) die('Halt! Already executed - should not execute more than once a day.'); else tep_db_query("UPDATE ".TABLE_CONFIGURATION." SET configuration_value='".date("Ymd")."' WHERE CONFIGURATION_KEY='CRON_BD_RUN'"); } else { tep_db_query("INSERT INTO ".TABLE_CONFIGURATION." (CONFIGURATION_KEY, configuration_value, CONFIGURATION_GROUP_ID) VALUES('CRON_BD_RUN', '".date("Ymd")."', 6)"); } $bdsql = "SELECT * FROM " . TABLE_CUSTOMERS . " WHERE " . "MONTH(customers_dob)=MONTH(curdate()) AND DAYOFMONTH(customers_dob)=DAYOFMONTH(curdate())$offset"; $bdqry = tep_db_query($bdsql); if (tep_db_num_rows($bdqry) > 0) { while($bdarr = tep_db_fetch_array($bdqry)) { echo 'Sent email to '. $bdarr['customers_firstname'] . ' ' . $bdarr['customers_lastname'] . ' ' . tep_date_short($bdarr['customers_dob']) . "\n"; $bd_sub = sprintf($subject, $bdarr['customers_firstname']); $bd_msg = sprintf($msg, $bdarr['customers_firstname'], tep_date_short($bdarr['customers_dob'])); tep_mail($bdarr['customers_firstname'], $bdarr['customers_email_address'], $bd_sub, $bd_msg, STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, ''); // send emails to other people if (SEND_EXTRA_ORDER_EMAILS_TO != '') tep_mail($bdarr['customer_firstname'], SEND_EXTRA_ORDER_EMAILS_TO, $bd_sub, $bd_msg, STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, ''); } } else { //no birthdays for today if (SEND_EXTRA_ORDER_EMAILS_TO != '') tep_mail(STORE_NAME, SEND_EXTRA_ORDER_EMAILS_TO, STORE_NAME . ' Birthday Cron', 'No birthday for ' . date("Y-m-d") . ' offset: '. $offset, STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, ''); } require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Thank you. Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted August 21, 2008 Share Posted August 21, 2008 On some servers, you need to enable the register globals option for any directory that runs a script. There is probably a php.ini file in your root since you are not having the problem there. Copy that to admin or wherever that script is located and it should work then. Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
Guest Posted August 21, 2008 Share Posted August 21, 2008 Well, actually I don't see such a file... What next? :) Thanks for the fast reply. Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted August 22, 2008 Share Posted August 22, 2008 Create a file named php.ini. Edit it and add register_globals = On Save it and upload it. Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
Guest Posted September 1, 2008 Share Posted September 1, 2008 I did that, but with no result. I uploaded the file in catalog/ (root) where the cron_birthday.php is. I really really hope there's a solution to this - my customers seemed very pleased when receiving the birthday message. Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted September 2, 2008 Share Posted September 2, 2008 You should ask your host why you are getting the message. The php.ini file should prevent that but your host can prevent it from being used so that might be what is happening. Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
Guest Posted September 3, 2008 Share Posted September 3, 2008 Hi again. My host did something - I don't know what - and now I get this error intead of the one above: <br /> <b>Fatal error</b>: Can't use function return value in write context in <b>/home/xxxx/public_html/cron_birthday.php</b> on line <b>17</b><br /> This is the file: <?php /* $Id: cron_birthday.php,v 1.0.1.2 2005/02/03 12:46:52 davistan Exp $ Contribution based on: osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2005 Davis Tan - www.datumcorp.com Released under the GNU General Public License */ include('includes/application_top.php'); //Settings - changes made here max($offset,0) = ''; //Send birthday email how many days after(-)/during(blank)/before(+) $subject = 'La multi ani %s!'; $msg = 'Draga %s,'. "\n\n" . 'Din datele noastre am remarcat ca ziua Dvs. este pe %s. De aceea, <a href="http://www.muccelmic.com"> '.STORE_NAME.' </a>doreste sa profite de ocazie sa va ureze un sincer La multi ani!!! **FIE CA TOATE VISELE SA VI SE IMPLINEASCA ! ** '; /* $msg .= ' La multi ani! '.STORE_NAME.' va doreste un calduros La multi ani! ';*/ $msg .= ' Speram ca acest email sa va infrumuseteze ziua si sa va aduca un zambet :-) Va dorim o zi buna si speram sa va revedem la '. STORE_NAME .'! Cu respect, '.STORE_OWNER . "\n" . STORE_NAME . ' - ' . HTTP_SERVER . DIR_WS_CATALOG . "\n" . TEXT_SLOGAN . "\n"; //prevent script from running more than once a day $prev = tep_db_query("SELECT * FROM ".TABLE_CONFIGURATION." WHERE CONFIGURATION_KEY='CRON_BD_RUN'"); if (tep_db_num_rows($prev) > 0) { $prev_val = tep_db_fetch_array($prev); if($prev_val['configuration_value'] == date("Ymd")) die('Halt! Already executed - should not execute more than once a day.'); else tep_db_query("UPDATE ".TABLE_CONFIGURATION." SET configuration_value='".date("Ymd")."' WHERE CONFIGURATION_KEY='CRON_BD_RUN'"); } else { tep_db_query("INSERT INTO ".TABLE_CONFIGURATION." (CONFIGURATION_KEY, configuration_value, CONFIGURATION_GROUP_ID) VALUES('CRON_BD_RUN', '".date("Ymd")."', 6)"); } $bdsql = "SELECT * FROM " . TABLE_CUSTOMERS . " WHERE " . "MONTH(customers_dob)=MONTH(curdate()) AND DAYOFMONTH(customers_dob)=DAYOFMONTH(curdate())max($offset,0)"; $bdqry = tep_db_query($bdsql); if (tep_db_num_rows($bdqry) > 0) { while($bdarr = tep_db_fetch_array($bdqry)) { echo 'Sent email to '. $bdarr['customers_firstname'] . ' ' . $bdarr['customers_lastname'] . ' ' . tep_date_short($bdarr['customers_dob']) . "\n"; $bd_sub = sprintf($subject, $bdarr['customers_firstname']); $bd_msg = sprintf($msg, $bdarr['customers_firstname'], tep_date_short($bdarr['customers_dob'])); tep_mail($bdarr['customers_firstname'], $bdarr['customers_email_address'], $bd_sub, $bd_msg, STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, ''); // send emails to other people if (SEND_EXTRA_ORDER_EMAILS_TO != '') tep_mail($bdarr['customer_firstname'], SEND_EXTRA_ORDER_EMAILS_TO, $bd_sub, $bd_msg, STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, ''); } } else { //no birthdays for today if (SEND_EXTRA_ORDER_EMAILS_TO != '') tep_mail(STORE_NAME, SEND_EXTRA_ORDER_EMAILS_TO, STORE_NAME . ' Birthday Cron', 'No birthday for ' . date("Y-m-d") . ' offset: '. max($offset,0), STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, ''); } require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Maybe now we'll find the answer... Thank you! Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted September 4, 2008 Share Posted September 4, 2008 My count gives line 17 as //Settings - changes made here, which I'm sure is wrong. Perhaps you can mark the line? You might also want to ask in the support thread for the contribution. The author, if he is supporting it, is more likely to see it there. Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
whitehawk43 Posted September 4, 2008 Share Posted September 4, 2008 My count gives line 17 as //Settings - changes made here, which I'm sure is wrong. Perhaps you can mark the line? You might also want to ask in the support thread for the contribution. The author, if he is supporting it, is more likely to see it there. Jack I don't know what host you have but my host has in my cpannel a place called CGI and Scripted Language and in there they have a spot to make changes to my php.ini file called PHP Scripting when I open it I can go into my php.ini file and can turn on or off my register_globals no file to add or nothing Hope this was help Quote Link to comment Share on other sites More sharing options...
Guest Posted September 4, 2008 Share Posted September 4, 2008 My count gives line 17 as //Settings - changes made here, which I'm sure is wrong. Perhaps you can mark the line? You might also want to ask in the support thread for the contribution. The author, if he is supporting it, is more likely to see it there. Jack Indeed, that's line 17, don't understand either. And the contrib thread - I can't find it. I've looked for it and I guess it just doesn't exist. I don't know what host you have but my host has in my cpannel a place called CGI and Scripted Language and in there they have a spot to make changes to my php.ini file called PHP Scripting when I open it I can go into my php.ini file and can turn on or off my register_globals no file to add or nothing Hope this was help Can't find that in cpanel. But thank you. I guess I'll talk to them again and see if they have a solution. Quote Link to comment Share on other sites More sharing options...
dubz99 Posted September 4, 2008 Share Posted September 4, 2008 (edited) To add some detail on the globals_on you can try adding the following to your .htaccess file in your public_html folder or public_html/catalog/ (public_html may named something else on your server), you may only need it in one but can't hurt to have it in both. This will turn on globals for PHP5 and PHP4 if you don't have access to the php.ini <ifmodule mod_php5.c> php_flag register_globals on </ifmodule> <ifmodule mod_php4.c> php_flag register_globals on </ifmodule> Hope this helps -dubz Edited September 4, 2008 by dubz99 Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted September 4, 2008 Share Posted September 4, 2008 Indeed, that's line 17, don't understand either.And the contrib thread - I can't find it. I've looked for it and I guess it just doesn't exist. A coding mistake is causing the failure. The following is not valid code. max($offset,0) = ''; You might want to compare what you have in your file against what is in the file from that contribution to make sure that is what it should be. Jack Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
Guest Posted December 21, 2008 Share Posted December 21, 2008 I am having a problem with this script. It will run in a browser without any problems. But when I create a cronjob it give an error message when it runs. configure.php file missing or corroupt. I do not know where else to check to try to figure this out . It is the stock script with no changes. /usr/local/bin/php -q /home/xxxxx/www/xxxxx.com/cron_birthday.php configure.php is missing or corrupt. Please correct. All my other cronjobs run fine.. Any suggestions Ken Quote Link to comment Share on other sites More sharing options...
Patty Posted June 23, 2009 Share Posted June 23, 2009 (edited) Hello. Has anybody been able to make this contribution actually work with cron? I can run it manually on the browser, it works fine and sends the email. But when using cron, it gives me an error that it can't find the includes/configure.php file! I just can't make it work.... :blink: Can anyone help with this? It's such a nice and easy contribution. TIA for any help. Edited June 23, 2009 by Patty Quote Patty Link to comment Share on other sites More sharing options...
Patty Posted June 23, 2009 Share Posted June 23, 2009 This is the error I'm getting now on the cron output, after moving the file to the admin directory, as instructed on the last version: Fatal error: Call to undefined function tep_db_query() in /home/user/public_html/catalog/admin/cron_birthday.php on line 62 Contribution: http://addons.oscommerce.com/info/2896 Help, pleaaaaase!!!! :blush: Quote Patty Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.