$template = 'hdc_';
define("admin",$template."admin",true);
define("province",$template."province",true);
define("members",$template."members",true);
define("bodem",$template."bodem",true);
define("member2",$template."member2",true);
define("shoppingCart",$template."shoppingcart",true);
define("shoppingCart_tv",$template."shoppingcart_tv",true);
define("intro",$template."intro",true);
define("guide",$template."guide",true);
define("menu_product",$template."menu_product",true);
define("product",$template."product",true);
define("ads",$template."ads",true);
define("support",$template."support",true);
define("contact",$template."contact",true);
define("download",$template."download",true);
define("opinion",$template."opinion",true);
define("price_tv",$template."price_tv",true);
define("product2",$template."product2",true);
define("menu_product2",$template."menu_product2",true);
define("menu_anh",$template."menu_anh",true);
define("anh",$template."anh",true);
define("comments",$template."comments",true);
define("bottom",$template."bottom",true);
define("contact2",$template."contact2",true);
define("website",$template."website",true);
define("tintucmenu",$template."tintucmenu",true);
define("tintucview",$template."tintucview",true);
define("antispam",$template."antispam",true);
define("thanhvien",$template."thanhvien",true);
define("games_menu",$template."games_menu",true);
define("games_download",$template."games_download",true);
define("silder",$template."silder",true);
define("track",$template."track",true);
define("khung",$template."khung",true);
define("nhanmail",$template."nhanmail",true);
define("hoatdong2",$template."hoatdong2",true);
?>
function format_date()
{
$str_1=array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
$str_2=array("Chủ nhật","Thứ hai","Thư ba","Thứ tư","Thứ năm","Thứ sáu","Thứ bẩy");
$str=str_replace($str_1,$str_2,date("l",time()));
return $str;
}
function createImage(){
// Delete Old File
if (is_file($_SESSION['stringcode']."gif")) @unlink($_SESSION['old_file_code']."gif");
// Creates the images, writes the file
$fileRand = $_REQUEST["PHPSESSID"];
$string_a = array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","p","q","r","s","t","u","v","w","x","y","x","0","1","2","3","4","5","6","7","8","9");
$keys = array_rand($string_a,6);
foreach($keys as $n=>$v)
{
$string .= $string_a[$v];
}
session_register("stringcode");
$_SESSION['stringcode'] = $string;
//$backgroundimage = "security/bg_im.gif";
//$im=imagecreatefromgif($backgroundimage);
//$colour = imagecolorallocate($im, rand(0,0), rand(0,0), rand(0,0));
//$font = 'security/arial.ttf';
//$angle = rand(0,0);
// Add the text
//imagefttext(
//imagettftext($im, 11, $angle,14, 17, $colour, $font, $string);
//$outfile= "security/$fileRand.gif";
//imagegif($im,$outfile);
return $string;
}
function NumRow($field,$table,$clause) {
return mysql_num_rows(mysql_query("SELECT $field FROM $table WHERE $clause")) ;
}
function order($m,$j,$k) {
for($i=$m;$i<$j;$i++) {
echo "";
}
}
/*Category news*/
function CategoryNews($id,$table) {
$sqlstr=mysql_query("SELECT * FROM ".$table." WHERE status=true ORDER BY stt ASC");
if(mysql_num_rows($sqlstr)>0) {
while($row=mysql_fetch_array($sqlstr)) {
echo "";
$sqlsub=mysql_query("SELECT * FROM ".$table." WHERE parent='".$row['id']."'");
if(mysql_num_rows($sqlsub)>0) {
while($rowsub=mysql_fetch_array($sqlsub)) {
echo "";
}
}
}
}
}
/*Parent Category*/
function money($email,$table) {
$sqlstr=mysql_query("SELECT * FROM ".$table." WHERE status=true ORDER BY id ASC");
if(mysql_num_rows($sqlstr)>0) {
while($row=mysql_fetch_array($sqlstr)) {
echo "";
}
}
}
/*Parent Category*/
function CategoryParent($id,$table) {
$sqlstr=mysql_query("SELECT * FROM ".$table." WHERE status=true AND parent='0' ORDER BY stt ASC");
if(mysql_num_rows($sqlstr)>0) {
while($row=mysql_fetch_array($sqlstr)) {
echo "";
}
}
}
/*Parent Category*/
function CategoryParent2($id,$table) {
$sqlstr=mysql_query("SELECT * FROM ".$table." WHERE status=true AND parent='0' ORDER BY stt ASC");
if(mysql_num_rows($sqlstr)>0) {
while($row=mysql_fetch_array($sqlstr)) {
echo "";
$toilatoi=$row['id'] ;
$sqlstr2=mysql_query("SELECT * FROM ".$table." WHERE status=true AND parent='$toilatoi' ORDER BY stt ASC");
if(mysql_num_rows($sqlstr2)>0) {
while($row2=mysql_fetch_array($sqlstr2)) {
echo "";
}
}
}
}
}
/*Category*/
function Category($id,$k,$table)
{
if($k !='') {
$sqlstr=mysql_query("SELECT * FROM ".$table." WHERE status = true AND parent = '".intval($k)."' ORDER BY stt ASC");
if(mysql_num_rows($sqlstr)>0) {
while($row=mysql_fetch_array($sqlstr)) {
echo "";
}
}
}
}
/*Upload picture*/
function uploads($file='picture',$folder = '../images/')
{
global $picture;
$picture = time()."_".$_FILES[$file]['name'];
if($_FILES[$file]["size"] < 2000000) {
if(@copy($_FILES[$file]['tmp_name'],$folder.$picture)) {
$check=@getimagesize($folder.$picture);
if($check[0]!='') {
return $picture;
}
else {
@unlink($folder.$picture);
echo "";
}
}
else {
return $picture='';
}
}
else {
echo "";
}
}
/*Upload picture*/
function uploadsb($file='picture',$folder = '../images/')
{
global $picture;
$picture = time()."_".$_FILES[$file]['name'];
if(@copy($_FILES[$file]['tmp_name'],$folder.$picture)) {
$check=@getimagesize($folder.$picture);
return $picture;
}
else {
return $picture='';
}
}
function text(&$string) {
$string = trim($string);
$string = str_replace("\\'","'",$string);
$string = str_replace("'","''",$string);
$string = str_replace('\"',""",$string);
$string = str_replace("<", "<", $string);
$string = str_replace(">", ">", $string);
return $string;
}
function textContent($string) {
return $string;
}
function vn2latin($cs, $tolower = false)
{
/*Mảng chứa tất cả ký tự có dấu trong Tiếng Việt*/
$marTViet=array("à","á","ạ","ả","ã","â","ầ","ấ","ậ","ẩ","ẫ","ă",
"ằ","ắ","ặ","ẳ","ẵ","è","é","ẹ","ẻ","ẽ","ê","ề",
"ế","ệ","ể","ễ",
"ì","í","ị","ỉ","ĩ",
"ò","ó","ọ","ỏ","õ","ô","ồ","ố","ộ","ổ","ỗ","ơ",
"ờ","ớ","ợ","ở","ỡ",
"ù","ú","ụ","ủ","ũ","ư","ừ","ứ","ự","ử","ữ",
"ỳ","ý","ỵ","ỷ","ỹ",
"đ",
"À","Á","Ạ","Ả","Ã","Â","Ầ","Ấ","Ậ","Ẩ","Ẫ","Ă",
"Ằ","Ắ","Ặ","Ẳ","Ẵ",
"È","É","Ẹ","Ẻ","Ẽ","Ê","Ề","Ế","Ệ","Ể","Ễ",
"Ì","Í","Ị","Ỉ","Ĩ",
"Ò","Ó","Ọ","Ỏ","Õ","Ô","Ồ","Ố","Ộ","Ổ","Ỗ","Ơ","Ờ","Ớ","Ợ","Ở","Ỡ",
"Ù","Ú","Ụ","Ủ","Ũ","Ư","Ừ","Ứ","Ự","Ử","Ữ",
"Ỳ","Ý","Ỵ","Ỷ","Ỹ",
"Đ"," ","/",";",":","&",","," - ","?","!");
/*Mảng chứa tất cả ký tự không dấu tương ứng với mảng $marTViet bên trên*/
$marKoDau=array("a","a","a","a","a","a","a","a","a","a","a",
"a","a","a","a","a","a",
"e","e","e","e","e","e","e","e","e","e","e",
"i","i","i","i","i",
"o","o","o","o","o","o","o","o","o","o","o","o",
"o","o","o","o","o",
"u","u","u","u","u","u","u","u","u","u","u",
"y","y","y","y","y",
"d",
"A","A","A","A","A","A","A","A","A","A","A","A",
"A","A","A","A","A",
"E","E","E","E","E","E","E","E","E","E","E",
"I","I","I","I","I",
"O","O","O","O","O","O","O","O","O","O","O","O","O","O","O","O","O",
"U","U","U","U","U","U","U","U","U","U","U",
"Y","Y","Y","Y","Y",
"D","-","-","-","-","-","-","-","","");
if ($tolower) {
return strtolower(str_replace($marTViet,$marKoDau,$cs));
}
return str_replace($marTViet,$marKoDau,$cs);
}
?>
function num_page() {
global $n_record;//lay bien toan cuc
global $p;
if($n_record%$p==0) {
$n_page=$n_record/$p;
return $n_page;
}
else {
$n_page=($n_record-($n_record%$p))/$p+1;
return $n_page;
}
}
function view_page($link) {
global $n_record,$i,$links;
$next=$_GET['page']+1;
$back=$_GET['page']-1;
$page=$_GET['page'];
if($back<=1) $back=1;
if($next>num_page()) $next=num_page();
if($_GET['page']>num_page()) $page=num_page();
echo '
';
echo 'Trang: | ';
for($i=1;$i<=num_page();$i++)
{
echo '';
echo " ".$i." ";
echo ' | ';
if($i%15 == 0) echo "
";
}
echo '
';
}
function view_page_view($link) {
global $n_record,$i,$links;
$next=$_GET['view']+1;
$back=$_GET['view']-1;
$page=$_GET['view'];
if($back<=1) $back=1;
if($next>num_page()) $next=num_page();
if($_GET['view']>num_page()) $page=num_page();
echo '';
echo '';
echo " Trang ("; echo $_GET['view']== ''?1:$_GET['view'];
echo '/'.num_page().') ';
echo " | ";
echo '';
echo " "."Trang đầu tiên"." | ";
if($_GET['view']>5) {
echo '... | ';
}
for($i=1;$i<=num_page();$i++)
{
if($i < $_GET['view']+5 && $i > $_GET['view']-5) {
echo '';
echo " ".$i." ";
echo ' | ';
}
}
if(num_page()>=5) echo '... | ';
$k=$i-1;
echo '';
echo " "."Trang cuối"." | ";
echo '
';
}
function view_page_view2($link) {
global $n_record,$i,$links;
$next=$_GET['view']+1;
$back=$_GET['view']-1;
$page=$_GET['view'];
if($back<=1) $back=1;
if($next>num_page()) $next=num_page();
if($_GET['view']>num_page()) $page=num_page();
echo '';
echo '';
echo " Trang "; echo $_GET['view']== ''?1:$_GET['view'];
echo '/'.num_page().' ';
echo " | ";
echo '';
echo " "."Trang đầu tiên"." | ";
if($_GET['view']>5) {
echo '... | ';
}
for($i=1;$i<=num_page();$i++)
{
if($i < $_GET['view']+5 && $i > $_GET['view']-5) {
echo '';
echo " ".$i." ";
echo ' | ';
}
}
if(num_page()>=5) echo '... | ';
$k=$i-1;
echo '';
echo " "."Trang cuối"." | ";
echo '
';
}
?>
$dbhost = "localhost";
$dbusername = "hoc123";
$dbpassword = "ChaMe1180!";
$db = "hoc123";
$tenmien="http://hoc123.net/";
$link = mysql_connect("$dbhost", "$dbusername", "$dbpassword") or die("Could not connect");
mysql_select_db("$db") or die("Could not select database");
mysql_query("SET NAMES 'UTF8'");
?>
$email = $_SESSION['email2'];
$sql=mysql_query("Select * from ".hdc_dangky." where email='$email' and status='true' and online='0'");
if(mysql_num_rows($sql)>0) {
echo "";
session_start();
session_destroy();
?>
}else{
?>
include "home.php";?>
}?>