Jump to content

Deanznet

Members
  • Posts

    220
  • Joined

  • Last visited

Everything posted by Deanznet

  1. Works man! Im trying to get it the money thing to work. <?php define('IN_PHPBB', true); define('IN_CASHMOD', true); $phpbb_root_path = './'; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); // // Start session management // $userdata = session_pagestart($user_ip, PAGE_INDEX); init_userprefs($userdata); // // End session management // // Sorry , only logged users ... if ( !$userdata['session_logged_in'] ) { $redirect = "traded.$phpEx"; $redirect .= ( isset($user_id) ) ? '&user_id=' . $user_id : ''; header('Location: ' . append_sid("login.$phpEx?redirect=$redirect", true)); } if($userdata['session_logged_in']) { // Who is looking at this page ? $user_id = $userdata['user_id']; if ( (!( isset($HTTP_POST_VARS[post_USERS_URL]) || isset($HTTP_GET_VARS[post_USERS_URL]))) || ( empty($HTTP_POST_VARS[post_USERS_URL]) && empty($HTTP_GET_VARS[post_USERS_URL]))) { $view_userdata = $userdata; } else { $view_userdata = get_userdata(intval($HTTP_GET_VARS[post_USERS_URL])); } $searchid = $view_userdata['user_id']; $points = $userdata['user_points']; $posts = $userdata['user_posts']; //select the users money $query = mysql_query("SELECT user_points FROM phpbb_users WHERE user_id='$user_id'")or die(mysql_error()); $user_points = mysql_fetch_assoc($query); //check if they submitted the form if (isset($_POST['submit'])){ if ($_POST['action'] == 'buy'){ echo "These are the items that were selected [they chose 'buy']<br>"; //Loop through the selected items foreach ($_POST['selected'] as $itemID){ echo $itemID.'<br>'; //this is where you would do your query mysql_query("UPDATE phpbb_trading SET item_in_shop = '0', itemid = '$user_id' WHERE item_name = '$itemID'"); mysql_query($query); echo "Item Bought<br>"; //Check if they have enough if ($user_points['user_points'] > $item_price){ //they have enough, now do a query to subtract their money $subtract = mysql_query("UPDATE users SET user_points=user_points-$item_price WHERE itemid='$user_id'") or die(mysql_error()); } else { //they don't have enough money, give them an error... echo "Not Enought Boomies'"; } } } else { echo "They chose 'sell'"; } } $result = mysql_query("SELECT * FROM phpbb_trading WHERE item_in_shop = '1'and itemid = '0' ")or die(mysql_error()); $num_rows = mysql_num_rows($result); print "<br>There are $num_rows cards left in the store.<P>"; print "<form action='{$_SERVER['PHP_SELF']}' method='post'>"; print '<table width=500 height= 500 border=1>'."\n"; while ($get_info = mysql_fetch_assoc($result)) { print "<tr>"; print "\t<td><font face=arial size=1/>"; print "<input type='checkbox' name='selected[]' value='{$get_info['item_name']}' />" .$get_info['item_name'].'<br><td>'.$get_info['item_price'].'<br>'.Boomies.'<br><td>'.$get_info['item_desc']."</font></td>"; print "</tr>"; } echo '<select name="action">' .'<option value="buy">Buy</option>' .'<option value="sell">Sell</option>' .'</select><p>'; echo '<input type="submit" name="submit">'; echo '</form>'; } else { echo('You are a guest'); } ?> When i hit buy it says Bronze Trading Test Item Bought You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE itemid='3'' at line 1 Just so you know The user cash is called user_points the item price is item_price Those are the tables they are in the user_points are located in the phpbb_user table and the item_price are located in phpbb_trading
  2. Suppose to grab it from the database well it pulls the item_name from database $result = mysql_query("SELECT * FROM phpbb_adr_shops_items WHERE item_owner_id = '1' ")or die(mysql_error()); and when they hit submit its suppose to get the item_name that was checked next to it.
  3. <?php define('IN_PHPBB', true); define('IN_CASHMOD', true); $phpbb_root_path = './'; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); // // Start session management // $userdata = session_pagestart($user_ip, PAGE_INDEX); init_userprefs($userdata); // // End session management // // Sorry , only logged users ... if ( !$userdata['session_logged_in'] ) { $redirect = "traded.$phpEx"; $redirect .= ( isset($user_id) ) ? '&user_id=' . $user_id : ''; header('Location: ' . append_sid("login.$phpEx?redirect=$redirect", true)); } if($userdata['session_logged_in']) { // Who is looking at this page ? $user_id = $userdata['user_id']; if ( (!( isset($HTTP_POST_VARS[post_USERS_URL]) || isset($HTTP_GET_VARS[post_USERS_URL]))) || ( empty($HTTP_POST_VARS[post_USERS_URL]) && empty($HTTP_GET_VARS[post_USERS_URL]))) { $view_userdata = $userdata; } else { $view_userdata = get_userdata(intval($HTTP_GET_VARS[post_USERS_URL])); } $searchid = $view_userdata['user_id']; $points = $userdata['user_points']; $posts = $userdata['user_posts']; //check if they submitted the form if (isset($_POST['submit'])){ if ($_POST['action'] == 'buy'){ echo "These are the items that were selected [they chose 'buy']<br>"; //Loop through the selected items foreach ($_POST['selected'] as $itemID){ echo $itemID.'<br>'; //this is where you would do your query mysql_query("UPDATE phpbb_adr_shops_items SET item_owner_id = '1' WHERE item_name = '$item_name"); mysql_query($query); echo "Item Bought<br>"; } } else { echo "They chose 'sell'"; } } $result = mysql_query("SELECT * FROM phpbb_adr_shops_items WHERE item_owner_id = '1' ")or die(mysql_error()); $num_rows = mysql_num_rows($result); print "<br>There are $num_rows cards left in the store.<P>"; print "<form action='{$_SERVER['PHP_SELF']}' method='post'>"; print '<table width=200 border=1>'."\n"; while ($get_info = mysql_fetch_assoc($result)) { print "<tr>"; print "\t<td><font face=arial size=1/>"; print "<input type='checkbox' name='selected[]' value='{$get_info['item_name']}' />" .$get_info['item_name']."</font></td>"; print "</tr>"; } echo '<select name="action">' .'<option value="buy">Buy</option>' .'<option value="sell">Sell</option>' .'</select><p>'; echo '<input type="submit" name="submit">'; echo '</form>'; } else { echo('You are a guest'); } ?> Thats my Whole Update code
  4. That works great but im having trouble with my mysql query for the buying part. mysql_query("UPDATE phpbb_adr_shops_items SET item_owner_id = '$user_id' WHERE item_name = '$item_name"); mysql_query($query); echo "Item Bought<br>"; } } else { echo "They chose 'sell'"; } The problem is it dosent update the database at all. if i put in the item name such as item_name = 'Myname' It will update it. Also when they buy how do i make it check if this person has enough cash and if they do they will subtract their the price from their cash.
  5. Okay Sorry for the confusion. Basically I have 1 php file witch is the store. The code i is posted above. Right now all that dose is get the items from the database and puts a check box next to them. The items are listed in the database such as item name, owner id, picture, desc item name, owner id, picture, desc item name, owner id, picture, desc I need to figure out how to make a list box at the end that has Buy or Sell and a submit button. When a selects buy and hit submit and he has 1 or more item checked it will update those items in each table and put The The users username where the Owner id is.
  6. <?php define('IN_PHPBB', true); define('IN_CASHMOD', true); $phpbb_root_path = './'; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); // // Start session management // $userdata = session_pagestart($user_ip, PAGE_INDEX); init_userprefs($userdata); // // End session management // // Sorry , only logged users ... if ( !$userdata['session_logged_in'] ) { $redirect = "traded.$phpEx"; $redirect .= ( isset($user_id) ) ? '&user_id=' . $user_id : ''; header('Location: ' . append_sid("login.$phpEx?redirect=$redirect", true)); } if($userdata['session_logged_in']) { // Who is looking at this page ? $user_id = $userdata['user_id']; if ( (!( isset($HTTP_POST_VARS[post_USERS_URL]) || isset($HTTP_GET_VARS[post_USERS_URL]))) || ( empty($HTTP_POST_VARS[post_USERS_URL]) && empty($HTTP_GET_VARS[post_USERS_URL]))) { $view_userdata = $userdata; } else { $view_userdata = get_userdata(intval($HTTP_GET_VARS[post_USERS_URL])); } $searchid = $view_userdata['user_id']; $points = $userdata['user_points']; $posts = $userdata['user_posts']; // Retrieve all the data from the "example" table $result = mysql_query("SELECT * FROM phpbb_adr_shops_items WHERE item_owner_id = '1' ") or die(mysql_error()); $num_rows = mysql_num_rows($result); print "There are $num_rows records.<P>"; print '<table width=200 border=1>'."\n"; while ($get_info = mysql_fetch_assoc($result)){ print "<tr>"; print "\t<td><font face=arial size=1/>"; print '<input type="checkbox" name="namehere" />'.$get_info['item_name']. $get_info['item_id'].'</font></td>'; print "</tr>"; } print "</table></form>"; } else { echo('You are a guest'); } ?> Thats all i got so far.. This is for a store when someone post i need it to update the table the item is in and change its owner id to the user id that the user is loged in with
  7. Hey i need to get the name="namehere" from the database. I tried name="$get_info['item_name']" But didn't work. Part of the code: print '<table width=200 border=1>'."\n"; while ($get_info = mysql_fetch_assoc($result)){ print "<tr>"; print "\t<td><font face=arial size=1/>"; print '<input type="checkbox" name="namehere" />'.$get_info['item_name'].'</font></td>'; print "</tr>";
  8. That was weird it should a whole bunch of blank text box with nothing in it Lol I need to to also display the items in the table.. Each item has a description and a price so it look like this X- represents check box X item name Item Description Price Picture X item name Item Description Price Picture X item name Item Description Price Picture list box submit Also im not sure how to do this 100% but when i hit submit im going to have it post to a file and depending on what was selected. lets say buy was selected it will change subtract the price from their cash and than also update the owner name and the change item in show from 1 to 0. because each item has fields in the database such as Item id, item owner, Item price, Item Desc Item in Shop etc.. So if you know how to do this if you can explain
  9. First one shows Array ( [user_id] => 3 [user_active] => 1 [username] => Myusername [user_password] => md5hash [user_session_time] => 1193232535 [user_session_page] => 0 [user_lastvisit] => 1196121530 [user_regdate] => 1152063005 [user_level] => 1 [user_posts] => 237 [user_timezone] => -4.00 [user_style] => 5 [user_lang] => english [user_dateformat] => D M d, Y g:i a [user_new_privmsg] => 0 [user_unread_privmsg] => 0 [user_last_privmsg] => 1195881794 [user_login_tries] => 0 [user_last_login_try] => 0 [user_emailtime] => [user_viewemail] => 0 [user_attachsig] => 1 [user_allowhtml] => 0 [user_allowbbcode] => 1 [user_allowsmile] => 1 [user_allowavatar] => 1 [user_allow_pm] => 1 [user_allow_viewonline] => 1 [user_notify] => 0 [user_notify_pm] => 1 [user_popup_pm] => 1 [user_rank] => 1 [user_avatar] => Comics/008.jpg [user_avatar_type] => 3 [user_email] => dino_x9@hotmail.com [user_icq] => [user_website] => [user_from] => 435 south.. wait why am i telling you this? [user_sig] => [user_sig_bbcode_uid] => [user_aim] => Soul+Reaper89 [user_yim] => [user_msnm] => dino_x9@hotmail.com [user_occ] => [user_interests] => [user_actkey] => [user_newpasswd] => [user_birthday] => 999999 [user_next_birthday_greeting] => 0 [user_allowdesc] => 0 [user_allowmoddesc] => 0 [user_showdescriptions] => 0 [user_showtooltips] => 0 [user_tooltips_parse] => 1 [user_tooltips_static] => 0 [user_toolimg_width] => 1 [user_toolimg_height] => 1 [user_show_quickreply] => 1 [user_quickreply_mode] => 1 [user_open_quickreply] => 1 [games_block_pm] => 1 [user_troll] => 0 [user_adr_ban] => 0 [user_cell_time] => 0 [user_cell_time_judgement] => 0 [user_cell_caution] => 0 [user_cell_sentence] => [user_cell_enable_caution] => 0 [user_cell_enable_free] => 0 [user_cell_celleds] => 0 [user_cell_punishment] => 0 [user_points] => 45093 [arcade_banned] => 0 [session_id] => be3214321312c4526af27ea12312406 [session_user_id] => 3 [session_start] => 119122318 [session_time] => 1196132535 [session_ip] => 4514322cd [session_page] => 0 [session_logged_in] => 1 [session_admin] => 0 ) Test 2 Showed My Users you dont need the Db Connection information works without it.
  10. How would one go about submitting check box data to mysql database. // Retrieve all the data from the table $result = mysql_query("SELECT * FROM phpbb_adr_shops_items WHERE item_owner_id = '1' ") or die(mysql_error()); $num_rows = mysql_num_rows($result); print "There are $num_rows records.<P>"; print "<table width=200 border=1>\n"; while ($get_info = mysql_fetch_row($result)){ print "<tr>\n"; foreach ($get_info as $field) print "\t<td><font face=arial size=1/>$field</font></td>\n"; print "</tr>\n"; } print "</table>\n"; That gets all the stuff in that table.. I want to know how to get check box their and have a drop list box i guess with Different options Ex. Buy or Sell I would have to use a loop for this because i have more than 1 item in the table and i prob will always add more. Will it have to have the item id from the mysql table.. because i have a table that has the item id in it also.
  11. Hey I'm trying to make a game.. Keyword Trying lol I just need to clear something up.. If i have 3 different kinds Quality of item.. Some Items Will be Bronze Type Some Will Be Silver and Some Will be gold I also want it so when they first start playing they get to buy a pack Bronze Pack, Silver Pack, Gold Pack, That will pick 3 random items from what ever pack they buy and give it to them. So how do i set up my mysql database for this? Will it just be One table called Shop Items and than have the item id and item quality and what ever else that i put in their like the desc.
  12. Im using trying to make a phpbb game kinda.. Well its going to be all based on phpbb.. I have phpbb board with the arcade and cash mod.. So for people to make games they either post or play the arcade. Then they get money they can spend in the game. I dont know how to display the cash they have in the database thats what is what i was trying to do
  13. Hey Their Im working on this game but im having trouble. I can select information from a 1 specific user but i really cant figure out how to select it using the session. <?php define('IN_PHPBB', true); $phpbb_root_path = './'; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); // // Start session management // $userdata = session_pagestart($user_ip, PAGE_INDEX); init_userprefs($userdata); // // End session management // // Sorry , only logged users ... if ( !$userdata['session_logged_in'] ) { $redirect = "traded.$phpEx"; $redirect .= ( isset($user_id) ) ? '&user_id=' . $user_id : ''; header('Location: ' . append_sid("login.$phpEx?redirect=$redirect", true)); } if($userdata['session_logged_in']) { $database="N/A"; mysql_connect ("N/A", "N/A", "N/A"); @mysql_select_db($database) or die( "Unable to select database"); $result = mysql_query( "select username,user_points from phpbb_users where username='cablekid'" ) or die("SELECT Error: ".mysql_error()); $num_rows = mysql_num_rows($result); print "There are $num_rows records.<P>"; print "<table width=200 border=1>\n"; while ($get_info = mysql_fetch_row($result)){ print "<tr>\n"; foreach ($get_info as $field) print "\t<td><font face=arial size=1/>$field</font></td>\n"; print "</tr>\n"; } print "</table>\n"; echo('Hi' . $userdata['username'] . '!'); } else { echo('You are a guest'); } ?> See here I thought it would be something like this $result = mysql_query( "select username,user_points from phpbb_users where $userdata['username']'" ) But that dosent work either.. Any help would be great.
  14. Ya man im still novice but i found this great tutorial for a rpg game so maybe i can learn from it
  15. Hey im trying to make a php text/image game that also uses my phpbb forum. Basicly... Its going to be like a trading card game. basicly you roam around the site and cards appear and go into your invitory and you can trade with other users. How hard would this be in accomplishing.. anyway someone could push me in the write direction.
  16. Actually is their way to hide to comment system instill the user logins.. if it check if the user logged in and if their not it tells them to login to comment and if they are logged in it will show the comment script.
  17. I already know how to make a page required to login but i just want to make them have to login to post so we dont have people posting as other people.. I think i found a script... but it has a field for name and email. How hard would do you think to change so it makes them login and grab their id and email and post it..
  18. It took place in North Carolina maybe about 20 years ago or so i think they guy was like 21 and she was 14 or something
  19. Yup it didn't matter that she had a fake id or anything
  20. Anyone have an idea where their might be a good tutorial on this.. I would like to have a Multi Page Comment Box.. so i people can comment on different images on different page.. But it also has to be able to make them log in befor commenting.. Anyone know of a good script or has a tutorial.
  21. Your prob can upload a shell mixed in with the files for the database if anything ever goes wrong you know what to do and if everything goes okay just self delete it.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.