Kiến thức là vô biên, vì vậy hãy chia sẻ nó. Trên đây là một số công cụ và source mình sưu tầm được. Mong là nó sẽ hữu ích đối với bạn !
Code Google
Thứ Bảy, 31 tháng 8, 2013
Thứ Ba, 27 tháng 8, 2013
Sử dụng Gmail Delay Send - Auto post group facebook
Thứ Hai, 26 tháng 8, 2013
Thứ Bảy, 24 tháng 8, 2013
Xương sống trang bighost.vn
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="StyleSheet" href="style/bootstrap/css/bootstrap.css" type="text/css">
<link rel="StyleSheet" href="style/style.css" type="text/css">
<title>Untitled Document</title>
</head>
<body>
<div class="bodyful">
<div class="header_box">
<h1>logo </h1>
<div class="login_box">
login
</div>
<div class="tt_box">
thongtin
</div>
</div>
<div class="menu_box">
<div class="menu_ul">
<ul>
<li><a href="#">1</a></li>
<li><a href="#">1</a></li>
<li><a href="#">1</a></li>
<li><a href="#">1</a></li>
</ul>
</div>
<div class="line_menu">
san pham
cart
search
</div>
</div>
<div class="serch_box">
<form>
<input />
<button type="submit">Search</button>
</form>
</div>
<div class="slide_box">
<div class="slider_nivo">
<img src="" /> <img src="" /> <img src="" /> <img src="" />
</div>
</div>
<div class="thongbao_box">
<div class="row-fluid">
<div class="span4">
<img src="" />
<h1>sssssss</h1>
aaaaaaaaaaaa <a href="#">Shop now</a>
</div>
<div class="span4">
<img src="" />
<h1>sssssss</h1>
aaaaaaaaaaaa <a href="#">Shop now</a>
</div>
<div class="span4">
<img src="" />
<h1>sssssss</h1>
aaaaaaaaaaaa <a href="#">Shop now</a>
</div>
</div>
</div>
<div class="thongtin_box">
<img src="" />
<h1>noiasdf </h1>
<p> lskdjfal;skdfj </p>
</div>
<div class="footer_box">
<div class="row-fluid">
<div class="span4">
<strong>Thoong tin cong ty</strong> asdfasdfsd<br />
asdfasdf<br />
asdfsadf<br />
asdf<br />
network ...
</div>
<div class="span4">
<strong>dat hang </strong>
<ul>
<li><a href="#">aaaa</a></li>
<li><a href="#">aaaa</a></li>
<li><a href="#">aaaa</a></li>
<li><a href="#">aaaa</a></li>
</ul>
</div>
<div class="span4">
<strong>vihan corp</strong> asdfasdfsd<br />
asdfasdf<br />
asdfsadf<br />
asdf<br />
</div>
</div>
<div class="quangcao_box">
<ul>
<li><a href="#"><img src="" /></a></li>
<li><a href="#"><img src="" /></a></li>
<li><a href="#"><img src="" /></a></li>
<li><a href="#"><img src="" /></a></li>
<li><a href="#"><img src="" /></a></li>
</ul>
</div>
<div class="tacgia_box">
<img src="" /> asl;dkfjsl;kdfj<br />
asdfasdf<br />
asdfsdf<br />
</div>
</div>
</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="StyleSheet" href="style/bootstrap/css/bootstrap.css" type="text/css">
<link rel="StyleSheet" href="style/style.css" type="text/css">
<title>Untitled Document</title>
</head>
<body>
<div class="bodyful">
<div class="header_box">
<h1>logo </h1>
<div class="login_box">
login
</div>
<div class="tt_box">
thongtin
</div>
</div>
<div class="menu_box">
<div class="menu_ul">
<ul>
<li><a href="#">1</a></li>
<li><a href="#">1</a></li>
<li><a href="#">1</a></li>
<li><a href="#">1</a></li>
</ul>
</div>
<div class="line_menu">
san pham
cart
search
</div>
</div>
<div class="serch_box">
<form>
<input />
<button type="submit">Search</button>
</form>
</div>
<div class="slide_box">
<div class="slider_nivo">
<img src="" /> <img src="" /> <img src="" /> <img src="" />
</div>
</div>
<div class="thongbao_box">
<div class="row-fluid">
<div class="span4">
<img src="" />
<h1>sssssss</h1>
aaaaaaaaaaaa <a href="#">Shop now</a>
</div>
<div class="span4">
<img src="" />
<h1>sssssss</h1>
aaaaaaaaaaaa <a href="#">Shop now</a>
</div>
<div class="span4">
<img src="" />
<h1>sssssss</h1>
aaaaaaaaaaaa <a href="#">Shop now</a>
</div>
</div>
</div>
<div class="thongtin_box">
<img src="" />
<h1>noiasdf </h1>
<p> lskdjfal;skdfj </p>
</div>
<div class="footer_box">
<div class="row-fluid">
<div class="span4">
<strong>Thoong tin cong ty</strong> asdfasdfsd<br />
asdfasdf<br />
asdfsadf<br />
asdf<br />
network ...
</div>
<div class="span4">
<strong>dat hang </strong>
<ul>
<li><a href="#">aaaa</a></li>
<li><a href="#">aaaa</a></li>
<li><a href="#">aaaa</a></li>
<li><a href="#">aaaa</a></li>
</ul>
</div>
<div class="span4">
<strong>vihan corp</strong> asdfasdfsd<br />
asdfasdf<br />
asdfsadf<br />
asdf<br />
</div>
</div>
<div class="quangcao_box">
<ul>
<li><a href="#"><img src="" /></a></li>
<li><a href="#"><img src="" /></a></li>
<li><a href="#"><img src="" /></a></li>
<li><a href="#"><img src="" /></a></li>
<li><a href="#"><img src="" /></a></li>
</ul>
</div>
<div class="tacgia_box">
<img src="" /> asl;dkfjsl;kdfj<br />
asdfasdf<br />
asdfsdf<br />
</div>
</div>
</div>
</body>
</html>
Thứ Sáu, 23 tháng 8, 2013
Thứ Ba, 20 tháng 8, 2013
Function list for notepad ++ php
###########################
Bước 1 Đăng ký thủ tục id =1
<association langID = "1" id="php_function"/>
###########################
Bước 2 Định hướng lấy tên function
<parser id="php_function" displayName="Php" commentExpr="((/\*.*?\*)/|(//.*?$))">
<function
mainExpr="^[\t ]*((static|const|virtual)[\s]+)?[\w:]+([\s]+[\w]+)?([\s]+|\*[\s]+|[\s]+\*|[\s]+\*[\s]+)([\w_]+[\s]*::)?(?!(if|while|for))[\w_]+[\s]*\([^\)\(]*\)([\s]*const[\s]*)?[\n\s]*\{"
displayMode="$functionName">
<functionName>
<nameExpr expr="(?!(if|while|for))[\w_~]+[\s]*\("/>
<nameExpr expr="(?!(if|while|for))[\w_~]+"/>
</functionName>
</function>
</parser>
###########################
Thứ Hai, 19 tháng 8, 2013
Function thumbs 1.1
function thumbs($outpath,$inpath,$outimg,$inimg,$insize) {
if(@copy("".$outpath."/".$outimg."", "".$inpath."/".$inimg."")) {
$f_name = end(explode(".", $inimg));
$f_extension = strtolower($f_name);
if ($f_extension == "jpg" && extension_loaded("gd")) {
$src_img= ImageCreateFromJpeg("".$inpath."/".$inimg."");
$src_width= ImagesX($src_img);
$src_height= ImagesY($src_img);
$dest_width = $insize;
$dest_height = $src_height/($src_width/$dest_width);
$dest_img=ImageCreateTrueColor($dest_width, $dest_height);
ImageCopyResampled($dest_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height);
ImageJpeg($dest_img, "".$inpath."/".$inimg."", 100);
ImageDestroy($dest_img);
}
if ($f_extension == "png" && extension_loaded("gd")) {
$src_img= imagecreatefrompng("".$inpath."/".$inimg."");
$src_width= imagesx($src_img);
$src_height= imagesy($src_img);
$dest_width = $insize;
$dest_height = $src_height/($src_width/$dest_width);
$dest_img=imagecreatetruecolor($dest_width, $dest_height);
imagecopyresampled($dest_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height);
imagepng($dest_img, "".$inpath."/".$inimg."");
imagedestroy($dest_img);
}
if ($f_extension == "gif" && extension_loaded("gd")) {
$src_img= imagecreatefromgif("".$inpath."/".$inimg."");
$src_width= imagesx($src_img);
$src_height= imagesy($src_img);
$dest_width = $insize;
$dest_height = $src_height/($src_width/$dest_width);
$dest_img=imagecreatetruecolor($dest_width, $dest_height);
imagecopyresampled($dest_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height);
imagegif($dest_img, "".$inpath."/".$inimg."", 100);
imagedestroy($dest_img);
}
}
}
if(@copy("".$outpath."/".$outimg."", "".$inpath."/".$inimg."")) {
$f_name = end(explode(".", $inimg));
$f_extension = strtolower($f_name);
if ($f_extension == "jpg" && extension_loaded("gd")) {
$src_img= ImageCreateFromJpeg("".$inpath."/".$inimg."");
$src_width= ImagesX($src_img);
$src_height= ImagesY($src_img);
$dest_width = $insize;
$dest_height = $src_height/($src_width/$dest_width);
$dest_img=ImageCreateTrueColor($dest_width, $dest_height);
ImageCopyResampled($dest_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height);
ImageJpeg($dest_img, "".$inpath."/".$inimg."", 100);
ImageDestroy($dest_img);
}
if ($f_extension == "png" && extension_loaded("gd")) {
$src_img= imagecreatefrompng("".$inpath."/".$inimg."");
$src_width= imagesx($src_img);
$src_height= imagesy($src_img);
$dest_width = $insize;
$dest_height = $src_height/($src_width/$dest_width);
$dest_img=imagecreatetruecolor($dest_width, $dest_height);
imagecopyresampled($dest_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height);
imagepng($dest_img, "".$inpath."/".$inimg."");
imagedestroy($dest_img);
}
if ($f_extension == "gif" && extension_loaded("gd")) {
$src_img= imagecreatefromgif("".$inpath."/".$inimg."");
$src_width= imagesx($src_img);
$src_height= imagesy($src_img);
$dest_width = $insize;
$dest_height = $src_height/($src_width/$dest_width);
$dest_img=imagecreatetruecolor($dest_width, $dest_height);
imagecopyresampled($dest_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height);
imagegif($dest_img, "".$inpath."/".$inimg."", 100);
imagedestroy($dest_img);
}
}
}
Thứ Tư, 14 tháng 8, 2013
Ứng dụng SQLite trong website data chỉ trong 1 file ^^
http://www.mediafire.com/?27hy3a59wu43km4
Connect data
$namefile = 'sqlitedb.sqlite';
try {
$dblite = new PDO('sqlite:' . $namefile);
} catch (Exception $e) {
die($e);
}
function do_query($sql){
global $dblite;
$row3=$dblite->query($sql);
return $row3;
}
function get_data($sql){
global $dblite;
$row3=$dblite->query($sql);
$data=array();
foreach ($row3 as $row) {
$data[]=$row;
}
return $data;
}
Query Sql
$data=get_data("select * from user ");
for($i=0;$i<sizeof($data);$i++){
echo "<p>".($i+1)." - <strong>".$data[$i]["ten"]."</strong> - ".$data[$i]["email"]."</p>";
}
Thứ Hai, 12 tháng 8, 2013
Thứ Năm, 1 tháng 8, 2013
Cách chống spam nick diễn đàn vbb
Tạo ra file son.php với nội dung
<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="script/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css" />
<title>Trả lời câu hỏi</title>
</head>
<body>
<center>
<h1>Để tránh đăng ký ảo ! mời bạn trả lời một số câu hỏi bên dưới !</h1>
<form action='son.php' method='post'>
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3kkf3lWuy5RmRUUrXHIg38hk0Dp34j46EdzVD-X39tmZDB9BboPAYzOBpDxb3lrsiRCKfY4JTFBTHM7GLDrivMqdABK8yfV_f7seIKf5E9mfBiPGhVDhSQ2Fka2tE9TxIoA8xhwJirAE/s320/tom-jerry9789789.jpg" />
<div><strong><h3>Câu hỏi 1: Tên con mèo hay đuổi chuột Jerry tên gì ?</h3></strong></div>
<strong>Trả lời:</strong> <input type='text' name='pass'><br>
<img src="http://www.corleydogtraining.co.uk/Dog1.jpg" />
<div><strong><h3>Câu hỏi 2: Con chó có đuôi không ? (có/không): ?</h3></strong></div>
<strong>Trả lời:</strong> <input type='text' name='pass2'><br>
<input type='submit' name='ok' value='Bước thứ 2'>
</form>
<br>
<?php error_reporting(0);
if(isset($_POST['ok'])) {
if(strtolower($_POST['pass'])==strtolower('tom') && (strtolower($_POST['pass2'])==strtolower('co')||strtolower($_POST['pass2'])==strtolower('có'))){
$_SESSION['nhappassok1123'] = $_POST['pass'];
echo '<br>Ok. Vui lòng chờ 1 giây để chuyển ...';
echo '<meta http-equiv="Refresh" Content="0; url=http://traitimthienthan.com/diendan/register1.php">';
exit;
}
else {
echo '<b>Lỗii:</b> Bạn nhập không đúng xin nhập lại';
}
}
?>
</center>
</body>
</html>
***********************
copy vào phần đầu của file register.php
<?php
session_start();
if (!isset($_SESSION['nhappassok1123'])){
include 'son.php';
exit;
}
==========================================
Cách 2:
Đổi tên file register.php thành tên khác
Nhớ đổi tên trong template
+ email xác nhận thành viên
<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="script/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css" />
<title>Trả lời câu hỏi</title>
</head>
<body>
<center>
<h1>Để tránh đăng ký ảo ! mời bạn trả lời một số câu hỏi bên dưới !</h1>
<form action='son.php' method='post'>
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3kkf3lWuy5RmRUUrXHIg38hk0Dp34j46EdzVD-X39tmZDB9BboPAYzOBpDxb3lrsiRCKfY4JTFBTHM7GLDrivMqdABK8yfV_f7seIKf5E9mfBiPGhVDhSQ2Fka2tE9TxIoA8xhwJirAE/s320/tom-jerry9789789.jpg" />
<div><strong><h3>Câu hỏi 1: Tên con mèo hay đuổi chuột Jerry tên gì ?</h3></strong></div>
<strong>Trả lời:</strong> <input type='text' name='pass'><br>
<img src="http://www.corleydogtraining.co.uk/Dog1.jpg" />
<div><strong><h3>Câu hỏi 2: Con chó có đuôi không ? (có/không): ?</h3></strong></div>
<strong>Trả lời:</strong> <input type='text' name='pass2'><br>
<input type='submit' name='ok' value='Bước thứ 2'>
</form>
<br>
<?php error_reporting(0);
if(isset($_POST['ok'])) {
if(strtolower($_POST['pass'])==strtolower('tom') && (strtolower($_POST['pass2'])==strtolower('co')||strtolower($_POST['pass2'])==strtolower('có'))){
$_SESSION['nhappassok1123'] = $_POST['pass'];
echo '<br>Ok. Vui lòng chờ 1 giây để chuyển ...';
echo '<meta http-equiv="Refresh" Content="0; url=http://traitimthienthan.com/diendan/register1.php">';
exit;
}
else {
echo '<b>Lỗii:</b> Bạn nhập không đúng xin nhập lại';
}
}
?>
</center>
</body>
</html>
***********************
copy vào phần đầu của file register.php
<?php
session_start();
if (!isset($_SESSION['nhappassok1123'])){
include 'son.php';
exit;
}
==========================================
Cách 2:
Đổi tên file register.php thành tên khác
Nhớ đổi tên trong template
+ email xác nhận thành viên
Thứ Tư, 31 tháng 7, 2013
Thứ Ba, 30 tháng 7, 2013
Jquery AJAX Save to file
$('a#exportPage').on('click',function(){
var contentMap = {};
$('[id^="appendHeading"]').each(function(){
contentMap[this.id] = $(this).text();
});
for(id in contentMap)
$("#PrintIds").append("ObjectID:" + id + "Content:" + contentMap[id]);
$.ajax({
url: "post.php",
type: "post",
data: {
objectID: id,
content: contentMap[id]
},
success: function(){
alert("success");
},
error:function(){
alert("failure");
}
});
});
And this PHP:<?php
if ($_POST['objectID'] || $_POST['content']) {
$myFile = "test.css";
$stringData = $_POST['objectID'] || $_POST['content'];
file_put_contents($myFile,$stringData);
}
?>
Thứ Ba, 23 tháng 7, 2013
Lấy url hiện tại
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
Thứ Hai, 1 tháng 7, 2013
List Function in file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
input[type="text"]{
width:400px;
}
textarea{
width:400px;
height:400px;
}
</style>
</head>
<body>
<form>
<div>Url: <input type="text" name="url" value="<?php echo $_GET["url"] ; ?>"/></div>
<div>list: <textarea name="list"><?php echo $_GET["list"] ; ?></textarea></div>
<div><input type="submit" /></div>
</form>
<?php
if($_GET["url"]){
$string_file=str_replace(" ","",$_GET["url"]);
echo "<h3>".$string_file."</h3>";
$data_f=get_defined_functions_in_file($string_file);
for($i=0;$i<sizeof($data_f);$i++){
echo "<div>".$data_f[$i]."</div>";
}
}
if($_GET["list"]){
$array_l=explode(",",str_replace(" ","",$_GET["list"]));
for($j=0;$j<sizeof($array_l);$j++){
$string_file=$array_l[$j];
echo "<h3>".$string_file."</h3>";
$data_f=get_defined_functions_in_file($string_file);
for($i=0;$i<sizeof($data_f);$i++){
echo "<div>".$data_f[$i]."</div>";
}
}
}
function get_defined_functions_in_file($file) {
$source = file_get_contents($file);
$tokens = token_get_all($source);
$functions = array();
$nextStringIsFunc = false;
$inClass = false;
$bracesCount = 0;
foreach($tokens as $token) {
switch($token[0]) {
case T_CLASS:
$inClass = true;
break;
case T_FUNCTION:
if(!$inClass) $nextStringIsFunc = true;
break;
case T_STRING:
if($nextStringIsFunc) {
$nextStringIsFunc = false;
$functions[] = $token[1];
}
break;
// Anonymous functions
case '(':
case ';':
$nextStringIsFunc = false;
break;
// Exclude Classes
case '{':
if($inClass) $bracesCount++;
break;
case '}':
if($inClass) {
$bracesCount--;
if($bracesCount === 0) $inClass = false;
}
break;
}
}
return $functions;
}
?>
</body>
</html>
Thứ Ba, 25 tháng 6, 2013
TẠO POPUP 26_6_2013
CSS
===========================================================
<style>
.box_login_ajax {
position: absolute;
}
#mask {
background: black;
position: fixed;
}
</style>
HTML
===========================================================
<div id="mask"></div>
<a id='dangnhap_a' href="http://localhost/retot/modules.php?name=Your_Account&newlang=vietnamese">ѡng nh?p</a>
<div class="box_login_ajax">
<h4>ѡng nhap</h4>
</div>
JQUERY
===========================================================
$("#dangnhap_a").click(function(){
var maskHeight = $(document).height();
var maskWidth = $(window).width();
$('#mask').css({'width':maskWidth,'height':maskHeight});
$('#mask').fadeIn(500);
$('#mask').fadeTo("slow",0.5);
$(".box_login_ajax").show();
$(".box_login_ajax").css({"zIndex":9001});
$(".box_login_ajax").css('top', maskHeight/15);
$(".box_login_ajax").css('left', maskWidth/2-$(".box_login_ajax").width()/2);
return false;
});
$(".btn.close_box").click(function () {
$('#mask').hide();
$(".box_login_ajax").hide();
$('.window').hide();
});
$('#mask').click(function () {
$(this).hide();
$(".box_login_ajax").hide();
$('.window').hide();
});
===========================================================
<style>
.box_login_ajax {
position: absolute;
}
#mask {
background: black;
position: fixed;
}
</style>
HTML
===========================================================
<div id="mask"></div>
<a id='dangnhap_a' href="http://localhost/retot/modules.php?name=Your_Account&newlang=vietnamese">ѡng nh?p</a>
<div class="box_login_ajax">
<h4>ѡng nhap</h4>
</div>
JQUERY
===========================================================
$("#dangnhap_a").click(function(){
var maskHeight = $(document).height();
var maskWidth = $(window).width();
$('#mask').css({'width':maskWidth,'height':maskHeight});
$('#mask').fadeIn(500);
$('#mask').fadeTo("slow",0.5);
$(".box_login_ajax").show();
$(".box_login_ajax").css({"zIndex":9001});
$(".box_login_ajax").css('top', maskHeight/15);
$(".box_login_ajax").css('left', maskWidth/2-$(".box_login_ajax").width()/2);
return false;
});
$(".btn.close_box").click(function () {
$('#mask').hide();
$(".box_login_ajax").hide();
$('.window').hide();
});
$('#mask').click(function () {
$(this).hide();
$(".box_login_ajax").hide();
$('.window').hide();
});
Thứ Bảy, 22 tháng 6, 2013
Cuộn thanh quảng cáo khi scroll chuột với jQuery
Thi thoảng các bạn vào một số trang web thường thấy có banner quảng cáo ở
2 bên, khi ta cuộn chuột thì banner này trượt theo nội dung của trang.
Bài viết này tôi sẽ hướng dẫn các bạn cách để tạo hiệu ứng cuộn theo như
vậy.
HTML
*****
*****
Mã Jquery
********
HTML
*****
<body> <div class="main"> <div class="adv"> </div><!--banner quảng cáo bên trái--> <div class="content"> </div><!--phần nội dung trang--> <div class="adv"> </div><!--banner quảng cáo bên phải--> </div></body> CSS*****
.main{ width:1200px; margin:auto;}.adv{ float:left; width:150px; height:250px; background-color:#e1e1e1; margin-top:20px;}.content{ float:left; width:860px; margin-left:20px; margin-right:20px; height:3000px; background-color:#e1e1e1;} ********
$(window).scroll(function(){ t = parseInt($(window).scrollTop()) + 20; $('.adv').stop().animate({marginTop:t},400);})Thứ Năm, 20 tháng 6, 2013
Thứ Năm, 13 tháng 6, 2013
Jquery countdown
http://keith-wood.name/countdownRef.html
<div id="clockTimestamp" class="hidden"><?=$_SERVER['REQUEST_TIME'];?></div>
<div id="clock"></div>
function getServerTime() {
var time = $('#clockTimestamp').html()*1000;
time = new Date(time);
return time;
}
function getServerTime() {
var time = null;
$.ajax(
{
url: '../../_ajax/getServerTime.php',
async: false,
dataType: 'text',
success: function(text) {
time = new Date(text);
},
error: function(http, message, exc) {
time = new Date();
}
});
return time;
}
jjjThứ Tư, 12 tháng 6, 2013
25 Websites to Download Free Stock Photo for Your Projects
If you are searching for free stock photo databases, there are quite
a few sites on the web that do that, and even at high quality: there
are sites that are made by artists or designers for other artists and
promote sharing their creations, there are also others which have a
double policy, offering both photos for sale and for free, in distinct
sections, and there are also sites which offer exposure to new talented
photographers who are willing to collaborate.

In any case, there are huge resources of free stock photos on the internet and this article means to help you get to some of the best sources available online at the moment.
So check them out- among all these links you are bound to find what you are looking for!
In any case, there are huge resources of free stock photos on the internet and this article means to help you get to some of the best sources available online at the moment.
So check them out- among all these links you are bound to find what you are looking for!
Thứ Bảy, 1 tháng 6, 2013
Đảo ngược chuỗi ký tự bằng function strrev()
<?phpecho strrev("Hello world!"); // outputs "!dlrow olleH"?>^^
Thứ Sáu, 31 tháng 5, 2013
Regular Expressions cơ bản cho php - hay và hữu ích ^^ thank tác giả
Regular Expressions
1. Regular expression là gì?
+ Biểu thức chính quy.
+ Hiểu nôm na là 1 chuỗi có quy tắc để mô tả những chuỗi(string) khác
2. Cú pháp cơ bản (ở đây mình chỉ trình bày và ví dụ cho ngôn ngữ php)
Example:
Output: Yes
+ Ký hiệu “^” và “$”: bắt đầu và kết thúc 1 string
Example:
Output: Yes
Output: No
+ Ký hiệu: “*”, “+”, “?”
$re = '/^ab*$/' ; // biểu thức chính quy cho một string bắt đầu bởi a, và kết thúc là 0 hoặc nhiều b (ví dụ: a, ab, abb, abbb, …);
$re = '/^ab+$/' ; // biểu thức chính quy cho một string bắt đầu bởi a, và kết thúc là 1 hoặc nhiều b (ví dụ: ab, abb, abbb, …);
$re = '/^ab?$/' : // biểu thức chính quy cho một string bắt đầu bởi a, và kết thúc là b hoặc là không (ví dụ: ab hoặc a).
Example:
Output: No
+ Sử dụng: {}:
$re = '/^ab{2}$/'; // biểu thức chính quy cho một string bắt đầu bởi a, và kết thúc là 2 chũ b (là abb);
$re = '/^ab{2,}$/'; // biểu thức chính quy cho một string bắt đầu bởi a, và kết thúc là ít nhất 2 chũ b (ví dụ: abb, abbb, abbbb, …);
$re = '/^ab{2,5}$/'; // biểu thức chính quy cho một string bắt đầu bởi a, và kết thúc là ít nhất 2 chũ b và nhiều nhất là 5 chữ b (ví dụ: abb, abbb, abbbb, abbbbb);
+ Sử dụng : () và |
$re = '/^a(bc)*$/'; // biểu thức chính quy cho một string bắt đầu bởi a, và kết thúc là 0 hoặc nhiều 'bc' (ví dụ abc, abcbc, abcbcbcbc, …)
$re = '/^a(b|c)*$/'; // biểu thức chính quy cho một string bắt đầu bởi a, và kết thúc là 0 hoặc nhiều 'b' hoặc nhiều 'c' hoặc 'b' 'c' lẫn lộn :D (ví dụ abc, abbcccccccccc, abccccbbbcbc, …)
+ Sử dụng symbol '.': đại diện cho một ký tự đơn bất kỳ
$re = '/^.{3}$/'; //Biểu thức chính quy cho một chuỗi có đúng 3 ký tự bất kỳ.
Output: Yes
+ Sử dụng: '-':
[0-9] : Một chữ số
[a-zA-Z]: một ký tự A->Z, a->z
[a-d] : ~ (a|b|c|d)
[^a-zA-Z]: một ký tự không phải là A->Z, a->z
[^0-9]: một ký tự không phải là số
+ Sử dụng: '\'
\d - Chữ số bất kỳ ~ [0-9]
\D - Ký tự bất kỳ không phải là chữ số (ngược với \d) ~ [^0-9]
\w - Ký tự từ a-z, A-Z, hoặc 0-9 ~ [a-zA-Z0-9]
\W - Ngược lại với \w (nghĩa là các ký tự không thuộc các khoảng: a-z, A-Z, hoặc 0-9) ~[^a-zA-Z0-9]
\s - Khoảng trắng (space)
\S - Ký tự bất kỳ không phải là khoảng trắng.
3. Các hàm cơ bản vận dụng regular expression
+ preg_match : http://php.net/manual/en/function.preg-match.php
Cơ bản là để tìm kiếm 1 string có làm việc theo một $re.
Ví dụ:
Output: No
+ preg_replace: http://www.php.net/manual/en/function.preg-replace.php
Cơ bản là để tìm kiếm trong 1 string những chuỗi có cấu trúc theo $re để thay thế
Ví dụ:
Output: *hi
+ preg_split: http://php.net/manual/en/function.preg-split.php
Ví dụ:
Các bạn xem tạm ví dụ ở trong php manual nhé. Mệt rùi.
Để viết ra bài này, mình đã tham khảo nhiều nguồn trên mạng, và kiến thức từ những lần sử dụng regular expressions.
Có zì sai hay chưa đủ thì các bạn pm để mình bổ xung thêm.
Thanks.
1. Regular expression là gì?
+ Biểu thức chính quy.
+ Hiểu nôm na là 1 chuỗi có quy tắc để mô tả những chuỗi(string) khác
2. Cú pháp cơ bản (ở đây mình chỉ trình bày và ví dụ cho ngôn ngữ php)
Example:
PHP Code:
<?php
$re = '/hello/'; // biểu thức chính quy cho một string có chuỗi “hello” ở trong đó.$str = 'hello world';
if(preg_match($re, $str)) {
echo 'Yes';
}?>
+ Ký hiệu “^” và “$”: bắt đầu và kết thúc 1 string
Example:
PHP Code:
<?php
$re = '/^hello/'; // biểu thức chính quy cho một string bắt đầu bởi chuỗi “hello”$str = 'hello world';
if(preg_match($re, $str)) {
echo 'Yes';
}
else {
echo 'No';
}?>
PHP Code:
<?php
$re = '/hello$/'; // biểu thức chính quy cho một string kết thúc bởi chuỗi “hello”$str = 'hello world';
if(preg_match($re, $str)) {
echo 'Yes';
}
else {
echo 'No';
}?>
+ Ký hiệu: “*”, “+”, “?”
$re = '/^ab*$/' ; // biểu thức chính quy cho một string bắt đầu bởi a, và kết thúc là 0 hoặc nhiều b (ví dụ: a, ab, abb, abbb, …);
$re = '/^ab+$/' ; // biểu thức chính quy cho một string bắt đầu bởi a, và kết thúc là 1 hoặc nhiều b (ví dụ: ab, abb, abbb, …);
$re = '/^ab?$/' : // biểu thức chính quy cho một string bắt đầu bởi a, và kết thúc là b hoặc là không (ví dụ: ab hoặc a).
Example:
PHP Code:
<?php
$re = '/^ab*$/'; $str = 'abbc';
if(preg_match($re, $str)) {
echo 'Yes';
}
else {
echo 'No';
}?>
+ Sử dụng: {}:
$re = '/^ab{2}$/'; // biểu thức chính quy cho một string bắt đầu bởi a, và kết thúc là 2 chũ b (là abb);
$re = '/^ab{2,}$/'; // biểu thức chính quy cho một string bắt đầu bởi a, và kết thúc là ít nhất 2 chũ b (ví dụ: abb, abbb, abbbb, …);
$re = '/^ab{2,5}$/'; // biểu thức chính quy cho một string bắt đầu bởi a, và kết thúc là ít nhất 2 chũ b và nhiều nhất là 5 chữ b (ví dụ: abb, abbb, abbbb, abbbbb);
+ Sử dụng : () và |
$re = '/^a(bc)*$/'; // biểu thức chính quy cho một string bắt đầu bởi a, và kết thúc là 0 hoặc nhiều 'bc' (ví dụ abc, abcbc, abcbcbcbc, …)
$re = '/^a(b|c)*$/'; // biểu thức chính quy cho một string bắt đầu bởi a, và kết thúc là 0 hoặc nhiều 'b' hoặc nhiều 'c' hoặc 'b' 'c' lẫn lộn :D (ví dụ abc, abbcccccccccc, abccccbbbcbc, …)
+ Sử dụng symbol '.': đại diện cho một ký tự đơn bất kỳ
$re = '/^.{3}$/'; //Biểu thức chính quy cho một chuỗi có đúng 3 ký tự bất kỳ.
PHP Code:
<?php
$re = '/^.{3}$/';
//Biểu thức chính quy cho một chuỗi có đúng 3 ký tự bất kỳ.$str = '&#%';
if(preg_match($re, $str)) {
echo 'Yes';
}
else {
echo 'No';
}?>
+ Sử dụng: '-':
[0-9] : Một chữ số
[a-zA-Z]: một ký tự A->Z, a->z
[a-d] : ~ (a|b|c|d)
[^a-zA-Z]: một ký tự không phải là A->Z, a->z
[^0-9]: một ký tự không phải là số
+ Sử dụng: '\'
\d - Chữ số bất kỳ ~ [0-9]
\D - Ký tự bất kỳ không phải là chữ số (ngược với \d) ~ [^0-9]
\w - Ký tự từ a-z, A-Z, hoặc 0-9 ~ [a-zA-Z0-9]
\W - Ngược lại với \w (nghĩa là các ký tự không thuộc các khoảng: a-z, A-Z, hoặc 0-9) ~[^a-zA-Z0-9]
\s - Khoảng trắng (space)
\S - Ký tự bất kỳ không phải là khoảng trắng.
3. Các hàm cơ bản vận dụng regular expression
+ preg_match : http://php.net/manual/en/function.preg-match.php
int preg_match ( string $pattern , string $subject [, array &$matches [, int $flags = 0 [, int $offset = 0 ]]] )
Ví dụ:
PHP Code:
<?php
$re = '/^\w+$/';
// một string toàn ký tự A->Z, a->z, 0->9$str = 'quya*';
if(preg_match($re, $str)) {
echo 'Yes';
}
else {
echo 'No';
}?>
+ preg_replace: http://www.php.net/manual/en/function.preg-replace.php
mixed preg_replace ( mixed $pattern , mixed $replacement , mixed $subject [, int $limit = -1 [, int &$count ]] )
Ví dụ:
PHP Code:
<?php
$re = '/\w+$/';$str = '*quya';
echo preg_replace($re, 'hi', $str);?>
+ preg_split: http://php.net/manual/en/function.preg-split.php
array preg_split ( string $pattern , string $subject [, int $limit = -1 [, int $flags = 0 ]] )
Các bạn xem tạm ví dụ ở trong php manual nhé. Mệt rùi.
Để viết ra bài này, mình đã tham khảo nhiều nguồn trên mạng, và kiến thức từ những lần sử dụng regular expressions.
Có zì sai hay chưa đủ thì các bạn pm để mình bổ xung thêm.
Thanks.
Thứ Hai, 27 tháng 5, 2013
Top 5 Best Free Clipboard Manager For Windows
Clipboard Manager is a software program which adds features or
functionality to default clipboard of an operating system. A clipboard
basically copies the data from the host application, so that it can be
pasted anywhere in the computer after closing that application. Now
clipboard manager basically stores data which is copied to clipboard. It
stores several clips and makes them available from the history whereas
the basic clipboard generally deletes the previous clip when a new clip
is added. So a clipboard manager allows user to keep multiple clips in
the clipboard by enhancing it basic functionality like cut, copy and
paste operation; searching for saved data, tagging the clips, storing
clips for long-term. Clipboard manager can store data objects, formatted
text, URL’s and media content. It increases speed and efficiency of a
clipboard which further increases the productivity. Here is a list of
five best free software in this category.
1. Spartan Lite Multi Clipboard
Spartan Lite Multi Clipboard is a multi functioning enhanced clipboard for windows. It is a freeware program which can do much more than just copy and paste for you. For example, it can send emails, fill forms, run programs, save addresses, save screen shots, dial telephone numbers, to do lists and bookmark websites etc. It has capacity to store 500 permanent clips. It is easier to find clips or data in this clipboard manager as you can arrange things by color or by position which can then be sorted. Recently saved clips are nicely stored in spreadsheet style. It has a self explanatory and simple interface with a help guide which makes it easier to use.2. Clipboard Magic
Clipboard Magic is freeware clipboard enhancement software which stores all the copied text once it starts running in your computer. It sits in the system tray and you just have to run this application once, it will then automatically store the copied text while you are working normally at your computer. This clipboard manager greatly improves your productivity as it is loaded with features like text can be edited and added, text drag and drop, clip management and sorting, color coding, items can be back copied to windows clipboard, stores unlimited data, supports multiple language and much more. All in all, this is a customizable and intuitive program which increases your efficiency.3. Free Clipboard Viewer
Free Clipboard Viewer is a freeware clipboard management program which simply lets you view whatever is there on your clipboard at any point of time and that too in different formats. An online help file for this program is available which helps in making the program easier to use. Free clipboard viewer is a simple program with a simple interface but a very helpful tool for those who frequently use clipboard.4. M8 Free Multi Clipboard
M8 Free Multi Clipboard is a freeware clipboard manager which will do more than just copy and paste for you. It automatically stores almost everything you cut and paste from the host application once you set it to run in your windows. It is loaded with multiple features. For example, it can save any form of data like text, graphics, image etc; icon stays hidden in the taskbar; customizable keyboard shortcuts; clip management is easier with sorting; color coding and many more. This program has capacity to keep 500 clips and helps a lot in increasing your productivity with its inbuilt features.5. Pastebin Desktop
Pastebin Desktop is an online clipboard management utility which allows you to store all the copied text online, so that you can use it from anywhere. This application is a freeware which does copy and paste for you in social networking form. Once installed, it sits on system tray and is very easy to use. You need to register on pastebin for using this software.Thứ Bảy, 25 tháng 5, 2013
Thứ Hai, 20 tháng 5, 2013
Thứ Bảy, 11 tháng 5, 2013
Thứ Hai, 6 tháng 5, 2013
Upload nhiều file cùng 1 lúc
html
<form action="demo_form.asp" enctype="multipart/form-data" >
Select images: <input type="file" name="img" multiple>
<input type="submit">
</form>
Function php
forech($_FILE[]){
uploadimg_many
}
function uploadimg_many($vt,$images, $delpic, $thumb, $thumb_width, $upath) {
global $max_size, $width;
if ($delpic == "yes") {
@unlink("".INCLUDE_PATH."".$upath."/".$images."");
@unlink("".INCLUDE_PATH."".$upath."/small_".$images."");
$images = "";
}
if (is_uploaded_file($_FILES['userfile']['tmp_name'][$vt])) {
@unlink("".INCLUDE_PATH."".$upath."/".$images."");
@unlink("".INCLUDE_PATH."".$upath."/small_".$images."");
$images = "";
$realname = $_FILES['userfile']['name'][$vt];
$file_size = $_FILES['userfile']['size'][$vt];
$file_type = $_FILES['userfile']['type'][$vt];
$f_name = end(explode(".", $realname));
$f_extension = strtolower($f_name);
$loaiimg_ext = array("gif","jpg","jpeg","pjpeg","bmp","png");
$loaiimg_mime = array("image/gif", "image/pjpeg", "image/jpeg", "image/bmp", "image/png");
if ($file_size > $max_size) {
info_exit("<br><br><center>"._EROR1." ".$file_size." "._EROR2." $max_size byte.<br><br>"._GOBACK."</center><br><br>");
}
if(!in_array($file_type,$loaiimg_mime) || !in_array($f_extension,$loaiimg_ext)) {
info_exit("<br><br><center>"._EROR6."<br><br>"._GOBACK."</center><br><br>");
}
$datakod = date(U).rand();
$picname = "".$datakod.".nv.".$f_extension."";
if(! @copy($_FILES['userfile']['tmp_name'][$vt], "".INCLUDE_PATH."".$upath."/".$picname."") ) {
if (! move_uploaded_file($_FILES['userfile']['tmp_name'][$vt], "".INCLUDE_PATH."".$upath."/".$picname."")) {
info_exit("<br><br>"._UPLOADFAILED."<br>");
}
}
if (file_exists("".INCLUDE_PATH."".$upath."/".$picname."")) {
$images = $picname;
if ($f_extension == "jpg" AND extension_loaded("gd")) {
$size = @getimagesize("".INCLUDE_PATH."".$upath."/".$images."");
$thc = 0;
if ($size[0] > $width) {
$thc = 1; $sizemoi = $width;
} elseif($size[0] > $thumb_width AND $size[0] < ($thumb_width+20)) {
$thc = 1; $sizemoi = $thumb_width;
}
if ($thc == 1) {
$src_img= ImageCreateFromJpeg("".INCLUDE_PATH."".$upath."/".$images."");
$src_width= ImagesX($src_img);
$src_height= ImagesY($src_img);
$dest_width = $sizemoi;
$dest_height = $src_height/($src_width/$dest_width);
$dest_img=ImageCreateTrueColor($dest_width, $dest_height);
ImageCopyResampled($dest_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height);
ImageJpeg($dest_img, "".INCLUDE_PATH."".$upath."/".$images."", 90);
ImageDestroy($dest_img);
}
$size = @getimagesize("".INCLUDE_PATH."".$upath."/".$images."");
if($thumb==1 AND $size[0] > $thumb_width) {
$picname_thumb = "small_".$picname."";
if(! @copy($_FILES['userfile']['tmp_name'][$vt], "".INCLUDE_PATH."".$upath."/".$picname_thumb."") ) {
@move_uploaded_file($_FILES['userfile']['tmp_name'][$vt], "".INCLUDE_PATH."".$upath."/".$picname_thumb."");
}
if (file_exists("".INCLUDE_PATH."".$upath."/".$picname_thumb."")) {
$src_img= ImageCreateFromJpeg("".INCLUDE_PATH."".$upath."/".$picname_thumb."");
$src_width= ImagesX($src_img);
$src_height= ImagesY($src_img);
$dest_width = $thumb_width;
$dest_height = $src_height/($src_width/$dest_width);
$dest_img=ImageCreateTrueColor($dest_width, $dest_height);
ImageCopyResampled($dest_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height);
ImageJpeg($dest_img, "".INCLUDE_PATH."".$upath."/".$picname_thumb."", 90);
ImageDestroy($dest_img);
}
}
}
}
}
return($images);
}
Thứ Bảy, 4 tháng 5, 2013
Thứ Sáu, 26 tháng 4, 2013
Thứ Năm, 25 tháng 4, 2013
Thứ Tư, 24 tháng 4, 2013
Script popup sử dụng cookie
<script type="text/javascript">
$(document).ready(function() {
// cookie cho popup
if($.cookie("popup")!=1 && $("#dialog .content_popup").html()!=""){
var id = '#dialog';
//Lấy chiều cao và rộng của màn hình nè
var maskHeight = $(document).height();
var maskWidth = $(window).width();
//Rùi định dạng chiều cao và rộng cho cái vùng div chứa cái popup
$('#mask').css({'width':
//hiệu ứng xuất hiện
$('#mask').fadeIn(1000);
$('#mask').fadeTo("slow",0.8);
//làm cho cái popup canh phia tren màn hình
$(id).css('top', maskHeight/10);
$(id).css('left', maskWidth/2-$(id).width()/2);
//hiệu ứng cho cái popup xuất hiện (xuất hiện từ từ trong vòng 2s)
$(id).fadeIn(2000);
//Nếu người ta click vào nút close nè
$('.window .close').click(function (e) {
//Cancel the link behavior
e.preventDefault()
$('#mask').hide();
$('.window').hide();
});
//Nếu vùng div id mask được click thì ẩn nó đi nè
$('#mask').click(function () {
$(this).hide();
$('.window').hide();
});
}//cookie
$.cookie("popup",1);
});
</script>
Đăng ký:
Bài đăng (Atom)

























