Solved

Currency conversion

Posted on 2011-09-15
5
428 Views
Last Modified: 2012-05-12
I am looking for something that will allow me to convert the cost in £ taken from mysql and times it by the current USD rate to convert it to $, is there a simply script that can do this on the fly or would I need to update the exchange rate at a set period of time?
0
Comment
Question by:koop1koop
5 Comments
 
LVL 6

Accepted Solution

by:
tmwsiy earned 167 total points
ID: 36544167
I don't immediately see how often they update the conversion data but this should do what you need.

http://www.geoplugin.com/webservices/currency
0
 
LVL 1

Assisted Solution

by:rerard
rerard earned 167 total points
ID: 36544186
You would need to subscribe to a web service to get the rates if you don't want to update them manually.

Check this out:  http://www.flash-db.com/Currency/
0
 
LVL 108

Assisted Solution

by:Ray Paseur
Ray Paseur earned 166 total points
ID: 36544453
Please do not use this script -- it is only a teaching example.  But hopefully it will show you the design pattern.  I think you can dispose of any of the unused currencies without affecting the design.
<?php // RAY_currency_converter.php
error_reporting(E_ALL);

// PHP 5.1+  SEE http://us3.php.net/manual/en/function.date-default-timezone-set.php
date_default_timezone_set('America/Chicago');

class CurrencyConverter
{
    protected $error, $norml, $terse, $verbose, $array, $rates;
    protected static $currs;

