Chủ Nhật, 29 tháng 3, 2015

Debug php console chrome

<?php
require APPPATH . '/third_party/PhpConsole/__autoload.php';
function d($title="",$content=""){
switch (ENVIRONMENT){
case 'development':
$handler = PhpConsole\Handler::getInstance();
$handler->debug($title,$content);
break;
}
}

Thứ Sáu, 23 tháng 1, 2015

Form auto ajax


Link download: *ttps://app.box.com/s/o6g2gb6q4iz6tjlpuk5ehgrtbxhm9hk8

Thứ Tư, 24 tháng 12, 2014

Keymap sublime text

[
    { "keys": ["f1"], "command": "insert_snippet", "args": { "name": "Packages/XML/long-tag.sublime-snippet" } },
    { "keys": ["f2"], "command": "insert_snippet", "args": {"contents": "<?php ${0:$SELECTION} ?>"}},
    { "keys": ["f3"], "command": "insert_snippet", "args": {"contents": "  ?> ${0:$SELECTION} <?php "}},
    { "keys": ["f4"], "command": "insert_snippet", "args": {"contents": "  // Đánh dấu phần này "}},
    { "keys": ["ctrl+m"], "command": "sftp_browse" },
    { "keys": ["ctrl+u"], "command": "sftp_upload_file" },
    { "keys": ["shift+f4"], "command": "toggle_side_bar" }
]

Thứ Hai, 15 tháng 12, 2014

Dialog jquery

                function show_dialog(mes){
                    if(!$(".dialog_jquery").width())
                        $("body").append('<div class="dialog_jquery"></div>');  
                    $(".dialog_jquery").text(mes);
                    $(".dialog_jquery").fadeIn(200).delay(1000).fadeOut(200);
                    var width_b=$(window).width()/2 - ($(".dialog_jquery").width()/2);
                    $(".dialog_jquery").css({top:"10px",left:width_b+"px"});                                                  
                }.dialog_jquery {
  background: none repeat scroll 0 0 white;
  border: 5px solid rgba(80, 78, 78, 0.58);
  border-radius: 5px;
  color: black;
  left: 0;
  padding: 18px;
  position: fixed;
  top: 0;
  z-index: 444;
}

Thứ Hai, 29 tháng 9, 2014

Thứ Sáu, 8 tháng 8, 2014

convert_time($time) mysql_format to timestamp


Convert_time($time) mysql_format to timestamp  




function convert_time($time){
        if(!$time) return false;
        $array1=explode(" ",$time);
        $array2["date"]=explode("-",$array1[0]);
        $array2["time"]=explode(":",$array1[1]);           
        $int_time=mktime($array2["time"][0],$array2["time"][1],$array2["time"][2],$array2["date"][1],$array2["date"][2],$array2["date"][0]);
        if($int_time)
            return $int_time;
        else
            return false;
    }

Thứ Ba, 29 tháng 7, 2014

Xóa dòng này !!!


Function check table có tồn tại không !

        function table_exist($nametable){
            $nametable=trim($nametable);
        if($this->sql_numrows($this->sql_query("SHOW TABLES LIKE '".$nametable."'"))==1)
            return true;
        else
            return false;
        }

Thứ Sáu, 25 tháng 7, 2014

Resize scale png transparent !!




            $source = "".$inpath."/".$inimg."";
            $source = imagecreatefrompng($source);
            $newImg=resizePng($source , 50, 50);
            imagepng($newImg, "".$inpath."/".$inimg."");
            ImageDestroy($newImg);

function resizePng($im, $dst_width, $dst_height) {
    $width = imagesx($im);
    $height = imagesy($im);
    $dst_height = $height/($width/$dst_width);
    $newImg = imagecreatetruecolor($dst_width, $dst_height);
    imagealphablending($newImg, false);
    imagesavealpha($newImg, true);
    $transparent = imagecolorallocatealpha($newImg, 255, 255, 255, 127);
    imagefilledrectangle($newImg, 0, 0, $width, $height, $transparent);
    imagecopyresampled($newImg, $im, 0, 0, 0, 0, $dst_width, $dst_height, $width, $height);
    return $newImg;
}

Thứ Năm, 24 tháng 7, 2014

Thứ Tư, 23 tháng 7, 2014

Show tất cả biến global !!! Thật là nguy hiểm !


        echo "<pre>";
            print_r($GLOBALS);
        echo "</pre>";
        die;

Thứ Ba, 22 tháng 7, 2014

Thứ Hai, 21 tháng 7, 2014


Link github
https://github.com/vihoangson/vihanviet/blob/master/class.step_cart.php

update shopping cart


Thứ Sáu, 18 tháng 7, 2014

Mở chế độ chạy .htaccess trên Appserv

Bước 1: Vào thư mục cài đặt (thông thường C:\AppServ\Apache2.2\conf\)
Mở file httpd.conf tìm đến
#LoadModule rewrite_module modules/mod_rewrite.so
Bỏ dấu # ở phía trước, trở thành
LoadModule rewrite_module modules/mod_rewrite.so
Bước 2: Không cần thiết lắm, mục đích là để server nhận đúng tên file htaccess, vì trong windows khó đặt tên file có dấu . ở trước nên ta thêm vào x cho thuận tiện thôi.
Tìm AccessFileName.htaccess
Thay bằng: AccessFileName x.htaccess
Save all.
Bước 3. Khởi động lại Apache
Thường thì vào: C:\Appserv\Apache2.2\bin chạy file ApacheMonitor.exe click Restart Hoặc click Start>>All Programs>> … tìm trong đó. Enjoy
Sưu tầm: Al0nex’s blog

Thứ Ba, 15 tháng 7, 2014

disable get_content


Dòng 40 security.php

if (stristr($_SERV

Thứ Bảy, 12 tháng 7, 2014

regular expression css selector



Div[id^="son"]
Div[id*="son"]
Div[id$="son"]

Thứ Bảy, 21 tháng 6, 2014