Author: admin

  • How to Insert JavaScript Code into PHP Melody

    Inserting any Javascript code (e.g. AdSense) into PHP Melody’s *.tpl files is very easy.

    Since PHP Melody uses the Smarty template engine you do need to wrap your Javascript code between an open and close {literal} tags.

    Here’s an example of how the AdSense code should be added into the <head> part of your site.

    {literal}
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <script>
      (adsbygoogle = window.adsbygoogle || []).push({
        google_ad_client: "ca-pub-0000000000000",
        enable_page_level_ads: true
      });
    </script>
    {/literal}

    Note the opening and closing {literal} tags. That’s how any kind of Javascript code should be injected into any of the *.tpl files from PHP Melody.

    For the official documentation please visit:
    https://www.smarty.net/docs/en/language.function.literal.tpl

  • Troubleshooting Automated Jobs

    When all your automated jobs show “Last Performed” as “Never”, your cron job might not be running. There are several common causes for this.

    Case #1

    Usually, the cause is forgetting to set up a cron job in the first place.We detail how to setup your new cron job in our help documents.

    Case #2

    Another problem might be with the server’s configuration. Hosting providers sometimes limit what commands Cron can run. For example, Inmotionhosting does not allow you to run wget at all. They do allow lynx or curl instead.

    However the majority of hosting providers allow you to run wget. To make sure your hosting provider is OK with wget, Google search for: your hosting provider + cron“.  This should help you find if they forbid or allow wget via cron.  In case they don’t allow wget, adjust your crontab command as they recommend it.

    Case #3

    And lastly, it may be a permissions thing. See that your /cron.php file from your PHP Melody installation has the 755 permissions (i.e. is executable).

    Each hosting company does things their own way. If none of these tips helped, contact your hosting provider and ask them to set up this cron job for you.

  • PHP Melody Critical Vulnerability Fix (Jan 2017)

    PHP Melody releases before January 26th 2017 are vulnerable to SQL injection and should be patched immediately.

    In case you cannot use the official package to update your PHP Melody website(s), simply apply the following changes to patch your site against intrusion. Updating is still required but can be safely postponed to a later date.

    Open file: /comment.php

    Find:

    $user_id = $_POST['user_id'];

    Replace with:

    $user_id = 0;

    If you have Mobile Melody installed:

    Open file: /mobile/comment.php

    Find:

    $user_id = $_POST['user_id'];

    Replace with:

    $user_id = 0;

    For PHP Melody versions v2.5 and later, phpmailer can be easily updated as well.

    Download phpmailer.zip and replace your existing /include/phpmailer/ folder with the one form the zip archive.

    These two code patches should provide adequate security to your PHP Melody website(s). We do however recommend updating to the latest PHP Melody version to fix any pending bugs.

    To download the complete update packages visit your customer account with us. To patch this critical vulnerability, you need to run at least PHP Melody v2.7.1.

  • Disable CSRF

    PHP Melody uses CSRF protection by default. If you experience the following error message in your back-end, please consider disabling CSRF:

    Invalid token or session expired. Please load this page from the menu and try again.

    Here’s how to do it:

    Disable CSRF