Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * @ Code web bán nick LMHT được viết bởi Hậu Nguyễn
- *
- * @ Liên hệ: https://www.facebook.com/profile.php?id=100004684695399
- *
- */
- session_start();
- $ketnoi['host'] = '127.0.0.1'; //Tên server, nếu dùng hosting free thì cần thay đổi
- $ketnoi['dbname'] = 'root'; //Đây là tên của Database
- $ketnoi['username'] = 'shop'; //Tên sử dụng Database
- $ketnoi['password'] = '';//Mật khẩu của tên sử dụng Database
- @mysql_connect("{$ketnoi['host']}","{$ketnoi['username']}","{$ketnoi['password']}") or die("Không thể kết nối database");
- @mysql_select_db( "{$ketnoi['dbname']}") or die("Không thể chọn database");
- // lấy dữ liệu user trong csdl thông qua sesion
- if (isset($_SESSION['username']) && $_SESSION['username']){
- $uid = $_SESSION['username'];
- $data = mysql_fetch_array(mysql_query("SELECT * FROM `nguoidung` WHERE `uid` = '".$uid."' LIMIT 1"));// get dữ liệu từ trong data theo user id
- }
- $home = 'http://'.$_SERVER['HTTP_HOST'].'';// lấy tên miền
- $lienminh = mysql_result(mysql_query("SELECT COUNT(*) FROM `baidang` WHERE `loainick` = 'LMHT' AND `trangthai` !='off' LIMIT 1"), 0);
- $user = mysql_result(mysql_query("SELECT COUNT(*) FROM `nguoidung` LIMIT 1"), 0);
- $giaodich = mysql_result(mysql_query("SELECT COUNT(*) FROM `lichsumua` LIMIT 1"), 0);
- $now = getdate();
- // func đếmn ngược thời gian (dạng giống facebook)
- function time_stamp($time)
- {
- $periods = array("giây", "phút", "giờ", "ngày", "tuần", "tháng", "năm", "thập kỉ");
- $lengths = array("60","60","24","7","4.35","12","10");
- $now = time();
- $difference = $now - $time;
- $tense = "trước";
- for($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) {
- $difference /= $lengths[$j];
- }
- $difference = round($difference);
- return "Cách đây $difference $periods[$j]";
- }
- // Func thống kê online
- function getAmungStats($amung) {
- if(!isset($amung)) return false;
- $url = 'http://whos.amung.us/sitecount/' . $amung . '/';
- $result = '';
- if (function_exists('curl_init')) {
- $http_headers = array();
- $http_headers[] = 'Expect:';
- $http_headers[] = 'Content-Type: text/plain';
- $http_headers[] = 'Host: whos.amung.us';
- $opts = array();
- $opts[CURLOPT_URL] = $url;
- $opts[CURLOPT_HTTPHEADER] = $http_headers;
- $opts[CURLOPT_CONNECTTIMEOUT] = 5;
- $opts[CURLOPT_TIMEOUT] = 10;
- $opts[CURLOPT_USERAGENT] = 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17';
- $opts[CURLOPT_HEADER] = FALSE;
- $opts[CURLOPT_RETURNTRANSFER] = TRUE;
- # Initialize PHP/CURL handle
- $ch = curl_init();
- curl_setopt_array($ch, $opts);
- # Create return array
- $result = curl_exec($ch);
- curl_close($ch);
- } elseif (ini_get('allow_url_fopen')) {
- $result = file_get_contents($url);
- }
- return intval($result);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment