Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- Include "config.php";
- if (!empty($_GET['id'])){
- $_id = $_GET['id'];
- $_index = $_GET['i'];
- $link = mysql_connect($mysql_host, $mysql_user, $mysql_password)
- or die("Could not connect : " . mysql_error());
- mysql_select_db($my_database) or die("Could not select database");
- $w_msg = "SELECT * FROM e_weapons where w_index = '$_index'";
- $w_result = mysql_query($w_msg);
- $w_line = mysql_fetch_array($w_result);
- $w_index = $w_line["w_index"];
- $w_cost = $w_line["w_cost"];
- $w_experience = $w_line["w_experience"];
- $w_array_index = $w_line["w_array_index"];
- $u_msg = "SELECT * FROM e_users where vk_id = '$_id'";
- $u_result = mysql_query($u_msg);
- $u_line = mysql_fetch_array($u_result);
- $u_vk_id = $u_line["vk_id"];
- $u_experience = $u_line["experience"];
- $u_money = $u_line["money"];
- list($u_weapon[0], $u_weapon[1], $u_weapon[2]) = explode( ',', $u_line["weapons"]);
- if (($u_vk_id == $_id) && ($w_index == $_index))
- {
- if ($u_experience >= $w_experience)
- {
- echo "[experience]"."1"."[/experience]";
- if ($u_money >= $w_cost)
- {
- echo "[money]"."1"."[/money]";
- $u_weapon[$w_array_index] = 1;
- $u_money = $u_money - $w_cost;
- $u_arr = array($u_weapon[0], $u_weapon[1], $u_weapon[2]);
- $u_weapons = implode(",",$u_arr);
- $u_msg = "UPDATE e_users SET weapons = '$u_weapons', money = '$u_money' WHERE vk_id = '$_id'";
- mysql_query($u_msg) or die("Query failed : " . mysql_error());
- mysql_close($link);
- }else{echo "[money]"."0"."[/money]";}
- }else{echo "[experience]"."0"."[/experience]";}
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement