Setting up the server The “good news” is that we can’t control the browser. It either sends the Accept-encoding: gzip, deflate header or it doesn’t. Our job is to configure the server so it returns zipped content if the browser can handle it, saving bandwidth for everyone (and giving us a happy user).
Tag Archives: scripting
PHP mail validation function
function valid_email($str) { return ( ! preg_match(“/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix”, $str)) ? FALSE : TRUE; }
Custom Trigger View Recordset Data
For PHP:$_SESSION[‘kt_login_id’] = $tNG->getPrimaryKeyValue(); $_SESSION[‘kt_login_user’] = $tNG->getColumnValue(‘name_usr’); For ASPVBScript:Session(“kt_login_id”) = tNG.getPrimaryKey Session(“kt_login_user”) = tNG.getColumnValue(“name_usr”) SET Trigger_Custom = Nothing For ColdFusion:SESSION.kt_login_id = tNG.getPrimaryKeyValue(); SESSION.kt_login_user = tNG.getColumnValue (“name_usr”);
PHP – remove tag from string
<? $content = “this is something with an <img src=\”test.png\”/> in it.”; $content = preg_replace(“/<img[^>]+\>/i”, “(image) “, $content); echo $content; ?> The result is: this is something with an (image) in it.
PHP datetime Format
The format of the outputted date string . See the formatting options below. There are also several predefined date constants that may be used instead, so for example DATE_RSS contains the format string ‘D, d M Y H:i:s’.
php number_format Decimal
<?php $number = 1234.56; // english notation (default) $english_format_number = number_format($number); // 1,235 // French notation $nombre_format_francais = number_format($number, 2, ‘,’, ‘ ‘); // 1 234,56 $number = 1234.5678; // english notation without thousands seperator $english_format_number = number_format($number, 2, ‘.’, ”); // 1234.57 ?>