    public function __construct()
    {
        // READ THE EXCHANGE RATES
        $url = 'http://www.99currencies.com/currency/curr.php';
        $str = file_get_contents($url);
        $str = str_replace(':CUR', '', $str);
        $this->rates = json_decode($str, TRUE);

        // DATA ADAPTED FROM XE.COM - SEE ALSO: http://en.wikipedia.org/wiki/ISO_4217
        $this->currs["AED"] = array("N" => "United Arab Emirates",                                 "C" => "Dirhams");
        $this->currs["AFN"] = array("N" => "Afghanistan",                                          "C" => "Afghanis");
        $this->currs["ALL"] = array("N" => "Albania",                                              "C" => "Leke");
        $this->currs["AMD"] = array("N" => "Armenia",                                              "C" => "Drams");
        $this->currs["ANG"] = array("N" => "Netherlands Antilles",                                 "C" => "Guilders (also called Florins)");
        $this->currs["AOA"] = array("N" => "Angola",                                               "C" => "Kwanza");
        $this->currs["ARS"] = array("N" => "Argentina",                                            "C" => "Pesos");
        $this->currs["AUD"] = array("N" => "Australia",                                            "C" => "Dollars");
        $this->currs["AWG"] = array("N" => "Aruba",                                                "C" => "Guilders (also called Florins)");
        $this->currs["AZN"] = array("N" => "Azerbaijan",                                           "C" => "New Manats");
        $this->currs["BAM"] = array("N" => "Bosnia and Herzegovina",                               "C" => "Convertible Marka");
        $this->currs["BBD"] = array("N" => "Barbados",                                             "C" => "Dollars");
        $this->currs["BDT"] = array("N" => "Bangladesh",                                           "C" => "Taka");
        $this->currs["BGN"] = array("N" => "Bulgaria",                                             "C" => "Leva");
        $this->currs["BHD"] = array("N" => "Bahrain",                                              "C" => "Dinars");
        $this->currs["BIF"] = array("N" => "Burundi",                                              "C" => "Francs");
        $this->currs["BMD"] = array("N" => "Bermuda",                                              "C" => "Dollars");
        $this->currs["BND"] = array("N" => "Brunei Darussalam",                                    "C" => "Dollars");
        $this->currs["BOB"] = array("N" => "Bolivia",                                              "C" => "Bolivianos");
        $this->currs["BRL"] = array("N" => "Brazil",                                               "C" => "Brazil Real");
        $this->currs["BSD"] = array("N" => "Bahamas",                                              "C" => "Dollars");
        $this->currs["BTN"] = array("N" => "Bhutan",                                               "C" => "Ngultrum");
        $this->currs["BWP"] = array("N" => "Botswana",                                             "C" => "Pulas");
        $this->currs["BYR"] = array("N" => "Belarus",                                              "C" => "Rubles");
        $this->currs["BZD"] = array("N" => "Belize",                                               "C" => "Dollars");
        $this->currs["CAD"] = array("N" => "Canada",                                               "C" => "Dollars");
        $this->currs["CDF"] = array("N" => "Congo/Kinshasa",                                       "C" => "Congolese Francs");
        $this->currs["CHF"] = array("N" => "Switzerland",                                          "C" => "Francs");
        $this->currs["CLP"] = array("N" => "Chile",                                                "C" => "Pesos");
        $this->currs["CNY"] = array("N" => "China",                                                "C" => "Yuan Renminbi");
        $this->currs["COP"] = array("N" => "Colombia",                                             "C" => "Pesos");
        $this->currs["CRC"] = array("N" => "Costa Rica",                                           "C" => "Colones");
        $this->currs["CUP"] = array("N" => "Cuba",                                                 "C" => "Pesos");
        $this->currs["CVE"] = array("N" => "Cape Verde",                                           "C" => "Escudos");
        $this->currs["CYP"] = array("N" => "Cyprus",                                               "C" => "Pounds (expires 2008-Jan-31)");
        $this->currs["CZK"] = array("N" => "Czech Republic",                                       "C" => "Koruny");
        $this->currs["DJF"] = array("N" => "Djibouti",                                             "C" => "Francs");
        $this->currs["DKK"] = array("N" => "Denmark",                                              "C" => "Kroner");
        $this->currs["DOP"] = array("N" => "Dominican Republic",                                   "C" => "Pesos");
        $this->currs["DZD"] = array("N" => "Algeria",                                              "C" => "Algeria Dinars");
        $this->currs["EEK"] = array("N" => "Estonia",                                              "C" => "Krooni");
        $this->currs["EGP"] = array("N" => "Egypt",                                                "C" => "Pounds");
        $this->currs["ERN"] = array("N" => "Eritrea",                                              "C" => "Nakfa");
        $this->currs["ETB"] = array("N" => "Ethiopia",                                             "C" => "Birr");
        $this->currs["EUR"] = array("N" => "Euro Member Countries",                                "C" => "Euro");
        $this->currs["FJD"] = array("N" => "Fiji",                                                 "C" => "Dollars");
        $this->currs["FKP"] = array("N" => "Falkland Islands (Malvinas)",                          "C" => "Pounds");
        $this->currs["GBP"] = array("N" => "United Kingdom",                                       "C" => "Pounds");
        $this->currs["GEL"] = array("N" => "Georgia",                                              "C" => "Lari");
        $this->currs["GGP"] = array("N" => "Guernsey",                                             "C" => "Pounds");
        $this->currs["GHS"] = array("N" => "Ghana",                                                "C" => "Cedis");
        $this->currs["GIP"] = array("N" => "Gibraltar",                                            "C" => "Pounds");
        $this->currs["GMD"] = array("N" => "Gambia",                                               "C" => "Dalasi");
        $this->currs["GNF"] = array("N" => "Guinea",                                               "C" => "Francs");
        $this->currs["GTQ"] = array("N" => "Guatemala",                                            "C" => "Quetzales");
        $this->currs["GYD"] = array("N" => "Guyana",                                               "C" => "Dollars");
        $this->currs["HKD"] = array("N" => "Hong Kong",                                            "C" => "Dollars");
        $this->currs["HNL"] = array("N" => "Honduras",                                             "C" => "Lempiras");
        $this->currs["HRK"] = array("N" => "Croatia",                                              "C" => "Kuna");
        $this->currs["HTG"] = array("N" => "Haiti",                                                "C" => "Gourdes");
        $this->currs["HUF"] = array("N" => "Hungary",                                              "C" => "Forint");
        $this->currs["IDR"] = array("N" => "Indonesia",                                            "C" => "Rupiahs");
        $this->currs["ILS"] = array("N" => "Israel",                                               "C" => "New Shekels");
        $this->currs["IMP"] = array("N" => "Isle of Man",                                          "C" => "Pounds");
        $this->currs["INR"] = array("N" => "India",                                                "C" => "Rupees");
        $this->currs["IQD"] = array("N" => "Iraq",                                                 "C" => "Dinars");
        $this->currs["IRR"] = array("N" => "Iran",                                                 "C" => "Rials");
        $this->currs["ISK"] = array("N" => "Iceland",                                              "C" => "Kronur");
        $this->currs["JEP"] = array("N" => "Jersey",                                               "C" => "Pounds");
        $this->currs["JMD"] = array("N" => "Jamaica",                                              "C" => "Dollars");
        $this->currs["JOD"] = array("N" => "Jordan",                                               "C" => "Dinars");
        $this->currs["JPY"] = array("N" => "Japan",                                                "C" => "Yen");
        $this->currs["KES"] = array("N" => "Kenya",                                                "C" => "Shillings");
        $this->currs["KGS"] = array("N" => "Kyrgyzstan",                                           "C" => "Soms");
        $this->currs["KHR"] = array("N" => "Cambodia",                                             "C" => "Riels");
        $this->currs["KMF"] = array("N" => "Comoros",                                              "C" => "Francs");
        $this->currs["KPW"] = array("N" => "Korea (North)",                                        "C" => "Won");
        $this->currs["KRW"] = array("N" => "Korea (South)",                                        "C" => "Won");
        $this->currs["KWD"] = array("N" => "Kuwait",                                               "C" => "Dinars");
        $this->currs["KYD"] = array("N" => "Cayman Islands",                                       "C" => "Dollars");
        $this->currs["KZT"] = array("N" => "Kazakhstan",                                           "C" => "Tenge");
        $this->currs["LAK"] = array("N" => "Laos",                                                 "C" => "Kips");
        $this->currs["LBP"] = array("N" => "Lebanon",                                              "C" => "Pounds");
        $this->currs["LKR"] = array("N" => "Sri Lanka",                                            "C" => "Rupees");
        $this->currs["LRD"] = array("N" => "Liberia",                                              "C" => "Dollars");
        $this->currs["LSL"] = array("N" => "Lesotho",                                              "C" => "Maloti");
        $this->currs["LTL"] = array("N" => "Lithuania",                                            "C" => "Litai");
        $this->currs["LVL"] = array("N" => "Latvia",                                               "C" => "Lati");
        $this->currs["LYD"] = array("N" => "Libya",                                                "C" => "Dinars");
        $this->currs["MAD"] = array("N" => "Morocco",                                              "C" => "Dirhams");
        $this->currs["MDL"] = array("N" => "Moldova",                                              "C" => "Lei");
        $this->currs["MGA"] = array("N" => "Madagascar",                                           "C" => "Ariary");
        $this->currs["MKD"] = array("N" => "Macedonia",                                            "C" => "Denars");
        $this->currs["MMK"] = array("N" => "Myanmar (Burma)",                                      "C" => "Kyats");
        $this->currs["MNT"] = array("N" => "Mongolia",                                             "C" => "Tugriks");
        $this->currs["MOP"] = array("N" => "Macau",                                                "C" => "Patacas");
        $this->currs["MRO"] = array("N" => "Mauritania",                                           "C" => "Ouguiyas");
        $this->currs["MTL"] = array("N" => "Malta",                                                "C" => "Liri (expires 2008-Jan-31)");
        $this->currs["MUR"] = array("N" => "Mauritius",                                            "C" => "Rupees");
        $this->currs["MVR"] = array("N" => "Maldives (Maldive Islands)",                           "C" => "Rufiyaa");
        $this->currs["MWK"] = array("N" => "Malawi",                                               "C" => "Kwachas");
        $this->currs["MXN"] = array("N" => "Mexico",                                               "C" => "Pesos");
        $this->currs["MYR"] = array("N" => "Malaysia",                                             "C" => "Ringgits");
        $this->currs["MZN"] = array("N" => "Mozambique",                                           "C" => "Meticais");
        $this->currs["NAD"] = array("N" => "Namibia",                                              "C" => "Dollars");
        $this->currs["NGN"] = array("N" => "Nigeria",                                              "C" => "Nairas");
        $this->currs["NIO"] = array("N" => "Nicaragua",                                            "C" => "Cordobas");
        $this->currs["NOK"] = array("N" => "Norway",                                               "C" => "Krone");
        $this->currs["NPR"] = array("N" => "Nepal",                                                "C" => "Nepal Rupees");
        $this->currs["NZD"] = array("N" => "New Zealand",                                          "C" => "Dollars");
        $this->currs["OMR"] = array("N" => "Oman",                                                 "C" => "Rials");
        $this->currs["PAB"] = array("N" => "Panama",                                               "C" => "Balboa");
        $this->currs["PEN"] = array("N" => "Peru",                                                 "C" => "Nuevos Soles");
        $this->currs["PGK"] = array("N" => "Papua New Guinea",                                     "C" => "Kina");
        $this->currs["PHP"] = array("N" => "Philippines",                                          "C" => "Pesos");
        $this->currs["PKR"] = array("N" => "Pakistan",                                             "C" => "Rupees");
        $this->currs["PLN"] = array("N" => "Poland",                                               "C" => "Zlotych");
        $this->currs["PYG"] = array("N" => "Paraguay",                                             "C" => "Guarani");
        $this->currs["QAR"] = array("N" => "Qatar",                                                "C" => "Rials");
        $this->currs["RON"] = array("N" => "Romania",                                              "C" => "New Lei");
        $this->currs["RSD"] = array("N" => "Serbia",                                               "C" => "Dinars");
        $this->currs["RUB"] = array("N" => "Russia",                                               "C" => "Rubles");
        $this->currs["RWF"] = array("N" => "Rwanda",                                               "C" => "Rwanda Francs");
        $this->currs["SAR"] = array("N" => "Saudi Arabia",                                         "C" => "Riyals");
        $this->currs["SBD"] = array("N" => "Solomon Islands",                                      "C" => "Dollars");
        $this->currs["SCR"] = array("N" => "Seychelles",                                           "C" => "Rupees");
        $this->currs["SDG"] = array("N" => "Sudan",                                                "C" => "Pounds");
        $this->currs["SEK"] = array("N" => "Sweden",                                               "C" => "Kronor");
        $this->currs["SGD"] = array("N" => "Singapore",                                            "C" => "Dollars");
        $this->currs["SHP"] = array("N" => "Saint Helena",                                         "C" => "Pounds");
        $this->currs["SLL"] = array("N" => "Sierra Leone",                                         "C" => "Leones");
        $this->currs["SOS"] = array("N" => "Somalia",                                              "C" => "Shillings");
        $this->currs["SPL"] = array("N" => "Seborga",                                              "C" => "Luigini");
        $this->currs["SRD"] = array("N" => "Suriname",                                             "C" => "Dollars");
        $this->currs["STD"] = array("N" => "S&atilde;o Tome and Principe",                         "C" => "Dobras");
        $this->currs["SVC"] = array("N" => "El Salvador",                                          "C" => "Colones");
        $this->currs["SYP"] = array("N" => "Syria",                                                "C" => "Pounds");
        $this->currs["SZL"] = array("N" => "Swaziland",                                            "C" => "Emalangeni");
        $this->currs["THB"] = array("N" => "Thailand",                                             "C" => "Baht");
        $this->currs["TJS"] = array("N" => "Tajikistan",                                           "C" => "Somoni");
        $this->currs["TMM"] = array("N" => "Turkmenistan",                                         "C" => "Manats");
        $this->currs["TND"] = array("N" => "Tunisia",                                              "C" => "Dinars");
        $this->currs["TOP"] = array("N" => "Tonga",                                                "C" => "Pa&apos;anga");
        $this->currs["TRY"] = array("N" => "Turkey",                                               "C" => "New Lira");
        $this->currs["TTD"] = array("N" => "Trinidad and Tobago",                                  "C" => "Dollars");
        $this->currs["TVD"] = array("N" => "Tuvalu",                                               "C" => "Tuvalu Dollars");
        $this->currs["TWD"] = array("N" => "Taiwan",                                               "C" => "New Dollars");
        $this->currs["TZS"] = array("N" => "Tanzania",                                             "C" => "Shillings");
        $this->currs["UAH"] = array("N" => "Ukraine",                                              "C" => "Hryvnia");
        $this->currs["UGX"] = array("N" => "Uganda",                                               "C" => "Shillings");
        $this->currs["USD"] = array("N" => "United States of America",                             "C" => "Dollars");
        $this->currs["UYU"] = array("N" => "Uruguay",                                              "C" => "Pesos");
        $this->currs["UZS"] = array("N" => "Uzbekistan",                                           "C" => "Sums");
        $this->currs["VEB"] = array("N" => "Venezuela",                                            "C" => "Bolivares (expires 2008-Jun-30)");
        $this->currs["VEF"] = array("N" => "Venezuela",                                            "C" => "Bolivares Fuertes");
        $this->currs["VND"] = array("N" => "Viet Nam",                                             "C" => "Dong");
        $this->currs["VUV"] = array("N" => "Vanuatu",                                              "C" => "Vatu");
        $this->currs["WST"] = array("N" => "Samoa",                                                "C" => "Tala");
        $this->currs["XAF"] = array("N" => "Communaut&eacute; Financi&egrave;re Africaine BEAC",   "C" => "Francs");
        $this->currs["XAG"] = array("N" => "Silver",                                               "C" => "Ounces");
        $this->currs["XAU"] = array("N" => "Gold",                                                 "C" => "Ounces");
        $this->currs["XCD"] = array("N" => "East Caribbean",                                       "C" => "Dollars");
        $this->currs["XDR"] = array("N" => "IMF Special Drawing Rights",                           "C" => "XDR");
        $this->currs["XOF"] = array("N" => "Communaut&eacute; Financi&egrave;re Africaine BCEAO",  "C" => "Francs");
        $this->currs["XPD"] = array("N" => "Palladium",                                            "C" => "Ounces");
        $this->currs["XPF"] = array("N" => "Comptoirs Fran&ccedil;ais du Pacifique Francs",        "C" => "CFP Francs");
        $this->currs["XPT"] = array("N" => "Platinum",                                             "C" => "Ounces");
        $this->currs["YER"] = array("N" => "Yemen",                                                "C" => "Rials");
        $this->currs["ZAR"] = array("N" => "South Africa",                                         "C" => "Rand");
        $this->currs["ZMK"] = array("N" => "Zambia",                                               "C" => "Kwacha");
        $this->currs["ZWD"] = array("N" => "Zimbabwe",                                             "C" => "Zimbabwe Dollars");

        // ELIMINATE THE MISMATCHED ITEMS
        $this->norml = $this->normalArrays();
    }

