register_function("imc", "imc"); function createthumb($name,$filename,$new_w,$new_h){ $system=explode('.',$name); if (preg_match('/jpg|jpeg/',$system[1])){ $src_img=imagecreatefromjpeg($name); } if (preg_match('/png/',$system[1])){ $src_img=imagecreatefrompng($name); } $old_x=imageSX($src_img); $old_y=imageSY($src_img); if ($old_x > $old_y) { $thumb_w=$new_w; $thumb_h=$old_y*($new_h/$old_x); } if ($old_x < $old_y) { $thumb_w=$old_x*($new_w/$old_y); $thumb_h=$new_h; } if ($old_x == $old_y) { $thumb_w=$new_w; $thumb_h=$new_h; } $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h); imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y); if (preg_match("/png/",$system[1])) { imagepng($dst_img,$filename); } else { imagejpeg($dst_img,$filename); } imagedestroy($dst_img); imagedestroy($src_img); } //image check existed. function imc($params){ $filename=$params['filename']; if (file_exists($_SERVER['DOCUMENT_ROOT'].'/upload/avatar/s/'.$filename.'.jpg') or file_exists($_SERVER['DOCUMENT_ROOT'].'/upload/avatar/'.$filename.'.jpg')) return $filename.'.jpg'; else return '0.jpg'; } function update_user_online(){ global $db; $sql='truncate table `core_useronline`'; $db->query($sql); $sql="SELECT session_data FROM core_session WHERE session_data <> '' AND expired_date > " . time(); $b = $db->getAll($sql); foreach($b as $c){ $s=explode(';',$c['session_data']); foreach ($s as $t){ $tt=explode('|',$t); if($tt[0]=='user_logined'){ $arr['role']=substr($tt[1],5,1); if(!$arr['role']) $arr['role']=1; } elseif($tt[0]=='user_username'){ $p1 = strpos($tt[1],'"')+1; $p2 = strpos($tt[1],'"',$p1+1) - $p1; $arr['username']=substr($tt[1],$p1,$p2); } } if(isset($arr['username'])) $db->insert('core_useronline',$arr); } } function safeSQL($input,$type= NULL){ if(in_array($type,array('int','i','number'))) return intval($input); elseif (in_array($type,array('float','f'))) return floatval($input); else return mysql_real_escape_string($input); } //request data. function r($index,$type=NULL){ if (!isset($_REQUEST[$index])) return NULL; else { if(in_array($type,array('int','i','number'))) return (int)($_REQUEST[$index]); elseif (in_array($type,array('float','f'))) return floatval($_REQUEST[$index]); }return ($_REQUEST[$index]); } //check valid email function isValidEmail($email) { return eregi('^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z]{2,3})$', $email); } //html_mail : send html mail to user function html_mail($from,$to,$subject,$content){ $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; // Additional headers $headers .= 'From: ' .$from. "\r\n"; //$headers .= 'To: ' .$to. "\r\n"; remote_mail($to,$subject,$content,$headers); //mail($to,$subject,$content,$headers);//su dung server moi //my_smtp_mail('admin@loidich.com','AdminLD',$to,'',$subject,$content);//su dung server moi } function core_check_logined($code=1){ if (!isset($_SESSION['user_logined']) or $_SESSION['user_logined'] < 1) { //kiem tra dang nhap $logined=0; //tu dong dang nhap load du lieu tu cookie len va if(isset($_COOKIE['cookname']) && isset($_COOKIE['cookpass'])){ $logined=auto_login($_COOKIE['cookname'],$_COOKIE['cookpass']); } if($logined) return; //--ket thuc tu dong dang nhap page_transfer('?do=login&e=2&page='.str_replace('=','::',str_replace('&','--',substr($_SERVER['REQUEST_URI'],strpos($_SERVER['REQUEST_URI'],'do'))))); } elseif (isset($_SESSION['user_logined']) and $_SESSION['user_logined'] < $code and $code==1) { //kiem tra dang nhap page_transfer('?do=login&e=2&page='.str_replace('=','::',str_replace('&','--',substr($_SERVER['REQUEST_URI'],strpos($_SERVER['REQUEST_URI'],'do'))))); } elseif ($_SESSION['user_logined'] < $code and $code==6) { //kiem tra admin permission die('chi co admin moi truy xuat khu vuc nay'); } elseif ($_SESSION['user_logined'] < $code and $code==3) { //kiem tra admin permission die('chi co mod hoac admin moi truy xuat khu vuc nay'); } elseif ($_SESSION['user_logined'] < $code and $code==2) { //kiem tra admin permission die('chi co ctv tro len moi truy xuat khu vuc nay'); } else return; } //ghi dau cac hoat dong cua user function logs($action=0,$obj=0,$obj_id=0,$note=''){ global $db; return; //tam thoi khong ghi logs de bao ve server if(!isset($_SESSION['user_userid'])) return;//khong ghi dau neu ko la user elseif(!$action or !$obj or !$obj_id) return; //khong biet gi cai gi else { //lay userid $arr['uid']=$_SESSION['user_userid']; $arr['obj']=$obj; $arr['obj_id']=$obj_id; $arr['action']=$action; $arr['action_date']=time(); $arr['note']=addslashes($note); //cac action dung ma tuong ung: 1:xem 2:them 3:sua 4:xoa //cac obj dung ma tuong ung: 1:playlist 2:casi 3:theloai 4:user 5:loidich 6:qua tang 7:cam nhan 8:cam nhan playlist 9:nhan tin $db->insert('logs',$arr); } } function format_date($t){ $diff=time()-$t; //tinh theo phut if($diff < 3600) return round($diff/60).' phút'; elseif($diff < 86400) { $gio = floor($diff/3600); #$phut = floor(($diff-3600*$gio)/60); return $gio.' giờ'; } elseif($diff < 86400*2){ return ' hôm qua'; } else return date('d-m-Y',$t); } function my_smtp_mail($from_email,$from_name,$to_email,$to_name,$subject,$content){ //smtp include 'gtbb/smtp3.php'; } function remote_mail($to,$subject,$content,$headers){ $ch = curl_init(); $timeout = 0; /* for test // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; // Additional headers $headers .= 'From: Loi Dich ' . "\r\n"; $subject ='testing from remote'; $content= 'cong hoa xa hoi
Chu nghia viet nam'; $to='ludnguyen@yahoo.com'; */ $data = array('sec'=>'f6d1dff357f6aacb45415d7921f8ad8f','to'=>$to,'headers' => $headers, 'subject' =>$subject ,'content'=>$content); $rand=1;//rand(1,5); if($rand==1) curl_setopt ($ch, CURLOPT_URL, 'http://top500webs.com/rm.php'); elseif($rand==7) curl_setopt ($ch, CURLOPT_URL, 'http://up.vnmix.net/rm.php'); elseif($rand==3) curl_setopt ($ch, CURLOPT_URL, 'http://74.53.197.2/~ebible/rm.php'); elseif($rand==4) curl_setopt ($ch, CURLOPT_URL, 'http://anphuoc.net/loidich.com/rm.php'); else curl_setopt ($ch, CURLOPT_URL, 'http://giamoi.net/rm.php'); #curl_setopt ($ch, CURLOPT_URL, 'http://localhost/loidich/remote_email.php'); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $s = curl_exec($ch); curl_close($ch); } function file_get_content($url){ //due to file_get_contents disable $ch = curl_init(); $timeout = 0; curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $s = curl_exec($ch); curl_close($ch); return $s; } //lay userid tu URL. function get_userid(){ global $db; if(isset($_GET['uid']) && (int)$_GET['uid']) return (int)$_GET['uid']; elseif(isset($_GET['u']) and $_GET['u']){ $sql='select id from user where username = "'.$_GET['u'].'"'; $b=$db->getRow($sql); if($b['id']>0) return $b['id']; else return 0; } elseif(isset($_SESSION['user_userid'])) return $_SESSION['user_userid']; else return 0; } function auto_login($u='',$p=''){ global $db; $username = $u; $password = $p; $username=safeSQL($username); //if($username=='nguyen' && $_COOKIE['cookname']=='nguyen') {print_r($_COOKIE); print_r($_POST);} //------------------------------------------------- $sqlstmt = "select * from user where username='$username'"; $result = $db->query($sqlstmt,''); if ($db->numRows($result) == 0) { setcookie("cookname", "", time()-60*60*24*100, "/"); setcookie("cookpass", "", time()-60*60*24*100, "/"); return 0;//khong co user } $row = $db->GetRow($sqlstmt); if ($password != $row["password"]) { setcookie("cookname", "", time()-60*60*24*100, "/"); setcookie("cookpass", "", time()-60*60*24*100, "/"); return 0;//sai pass } if ($row["active"]==0) { //thong bao bi cam doi voi banned user. die('

