Kategori: ProgrammeringCategory: Programming

  • Flyt fra et domæne til et andet med htaccessMove from one domain to another with htaccess

    Jeg har fornylig skulle flytte et website fra et domæne til et nyt. Når man gør dette, vil man meget gerne have alle sider til at redirecte til det nye site, men samtidig beholde…

    I recently had to move a website from one domain to a new one. When you do that, you very much want every page to redirect to the new site while keeping the path…

  • PHP og GratisDNSPHP and GratisDNS

    Har bygget en phpklasse der kan bruges til at administrere DNS indstillinger hos GratisDNS. https://github.com/kasperhartwich/php-gratisdns

    I have built a PHP class that can be used to manage DNS settings at GratisDNS. https://github.com/kasperhartwich/php-gratisdns

  • ANSI colors in PHPANSI colors in PHP

    For min egen skyld, følger her ansifarver til brug med php i cli. define("ANSI_CLEAR", "\033[0m"); define("ANSI_BOLD", "\033[1m"); define("ANSI_FAINT", "\033[2m"); define("ANSI_ITALIC", "\033[3m"); define("ANSI_UNDERLINE", "\033[4m"); define("ANSI_BLINK", "\033[5m"); define("ANSI_BLINK_RAPID", "\033[6m"); define("ANSI_INVERSE", "\033[7m"); define("ANSI_CONCEAL", "\033[8m"); define("ANSI_CROSSED", "\033[9m"); define("ANSI_RED",…

    For my own sake, here are the ANSI colours for use with PHP on the command line. define("ANSI_CLEAR", "\033[0m"); define("ANSI_BOLD", "\033[1m"); define("ANSI_FAINT", "\033[2m"); define("ANSI_ITALIC", "\033[3m"); define("ANSI_UNDERLINE", "\033[4m"); define("ANSI_BLINK", "\033[5m"); define("ANSI_BLINK_RAPID", "\033[6m"); define("ANSI_INVERSE", "\033[7m"); define("ANSI_CONCEAL",…

  • Validate norweigan bankaccountsValidate Norwegian bank accounts

    Had big problems finding information on validating bank account numbers for Norway. Therefor I publish my php function here: function validateNoBankAccount($account_number, $weight='5432765432') { if (strlen($account_number)!=11) {return false;} $digits = str_split($account_number); $control = str_split($weight); $total…

    I had big problems finding information on validating bank account numbers for Norway, so I am publishing my PHP function here: function validateNoBankAccount($account_number, $weight='5432765432') { if (strlen($account_number)!=11) {return false;} $digits = str_split($account_number); $control =…