    public function getRates()
    {
        return $this->rates;
    }

    public function getCurrs()
    {
        return $this->currs;
    }

    public function getNormalization()
    {
        return $this->norml;
    }

    public function getError()
    {
        return $this->error;
    }

    public function asTerse()
    {
        return $this->terse;
    }

    public function asVerbose()
    {
        return $this->verbose;
    }

    public function asArray()
    {
        return $this->array;
    }

    public function normalArrays()
    {
        $response = NULL;
        foreach ($this->currs as $code => $x)
        {
            if (!isset($this->rates[$code]))
            {
                $response .= PHP_EOL . "$code IS IN CURRENCIES BUT NOT IN RATES";
                unset($this->currs[$code]);
            }
        }
        if ($response) $response .= PHP_EOL;
        foreach ($this->rates as $code => $x)
        {
            if (!isset($this->currs[$code]))
            {
                $response .= PHP_EOL . "$code IS IN RATES BUT NOT IN CURRENCIES";
                unset($this->rates[$code]);
            }
        }
        return $response;
    }

    public function isCurrency($code)
    {
        if (isset($this->rates[$code]))
        {
            return $this->rates[$code];
        }
        return FALSE;
    }

    public function convert($amount, $source_currency, $result_currency, $decimals=6)
    {
        // NORMALIZE DATA
        $this->array   = array();
        $this->error   = NULL;
        $this->terse   = NULL;
        $this->verbose = NULL;

        $source_currency = trim(strtoupper($source_currency));
        if (!isset($this->currs[$source_currency]))
        {
            $this->error .= "Currency $source_currency not found" . PHP_EOL;
        }

        $result_currency = trim(strtoupper($result_currency));
        if (!isset($this->currs[$result_currency]))
        {
            $this->error .= "Currency $result_currency not found" . PHP_EOL;
        }

        if ($this->error) return FALSE;

        // COMPUTE THE CONVERSION
        $rezult = 1.0 / $this->rates[$source_currency] * $this->rates[$result_currency] * $amount;

        //PREPARE THE RESPONSES
        $this->array
        = array
        ( "$source_currency" => number_format($amount, $decimals, '.', '')
        , "$result_currency" => number_format($rezult, $decimals, '.', '')
        )
        ;

        $this->terse
        = $this->array[$source_currency]
        . $source_currency
        . '='
        . $this->array[$result_currency]
        . "$result_currency"
        ;

        $this->verbose
        = $this->array[$source_currency]
        . ' '
        . $source_currency
        . ' ('
        . $this->currs[$source_currency]['N']
        . ' '
        . $this->currs[$source_currency]['C']
        . ')'
        . ' = '
        . $this->array[$result_currency]
        . ' '
        . $result_currency
        .' ('
        . $this->currs[$result_currency]['N']
        . ' '
        . $this->currs[$result_currency]['C']
        . ')'
        ;
        return (string)$rezult;
    }
}