Bạn bị cấm vào Lời Dịch vì: '.$row["banned_info"].'

'); } if ($row["active"]==2) { //thong bao bi khong truy cap vi chua kich hoat. $_SESSION["user_userid"] = $row['id']; $_SESSION["user_expired_date"] = time(); //$_SESSION['user_logined']=1; $_SESSION["user_username"] = $row['username']; echo ''; //echo '';die; echo '

Thông báo kích hoạt tài khoản Lời Dịch

'; /*echo '

Chào bạn, bạn đã đăng ký thông tin hoàn tất tuy nhiên Lời Dịch hiện tại thu phí thành viên 10.000đ/tháng.

Bạn cần đóng phí trước khi sử dụng, có nhiều phương thức thanh toán bạn có thể chọn lựa

'; echo '

Vui lòng Click vào đây để xem chi tiết
'; */ echo '

Chào bạn, mã số của bạn là: '.$row["id"].'
Tài khoản của bạn mới đăng ký cần kích hoạt bằng 1 trong 2 cách sau:

'; echo '

*Cách 1: Kích hoạt nhanh bằng SMS - Soạn LD '.$row["id"].' gửi đến 8761 (chỉ hỗ trợ Mobi,Vina,Viettel)

Sau khi nhắn tin vui lòng đợi 3-5 phút, bạn sẽ nhận được 1 tin trả lời thông báo. Sau đó bạn nhấn vào đây để đăng nhập lại: Login'; echo '

