Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
How do I do this?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="JayC" data-source="post: 339212" data-attributes="member: 36373"><p>Alright I am now on my computer. Okay so what you are trying to do from what I can tell is this:</p><p>You want to create a form to allow users to purchase 5 thrones from the CMS part.</p><p></p><p>Easiest way and will save you this stress is to create a catalog item and put it under any page or whatever</p><p>set the amount = 5 and set the cost_snow = 4 and cost_pixels = 500 (this will be 500 points)</p><p></p><p>Okay so how you will code this in php is like this:</p><p>[PHP]</p><p><?php</p><p>if (isset($_POST['throne']))</p><p>{</p><p>$cost = 500;</p><p>$grabID = dbquery("SELECT * FROM items ORDER BY id DESC LIMIT 0,1");</p><p>$fetchID = mysql_fetch_array($getidd);</p><p>$newID = $fetchID['id'] + 1;</p><p>$userInformation = mysql_query("SELECT * FROM users WHERE id = '" . $_SESSION['user']['id'] . "'");</p><p>while($info = mysql_fetch_array($userInformation)){</p><p>if($info['vip_points'] >= $cost){</p><p> if($info['online'] == 0){</p><p> mysql_query("UPDATE `users` SET vip_points = vip_points - $cost WHERE id = '" . $_SESSION['user']['id'] . "'");</p><p> mysql_query("INSERT into items (id, user_id, room_id, base_item, x, y, z, rot, wall_pos) VALUES ('" . $newID . "','" . $_SESSION['user']['id'] . "', '0', 'THRONEID', '0', '0', '0', '0', '0')");</p><p> echo "The Transaction was successful. You just purchased 5 thrones";</p><p> }else{</p><p> echo "Please be offline to make this transaction";</p><p> }</p><p>}else{</p><p> echo "The current cost is $cost and you only have $info['vip_points']";</p><p>}</p><p>}</p><p>}</p><p>?></p><p>[/PHP]</p></blockquote><p></p>
[QUOTE="JayC, post: 339212, member: 36373"] Alright I am now on my computer. Okay so what you are trying to do from what I can tell is this: You want to create a form to allow users to purchase 5 thrones from the CMS part. Easiest way and will save you this stress is to create a catalog item and put it under any page or whatever set the amount = 5 and set the cost_snow = 4 and cost_pixels = 500 (this will be 500 points) Okay so how you will code this in php is like this: [PHP] <?php if (isset($_POST['throne'])) { $cost = 500; $grabID = dbquery("SELECT * FROM items ORDER BY id DESC LIMIT 0,1"); $fetchID = mysql_fetch_array($getidd); $newID = $fetchID['id'] + 1; $userInformation = mysql_query("SELECT * FROM users WHERE id = '" . $_SESSION['user']['id'] . "'"); while($info = mysql_fetch_array($userInformation)){ if($info['vip_points'] >= $cost){ if($info['online'] == 0){ mysql_query("UPDATE `users` SET vip_points = vip_points - $cost WHERE id = '" . $_SESSION['user']['id'] . "'"); mysql_query("INSERT into items (id, user_id, room_id, base_item, x, y, z, rot, wall_pos) VALUES ('" . $newID . "','" . $_SESSION['user']['id'] . "', '0', 'THRONEID', '0', '0', '0', '0', '0')"); echo "The Transaction was successful. You just purchased 5 thrones"; }else{ echo "Please be offline to make this transaction"; } }else{ echo "The current cost is $cost and you only have $info['vip_points']"; } } } ?> [/PHP] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
How do I do this?
Top