// DEMONSTRATION SCRIPT
echo '<pre>';
$cc = new CurrencyConverter;

// SEE WHAT IS MISSING FROM THE CONVERTER
echo $cc->getNormalization();

// TRY THE SPOT PRICE OF AN OUNCE OF GOLD
$gold = $cc->convert(1.0, 'XAU', 'USD', 2);

// IF ANY ERROR OCCURRED
if ($cc->getError())
{
    echo PHP_EOL . $cc->getError();
}
else
{
    echo PHP_EOL . 'THE PRICE OF GOLD IS $' . number_format($gold,2);
}



// CONVERT 3 BRITISH POUNDS TO US DOLLARS
echo PHP_EOL . $cc->convert(3.0, 'gbp', 'usd', 2);

// IF ANY ERROR OCCURRED
if ($cc->getError()) echo PHP_EOL . $cc->getError();

// SHOW THE THREE RETURN METHODS
echo PHP_EOL . $cc->asTerse();
echo PHP_EOL . $cc->asVerbose();
echo PHP_EOL;  var_dump($cc->asArray());



// SHOW ERROR HANDLING - CONVERT 2 FOOS TO BARS
echo PHP_EOL . $cc->convert(2, 'Foo', 'Bar');

// IF ANY ERROR OCCURRED
if ($cc->getError()) echo PHP_EOL . $cc->getError();

// SHOW THE THREE RETURN METHODS
echo PHP_EOL . $cc->asTerse();
echo PHP_EOL . $cc->asVerbose();
echo PHP_EOL;  var_dump($cc->asArray());



// IF A FORM WAS SUBMITTED
if (!empty($_GET))
{
    $getResult = $cc->convert($_GET['a'], $_GET['f'], $_GET['t']);

    // IF ANY ERROR OCCURRED
    if ($cc->getError()) echo PHP_EOL . $cc->getError();

    // SHOW THE THREE RETURN METHODS
    echo PHP_EOL . $cc->asTerse();
    echo PHP_EOL . $cc->asVerbose();
    echo PHP_EOL;  var_dump($cc->asArray());
}


// CREATE A FORM FOR THE CLIENT
echo '<form>';

echo 'AMOUNT TO CONVERT: ';
echo '<input name="a" />';

echo '<br/>CHOOSE "FROM" CURRENCY';
echo '<br/><select name="f">' . PHP_EOL;
echo '<option value="NUL" selected="selected">CHOOSE CURRENCY</option>' . PHP_EOL;
foreach ($cc->getCurrs() as $code => $arr)
{
    echo '<option value="';
    echo $code;
    echo '">';
    echo $arr['N'];
    echo ' ';
    echo $arr['C'];
    echo '</option>' . PHP_EOL;
}
echo '</select>' . PHP_EOL;

echo '<br/>CHOOSE "TO" CURRENCY';
echo '<br/><select name="t">' . PHP_EOL;
echo '<option value="NUL" selected="selected">CHOOSE CURRENCY</option>' . PHP_EOL;
foreach ($cc->getCurrs() as $code => $arr)
{
    echo '<option value="';
    echo $code;
    echo '">';
    echo $arr['N'];
    echo ' ';
    echo $arr['C'];
    echo '</option>' . PHP_EOL;
}
echo '</select>' . PHP_EOL;

echo '<input type="submit" />';
echo '</form>';

// SHOW THE CURRENCIES WE HAVE IN THE OBJECT
print_r($cc->getcurrs());

Open in new window

0
 

Author Comment

by:koop1koop
ID: 36545093
0
 

Author Closing Comment

by:koop1koop
ID: 36545100
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now