*Cách 2: Kích hoạt bằng thẻ cào Click vào đây
'; echo '

*Cách 3: Gửi 1 email, được miễn phí sử dụng 1 tháng Click vào đây
'; die(); } if ($row["active"]==4) { //thong bao buoc 2 $_SESSION["user_userid"] = $row['id']; $page = "index.php?do=login&act=reg_done_active"; page_transfer($page); die('

Bạn chưa hoàn tất đăng ký bước 2

'); } unset($_SESSION["user_logined"]); if ($_SESSION["user_logined"] =='')//gan bien ve zero { $_SESSION["user_reg_date"] = $row['reg_date']; if($row['active']==2) $_SESSION["user_reg_date"]=time(); $_SESSION["user_expired_date"] = $row['expired_date']; $_SESSION["user_userid"] = $row['id']; $_SESSION["user_logined"] = $row['role']; $_SESSION["user_email"] = $row['email']; $_SESSION["user_username"] = $row['username']; setcookie("cookname", $username, time()+60*60*24*100, "/"); setcookie("cookpass", $password, time()+60*60*24*100, "/"); //thong bao sap het han. if($row['expired_date'] < (time() + 86400) and $row['role']<3) { header('location: tvv.php'); die; } if($row['expired_date'] < time() and $row['role']<3) { $_SESSION["user_logined"]=1; } //update last_login $db->query('update user set last_login_date=curr_login_date,curr_login_date='.time().' where id='.$row['id']); return 1; } } ?>register_function("tvv", "tvv"); function update_statictis($username){ global $db; //dem cac bai viet ma user da post: $sql="select count(*) num from loidich where post_by='$username'"; $b=$db->getRow($sql); $total_post=$b['num']; //dem cac bai viet ma user da post trong ban dich: $sql="select count(*) num from bandich where postby='$username'"; $b=$db->getRow($sql); $total_post+=$b['num']; //dem cac bai viet ma user da dich $sql="select count(*) num from loidich where translator='$username'"; $b=$db->getRow($sql); $total_trans=$b['num']; //dem cac bai viet ma user da dich trong ban dich $sql="select count(*) num from bandich where translator='$username'"; $b=$db->getRow($sql); $total_trans+=$b['num']; //dem cac bai viet ma user da edit $sql="select count(*) num from loidich where last_user_update='$username'"; $b=$db->getRow($sql); $total_edit=$b['num']; $mark=$total_trans*5 + $total_edit + $total_post; $sql="update user set totaledit=$total_edit,totalpost=$total_post,totaltranslate=$total_trans,mark=$mark where username='$username'"; $db->query($sql); } function getEmailById($u='',$id=0){ global $db; if($id==0){ //lay email theo username $b=$db->getRow("select email from user where username ='$u' limit 1"); return $b['email']; } else{ //lay email theo id $b=$db->getRow("select email from user where id ='$id' limit 1"); return $b['email']; } } function getUsernameById($id=0){ global $db; if($id==0){ return NULL; } else{ //lay email theo id $b=$db->getRow("select username from user where id ='$id' limit 1"); return $b['username']; } } function getEmailTemplate($code=''){ global $db; if($code){ //lay email template $b=$db->getRow("select email_subject,email_content from email_templates where code ='$code' limit 1"); return $b; } else return NULL; } function mergeEmail($str,$arr){ foreach($arr as $k=>$v){ $str=str_replace('['.$k.']',$v,$str); } return $str; } function get_theme($uid){ global $db; $b=$db->getRow('select * from user_theme where uid='.$uid); return $b; } function tvv($u){ global $db; if (strlen($u) > 10) $uu=substr($u,0,10).'.'; else $uu=$u; $t=$db->getRow('select id,expired_date,role from user where username="'.$u.'"'); if(!isset($t['expired_date'])) return $uu; elseif ($t['role'] ==6) return ''.$uu.''; elseif ($t['role'] ==4) return ''.$uu.''; elseif ($t['role'] ==3) return ''.$uu.''; elseif ($t['role'] ==2) return ''.$uu.''; elseif ($t['expired_date'] > time() + 86400*90) return ''.$uu.''; else return ''.$uu.''; } function tvvf($u){ global $db; //if (strlen($u) > 8) $uu=substr($u,0,8).'.'; //else $uu=$u; $uu=$u; $t=$db->getRow('select id,expired_date,role from user where username="'.$u.'"'); if(!isset($t['expired_date'])) return $uu; elseif ($t['role'] ==6) return ''.$uu.''; elseif ($t['role'] ==5) return '
'.$uu.'
The Best Translator Giải thưởng người dịch xuất sắc nhất
'; elseif ($t['role'] ==4) return ''.$uu.''; elseif ($t['role'] ==3) return ''.$uu.''; elseif ($t['role'] ==2) return ''.$uu.''; elseif ($t['expired_date'] > time() + 86400*90) return ''.$uu.''; else return ''.$uu.''; } function congngay($user_id=0){ global $db; if (!$user_id) return; $songay=30*86400; //tim user $sql="select * from user where id=$user_id"; $b=$db->getRow($sql); if($b['ref']>0) { $sql="select * from user where id=$b[ref]"; $c=$db->getRow($sql); //cong ngay cho thanh vien moi dang ky. $sql="update user set expired_date = expired_date + $songay where id=$user_id"; $db->query($sql); //cong ngay cho thanh vien gioi thieu if($c['expired_date']> time()) $new=$c['expired_date'] + $songay; else $new=time() + $songay; $sql="update user set expired_date = $new where id=$c[id]"; $db->query($sql); } return; } function tangngay($user_id=0,$songay=0){ global $db; if((int)$user_id ==0) $username = $user_id; if (!$user_id) return; if (!$songay) return; $songay=$songay*86400; //tim user if(!$username) $sql="select * from user where id=$user_id"; else $sql="select * from user where username='$username'"; $b=$db->getRow($sql); if($b['id']>0) { if($b['expired_date']> time()) $new=$b['expired_date'] + $songay; else $new=time() + $songay; $sql="update user set expired_date = $new where id=$b[id]"; $db->query($sql); } return; } function gioithieubanbe($id){ global $db; //cong ngay cho chuong trinh gioi thieu ban be tren facebook... 3 nguoi click duoc 1 ngay su dung. if($id){ //xu ly neu co gioi thieu $ip = $_SERVER['REMOTE_ADDR']; $ref = (isset($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : ''; if(strpos($ref,'google') > 0) { //tu google, khong tinh return; } #insert into Click table. //kiem tra xem nguoi nay da tung click chua. $sql = 'select count(*) num from gioithieu where ip_click="' . $ip . '" and user_id=' . $id; $b = $db->getRow($sql); if ($b['num'] == 0) { //chua tung click, them vao $db->insert('gioithieu', array('user_id' => $id, 'added_date' => time(), 'ip_click' => $ip, 'ref' => $ref)); #kiem tra gioi thieu, neu day du se active tai khoan va cong diem. $c = $db->getRow("select count(ip_click) num from gioithieu where user_id=$id and cong=0"); if ($c['num'] >= 3) { //cu 3 nguoi click thi cong 1 ngay //update cong=1 all clicked before $db->query('update gioithieu set cong=1 where user_id='.$id); //update user $sql = 'select * from user where id=' . $id; $b = $db->getRow($sql); if (isset($b['id'])) { //so sanh ngay. if ($b['expired_date'] > time()) { $arr['expired_date'] = 86400 + $b['expired_date'];//1 ngay } else { $arr['expired_date'] = 86400 + time();//tinh tu bay gio neu da het han } if ($b['role'] < 1) { //update cong them ngay $db->update('user', $arr, 'id=' . $id); } elseif ($b['role'] == 1) { //update cong them ngay $arr['role'] = 1; $arr['active'] = 1; $db->update('user', $arr, 'id=' . $id); //bao vao profile $db->insert('tinnhan', array('private'=>1,'username' => 'nguyen', 'uid' => $id, 'post_date' => time(), 'content' => 'Bạn đã giới thiệu được thêm 3 người bạn, bạn được cộng thêm 1 ngày, hạn sử dụng:' . date('d-m-Y', $arr['expired_date']).'
tin nhắn này do hệ thống tự động gửi')); } else { //khong can lam gi. chac la BTV hoac Admins cong ngay thoi $db->update('user', $arr, 'id=' . $id); } } } } else { //chi update so luot click len $sql = 'update gioithieu set num_click=num_click+1 where ip_click="' . $ip . '" and user_id=' . $id; $db->query($sql); } } } function check_ctv($user_id=0,$role){ global $db; if (!$user_id) return false; $sql="select * from ctv where user_id=$user_id and role like '%$role%'"; $b=$db->getRow($sql); if($b['id']>0) { return true; } return false; } //gui tin nhan tu dong cho user //danh cho cac phan nhu duyet bai function sms($to,$msg){ global $db; $arr['username']=$_SESSION["user_username"]; $arr['uid']=$to; $arr['content']=$msg; $arr['post_date']=time(); $db->insert('tinnhan',$arr); } function check_new_mem(){ if((time() - 864000) < $_SESSION["user_reg_date"]) die('

