Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2012
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.88 KB | None | 0 0
  1. <?php
  2. Include "config.php";
  3.  
  4. if (!empty($_GET['id'])) {
  5.  
  6.     $_id = $_GET['id'];
  7.  
  8.     $link = mysql_connect($mysql_host, $mysql_user, $mysql_password)
  9.     or die("Could not connect : " . mysql_error());
  10.     mysql_query('SET NAMES utf8');
  11.     mysql_select_db($my_database) or die("Could not select database");
  12.  
  13.     $msg = "SELECT * FROM e_users where vk_id = '$_id'";
  14.     $result = mysql_query($msg) or die("Query failed : " . mysql_error());
  15.     $line = mysql_fetch_array($result);
  16.    
  17.     $top9 = "SELECT vk_photo, vk_first_name, vk_last_name, experience FROM e_users ORDER BY experience DESC LIMIT 9";
  18.     $result_top9 = mysql_query($top9) or die("Query failed : " . mysql_error());
  19.     if (mysql_num_rows($result_top9) > 0)
  20.     {
  21.         $arr1 = array();
  22.         $arr2 = array();
  23.         $arr3 = array();
  24.         $arr4 = array();
  25.        
  26.         while($fetch = mysql_fetch_assoc($result_top9))
  27.         {
  28.             $arr1[] = $fetch['vk_photo'];  
  29.             $arr2[] = $fetch['vk_first_name'];
  30.             $arr3[] = $fetch['vk_last_name'];
  31.             $arr4[] = $fetch['experience'];
  32.         }
  33.         $top_photo = implode(',', $arr1);
  34.         $top_first_name = implode(',', $arr2);
  35.         $top_last_name = implode(',', $arr3);
  36.         $top_experience = implode(',', $arr4);
  37.     }
  38.    
  39.     $vk_id = $line["vk_id"];
  40.  
  41.     $info_array = array(
  42.     $line["vk_photo"],
  43.     $line["vk_first_name"],
  44.     $line["vk_last_name"],
  45.     $line["experience"],
  46.     $line["money"],
  47.     $line["energy"]
  48.     );
  49.    
  50.     $isWeapons = $line["weapons"];
  51.    
  52.     $info = implode(",",$info_array);
  53.    
  54.     if ($vk_id == $_id)
  55.     {
  56.         echo "[msg]"."1"."[/msg]";
  57.         echo "[info]" . $info . "[/info]";
  58.         echo "[isWeapons]" . $isWeapons . "[/isWeapons]";
  59.        
  60.         echo "[top_photo]" . $top_photo . "[/top_photo]";
  61.         echo "[top_first_name]" . $top_first_name . "[/top_first_name]";
  62.         echo "[top_last_name]" . $top_last_name . "[/top_last_name]";
  63.         echo "[top_experience]" . $top_experience . "[/top_experience]";
  64.     }else{
  65.         echo "[msg]"."0"."[/msg]";
  66.     }
  67.     mysql_close($link);
  68. }
  69. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement