March 18th, 2010
function mail_utf8($to, $subject = '(No subject)', $message = '', $header = '') {
$header_ = 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/plain; charset=UTF-8' . "\r\n";
mail($to, '=?UTF-8?B?'.base64_encode($subject).'?=', $message, $header_ . $header);
}
Tags: How to send correct UTF-8 mail in PHP
Posted in PHP.net | 1 Comment »
March 15th, 2010
Posted in Glasba | No Comments »
March 15th, 2010
Posted in Glasba | No Comments »
March 3rd, 2010
$main_string="This is a test string <a href=http://www.plus2net.com>with a link</a> to plus2net";
if(stristr($main_string,"http://")){
echo "String contains a link or the text http:// inside it ";}
else {
echo "String does not contains a link or the text http:// inside it ";}
Tags: stristr
Posted in PHP.net | No Comments »
March 1st, 2010
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
iptables -A FORWARD -i tun0 -s 10.8.0.0/24 -o eth0 -j ACCEPT
iptables -A FORWARD -i eth0 -o tun0 -m state –state ESTABLISHED,RELATED -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward
Posted in Centos | No Comments »
February 27th, 2010
<?php
$date = "25-12-2010";//[something in US format: mm-dd-yy]
$newdate = substr($date,6,4) . "-" . substr($date,3,2) . "-" . substr($date,0,2);
print "\n=====\n".$newdate."\n===============\n";
?>
Posted in PHP.net | No Comments »
February 27th, 2010
<?php
echo strrev("Hello world!"); // outputs "!dlrow olleH"
?>
Posted in PHP.net | No Comments »
February 24th, 2010
SELECT * FROM 'table' WHERE `name` REGEXP '\r'
UPDATE 'table' SET 'field' = REPLACE(FIELD,"findvalue", "reaplcevalue") WHERE REGEXP 'regexp search expression'
Posted in MySQL programiranje | No Comments »