Thời gian bạn tham gia Lời Dịch chưa đủ 10 ngày nên chưa đăng được bài hát

Để có thể đăng bài hát bạn có 2 chọn lựa sau:

Cách 1: Bạn đợi đủ 10 ngày rồi mới đăng bài

Cách 2: Soạn tin nhắn LD '.$_SESSION["user_userid"].' gửi đến 8717 Bạn sẽ vừa đăng được bài hát, vừa cộng thêm 1 tháng sử dụng

'); } function bodau($str){ $marTViet=array("à","á","ạ","ả","ã","â","ầ","ấ","ậ","ẩ","ẫ","ă", "ằ","ắ","ặ","ẳ","ẵ","è","é","ẹ","ẻ","ẽ","ê","ề" ,"ế","ệ","ể","ễ", "ì","í","ị","ỉ","ĩ", "ò","ó","ọ","ỏ","õ","ô","ồ","ố","ộ","ổ","ỗ","ơ" ,"ờ","ớ","ợ","ở","ỡ", "ù","ú","ụ","ủ","ũ","ư","ừ","ứ","ự","ử","ữ", "ỳ","ý","ỵ","ỷ","ỹ", "đ", "À","Á","Ạ","Ả","Ã","Â","Ầ","Ấ","Ậ","Ẩ","Ẫ","Ă" ,"Ằ","Ắ","Ặ","Ẳ","Ẵ", "È","É","Ẹ","Ẻ","Ẽ","Ê","Ề","Ế","Ệ","Ể","Ễ", "Ì","Í","Ị","Ỉ","Ĩ", "Ò","Ó","Ọ","Ỏ","Õ","Ô","Ồ","Ố","Ộ","Ổ","Ỗ","Ơ" ,"Ờ","Ớ","Ợ","Ở","Ỡ", "Ù","Ú","Ụ","Ủ","Ũ","Ư","Ừ","Ứ","Ự","Ử","Ữ", "Ỳ","Ý","Ỵ","Ỷ","Ỹ", "Đ","&"," ","/","\\","'","*",":"); $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","","","","","","",""); return str_replace($marTViet,$marKoDau,trim($str)); } function getmp3($z){ $songIds=array(); $zing_ids=array(); foreach($z as $c){ $zing_ids[$c['link']]=$c['id']; array_push($songIds,$c['link']); } $publicKey='c1e9642938bee8f03f489b09455ba759950f5f9c'; $privateKey='30ad0ae0e22ddc1736698bfb4bee9258'; //$songIds=array('ZWZD7EO0','ZWZD7EO9'); $data = array('id'=>$songIds, 't'=>'song') ; //echo json_encode($data); $jsondata = urlencode(base64_encode(json_encode($data))); $signature = hash_hmac('md5',$jsondata , $privateKey); $url = 'http://api.mp3.zing.vn/api/xml-mini?publicKey=c1e9642938bee8f03f489b09455ba759950f5f9c&signature='.$signature.'&jsondata='.$jsondata; $jsdata = file_get_contents($url); $data=json_decode($jsdata); $i=0; $zing_kq=array(); foreach($data as $b){ $zing_kq[$zing_ids[$b->ID]]=$b->LinkPlay128; } return $zing_kq; } function print_playlist($c){ foreach($c as $b){ if(!$b['audio']) continue;//bo qua cac bai khong co link echo' { title:"'.++$i.'. '.$b['title'].'", artist:"'.$b['artist'].'", mp3:"'.$b['audio'].'" },'; } } ?> Các bài hát hay nhất tại Lời Dịch với từ khóa yeucau: