Jump to content
MakeWebGames

Dave

Administrators
  • Posts

    3,368
  • Joined

  • Last visited

  • Days Won

    126

Everything posted by Dave

  1. Re: [Mccodes V2] Item Sell Update [Javascript!] This mod will still run without JS and not many people have JS turn of ;).
  2. Re: [Mccodes V2] Item Sell Update [Javascript!] No problem ;). any requests for anything else to be javascripted (well to the best of my abilities xD)
  3. Re: [Mccodes V2] Item Sell Update [Javascript!] Thanks :) Hopefully some more javascript modifactions to come.
  4. I was wanting to do some javascript then i realised on the Item Sell page there was a spelling mistake or something so i decided to add some javascript to the page. As you can see in the screenshot there is an extra area called Total Sale Price this updates when the user changes the quantity! The submit button also changes from "Sell Item" to "Sell Items" if the user is selling more then one item. Then the user will be presented with a confirm box which asks them if they want to sell X number of Item with an "Ok" button and a "Cancel" button. Preety basic javascript but im learning. Installation is simple just replace itemsell.php with this one <?php include "globals.php"; $_GET['ID'] = abs((int) $_GET['ID']); $_GET['qty'] = abs((int) $_GET['qty']); //itemsend if($_GET['qty']) { $id=$db->query("SELECT iv.*,it.* FROM inventory iv LEFT JOIN items it ON iv.inv_itemid=it.itmid WHERE iv.inv_id={$_GET['ID']} AND iv.inv_userid=$userid LIMIT 1"); if($db->num_rows($id)==0) { print "Invalid item ID"; } else { $r=$db->fetch_row($id); if($_GET['qty'] > $r['inv_qty']) { print "You are trying to send more than you have!"; } else { $price=$r['itmsellprice']*$_GET['qty']; //are we sending it all item_remove($userid, $r['itmid'], $_GET['qty']); $db->query("UPDATE users SET money=money+{$price} WHERE userid=$userid"); $priceh="$".($price); print "You sold {$_GET['qty']} {$r['itmname']}(s) for {$priceh}"; $db->query("INSERT INTO itemselllogs VALUES ('', $userid, {$r['itmid']}, $price, {$_GET['qty']}, unix_timestamp(), '{$ir['username']} sold {$_GET['qty']} {$r['itmname']}(s) for {$priceh}')"); } } } else if($_GET['ID']) { $id=$db->query("SELECT iv.*,it.* FROM inventory iv LEFT JOIN items it ON iv.inv_itemid=it.itmid WHERE iv.inv_id={$_GET['ID']} and iv.inv_userid=$userid LIMIT 1"); if($db->num_rows($id)==0) { print "Invalid item ID"; } else { $r=$db->fetch_row($id); echo '<script type="text/javascript"> <!-- function check() { var plural = \'\'; if(document.form.qty.value == 0) { alert("You must enter a number!"); return false; } else { if(document.form.qty.value > 1) { var plural = \'s\'; } var answer = confirm("Are you sure you want to sell " + document.form.qty.value + " '.$r['itmname'].'" + plural + "?"); if (answer){ return true; } else{ return false; } } } function plur() { if(document.form.qty.value > 1) { document.form.submit.value=\'Sell Items\'; } document.form.total.value = "$" + document.form.qty.value * '.$r['itmsellprice'].'; } //--> </script>'; print " [b]Enter how many {$r['itmname']}(s) you want to sell. You have {$r['inv_qty']} to sell.[/b] <form name='form' action='itemsell.php' method='get'> <input type='hidden' name='ID' value='{$_GET['ID']}' /> Quantity: <input type='text' name='qty' value='' onkeyup='return plur();' /><hr /> Total sale price: <input type='text' name='total' style='background: black; font-family: Calibri; font-size: 12px; border: none; color: white;' value='$0' size='4'> <hr /> <input name='submit' type='submit' value='Sell Item' onclick='return check();'/></form>"; } } else { print "Invalid use of file."; } $h->endpage(); ?> Not entirely sure if this will work in all browsers but it works in IE8 and FF3 Any errors or it just not working (javascript dosen't produce errors normally just dosen't work.) reply and ill see if i can work it out (Im new to javascript :P) Have fun! If you use this please reply saying thanks or maybe give me +1 (Think its called light now)
  5. Re: .htaccess or php help needed The above script denies direct access to globals.php, Some mods can be abused if access to globals is allowed.
  6. Re: .htaccess or php help needed hmmm, Floydian your idea wouldn't work on a globals.php... just wondering would there be anything strictly wrong with using $page = explode('/', $_SERVER['PHP_SELF']); if (basename(__FILE__) == basename($page[1])){ echo 'Direct access is denied to this file'; exit; } It works and stops people doing filename.php/blahsavaf
  7. Re: [Need]Sql Dump[Need] I get people to make them in reward they get staff positions, Just gotta find people you can trust :S
  8. Re: installer question. Tbh, It dosen't matter if you did or didn't buy it anyone with any error is presumed to of not purchased the codes which i think is completly wrong! The installer can be a pain i know quite a few people who manually install, Contact me on MSN ([email protected]) ill try to help the best i can.
  9. Re: [v2] Iframes in header.php target="_top" i think (The links inside the frame)
  10. Re: New Houses Mod [Mccodes V2] Just by skimming over it i beleive you need to post the $houses query
  11. Re: [MCV1]Crimes Need An Item Try to make it yourself... i spent about 7 hours trying to write something in visual basics (Which didn't work) but in the process i learnt quite alot about how Visual Basics works by contacting mates and searching google for what i was trying to do....
  12. Dave

    Deadly Ghetto

    Re: Deadly Ghetto Were currently holding a referral competition on the game! So if you've got a lot of friends its a perfect way to get a little boost in game.
  13. Re: [REVIEW]Battle Century - Please review!! Not bad why did you change the domain to a .co.cc?
  14. Re: installer question. Or... You could do this 1. Go to www.mccodes.com 2. Purchase the script! 3. Receive the file My god thats hard 3 steps no wonder no one does it
  15. Re: [V2]Updated Header[V2] I think you should have to have good grammer to be a member of this forum, theres way to many people just going around saying "Yeh i mad this maty" when they obviously didn't because there grammer compared to the grammer in the code is completely different. Tbh my grammer isn't great myself but people don't have to think to much about what I'm trying to say when you read what I've typed.
  16. Re: New Houses Mod [Mccodes V2] Dont just post the line with the error! post say 5 lines each way so post from line 301 to 311
  17. Re: [Mccodes V2]Login Register, TOs I've informed mike before not to spam other games... after a report sent to me about it, i shall remind him again.
  18. Re: [Mccodes V2]Login Register, TOs Last time i checked this guy dosen't even own Anime Warz anymore...
  19. Re: [Request] Mugging without attacking You could easily re add the mug option in the attack script just need to add another button in beleive.
  20. Dave

    No Topic

    Re: No Topic I already told you what i tend to do :P Is this that neat unique thing? or the domain thing xD
  21. Dave

    No Topic

    Re: No Topic Cya later Haunted, All the good times xD, Have fun with whatever you decide to do :)
  22. Dave

    need some help

    Re: need some help Buy a host and a domain, Then get a better script then mccodes.
  23. Re: need help with crons To get it working as an event you would need $ir to be declared in the cron to use the built in event add function... so thats a no no, You will have to do some funky mysql statement which i dont know.
  24. Re: [mccode V2] Ajax Shoutbox. [$12.00] He stole and changed your code. I have worked with him and he often bragged about doing that type of thing. I'm preety sure that killah will agree with me when i say i created this from scratch.... If you dont beleive me i have a free one released on my network site so look at that coding.
  25. Re: [V2] Will Refill! He is basically saying instead of telling the user the amount they got tell them the percent.
×
×
  • Create New...