PHP Code:
if(isset($_POST['model_5'])){ $amount = 5000; //amount of credits. $q = mysql_query("SELECT null FROM users WHERE credits >= '{$amount}' AND id = '{$_SESSION['user']['id']}' LIMIT 1")or die(mysql_error()); if(mysql_num_rows($q) > 0) { mysql_query("UPDATE users SET credits = credits - '1000' WHERE username = '{$_SESSION['user']['username']}'"); mysql_query("INSERT INTO `rooms` (`id`, `roomtype`, `caption`, `owner`, `description`, `category`, `state`, `users_now`, `users_max`, `model_name`, `public_ccts`, `score`, `tags`, `icon_bg`, `icon_fg`, `icon_items`, `password`, `wallpaper`, `floor`, `landscape`, `allow_pets`, `allow_pets_eat`, `allow_walkthrough`, `allow_hidewall`, `wallthick`, `floorthick`, `achievement`) VALUES (NULL, 'private', 'Room Model 5', '{$_SESSION['user']['username']}', 'I bought this model for {$amount}!', '0', 'open', '0', '25', 'model_s5', '', '0', '', '1', '0', '', '', '0.0', '0.0', '0.0', '1', '0', '0', '0', '0', '0', '0')"); echo '<div class = "alert-g">Model purchased successfully, reload client and it will be in your rooms.</div>'; sendMUS('update_navigator'); } else{ echo "<div class = \"alert\">You need atleast {$amount} credits, buy some <a href = '{url}/shop'>here</a>.</div>"; } }
regards, Abidas