Jump to content
MakeWebGames

Lithium

Members
  • Posts

    1,099
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Lithium

  1. hehe thx once again, and here you go, as you couldn't find it http://perldoc.perl.org/Math/BigRat.html#is_pos()%2fis_positive()
  2. indeed it is!
  3. No hit taken, i rarely do actually, and discussions as this pointing out the the visible flaws, are nothing but a way for those who want to learn to have a better look when reusing code. and playing around with your suggestions why not "clone" is_pos() from perl, which is easyly achieved with a ternary condition? ;)
  4. @ Joshua: my point exactly! :) @ Equinox: you have a sh*tload of ways to do it but thanks for pointing them out. :)
  5. quite true if you rely on the $var alone. the funny thing is... i don't care much about it, as i rely on my own ways to secure those "insecurity" issues you pointed so fast, also, i am not reponsable for other users security, that is not my problem ;) @ Equinox, you are right, yet those functions assume that a negative number is actually a number, so just in case, cleaning that is not much of a big deal, as of the rest, i believe my answer to Danny would meet yours as well.
  6. I found one more bit of old code floating around my files. This is a bank replacement, where you can store money and crystals. Money has interest rates associated (that can be unique for every single player), and a limited amount of daily deposits. I made this this way, thinking on points that could be exchanged to increase interest, yet those bits, you will need to add yourself on other files. This is intended to be applied as a "stand alone" bank system (meaning that with minor edits this ought to work on any other engine), depending on its own table, meaning that regular "bankmoney" on users table won't be needed. Also, you don't need to generate entries for every single player as it will generate the needed row upon first use by the player itself. You are more than welcome to expand this further more, there are a few mods to this system i would like to see floating around. And enough is enough, let's dump the damn code, cause that is what you want. ;) Table dump [mysql] DROP TABLE IF EXISTS `uBANK`; CREATE TABLE `uBANK` ( `bID` int(11) NOT NULL AUTO_INCREMENT, `bUID` int(11) NOT NULL, `bMONEY` int(11) NOT NULL, `bCRYSTAL` int(11) NOT NULL, `bINTEREST` int(11) NOT NULL, `bDEPOSIT` int(11) NOT NULL, `bMAXCASH` int(11) NOT NULL, `bMAXDEP` int(11) NOT NULL, `bMAXCRYS` int(11) NOT NULL, PRIMARY KEY (`bID`), UNIQUE KEY `bID` (`bID`) ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; [/mysql] The code <?php /* bank.php by Lithium distribution/selling/sharing of this file is illegal without permission. */ include(DIRNAME(__FILE__) ."/globals.php"); $b = mysql_query("SELECT * FROM `uBANK` WHERE `bUID` = '{$userid}'"); $bank = mysql_fetch_array($b); if (!$bank) { /* edit values of this query to suit your needs bID = account id - don't change bUID = player id - don't change bMONEY = money user has in bank - don't change bCRYSTAL = crystals user has in bank - don't change bINTEREST = interest player gets - change to suit your needs bDEPOSIT = daily deposits player can use - change to suit your needs (goes down on each deposit) bMAXCASH = Maximum cash allowed on bank - change to suit your needs bMAXDEP = Maximum deposits player has per day - change to suit your needs bMAXCRYS = Maximum crystals allowed on bank - change to suit your needs */ $x = mysql_query(" INSERT INTO `uBANK` (`bID` ,`bUID` ,`bMONEY` ,`bCRYSTAL` ,`bINTEREST` ,`bDEPOSIT` ,`bMAXCASH` ,`bMAXDEP` ,`bMAXCRYS`) VALUES (NULL , $userid, '0', '0', '1', '5', '50000000', '5', '5000') "); ?> <div align="justify"> It seems this is your first time here! Before you proceed, please read carefully: This bank offers you a starter account with: [b]Money Deposits[/b]: 5 each day (can upgrade) [b]Money Interest[/b]: 1% weekly (can upgrade) [b]Max Money in Account[/b]: $50.000.000 (can upgrade) [b]Crystals Deposits[/b]: Unlimited [b]Crystals Interest[/b]: None [b]Max Crystals in Account[/b]: 5000 (can upgrade) Please click [url="javascript: window.location.reload()"]here[/url] to access your account! Thank you! </div> <?php $h->endpage(); } if (!$_POST['deposit'] && !$_POST['withdraw']) { ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <table width="95%" style="border: 1px solid #000000;"> <tr style="color: #FFFFFF; background-image: url(images/tdtitle.gif); height: 20px; font-weight: bold; text-align: center;"> <td colspan="2"style="border: 1px solid #000000;">[b]<?php echo $set['game_name']; ?> Bank[/b]</td> </tr> <tr> <td colspan="2" style="border: 1px solid #000000; text-align: center;"> Daily Deposits: <?php echo $bank['bDEPOSIT']; ?>/<?php echo $bank['bMAXDEP']; ?> (Money only) Interest Rate: <?php echo $bank['bINTEREST']; ?>% ($<?php echo number_format((($bank['bMONEY']+1)/100)*$bank['bINTEREST']); ?> Weekly) </td> </tr> <tr> <td style="color: #FFFFFF; background-image: url(images/tdtitle.gif); height: 20px; font-weight: bold; text-align: center;" colspan="2">[b]Money[/b]</td> </tr> <tr> <td width="50%" align="center" style="border: 1px solid #000000;"> [b]Deposit:[/b] <input name="money1" type="text" value="<?php echo $ir['money']; ?>" size="5" maxlength="10"> / $<?php echo number_format($ir['money']); ?> <input name="deposit" type="submit" value="Deposit"> </td> <td style="border: 1px solid #000000;" width="50%" align="center"> [b]Withdraw:[/b] <input name="money2" type="text" value="0" size="5" maxlength="10"> / $<?php echo number_format($bank['bMONEY']); ?> <input name="withdraw" type="submit" value="Withdraw"> </td> </tr> <tr> <td style="color: #FFFFFF; background-image: url(images/tdtitle.gif); height: 20px; font-weight: bold; text-align: center;" colspan="2">[b]Gemstones[/b]</td> </tr> <tr> <td style="border: 1px solid #000000;" width="50%" align="center"> [b]Deposit:[/b] <input name="crystals1" type="text" value="<?php echo $ir['crystals']; ?>" size="5" maxlength="10"> / <?php echo number_format($ir['crystals']); ?> <input name="deposit" type="submit" value="Deposit"> </td> <td style="border: 1px solid #000000;" width="50%" align="center"> [b]Withdraw:[/b] <input name="crystals2" type="text" value="0" size="5" maxlength="10"> / <?php echo number_format($bank['bCRYSTAL']); ?> <input name="withdraw" type="submit" value="Withdraw"> </td> </tr> </table> </form> <?php } elseif ($_POST['deposit'] && $_POST['money1']) { ?> <table width="95%" style="border: 1px solid #000000;"> <tr class="indextr"> <td class="index1">[b]<?php echo $set['game_name']; ?> Bank[/b]</td> </tr> <tr> <td class="infobox2"> <?php $moneys = (int) round(str_replace("-","",$_POST['money1'])); if ($moneys > $ir['money']) { ?> <font color="#FF0000">[b]ERROR[/b]</font> You don't have that much cash. <?php } elseif ($moneys < 1) { ?> <font color="#FF0000">[b]ERROR[/b]</font> You must enter a proper amount. <?php } elseif (($moneys+$bank['bMONEY']) > 50000000) { ?> <font color="#FF0000">[b]ERROR[/b]</font> You can only deposit $<?php echo number_format(50000000-$bank['bMONEY']); ?> more. <?php } elseif ($bank['bDEPOSIT'] == 0) { ?> <font color="#FF0000">[b]ERROR[/b]</font> You can't deposit any more today. <?php } else { $moneys = (int) $moneys; ?> You sucessfully deposited $<?php echo number_format($moneys); ?>. <?php $query = " UPDATE users, uBANK SET users.money = users.money - $moneys, uBANK.bMONEY = uBANK.bMONEY + $moneys, uBANK.bDEPOSIT = uBANK.bDEPOSIT - 1 WHERE users.userid='".$userid."' AND uBANK.bUID='".$userid."'" ; // chkSQL($query); mysql_query($query); } ?> [url="<?php echo $_SERVER['PHP_SELF']; ?>"]Go Back[/url] </td> </tr> </table> <?php } elseif ($_POST['deposit'] && $_POST['crystals1']) { ?> <table width="95%" style="border: 1px solid #000000;"> <tr class="indextr"> <td class="index1">[b]<?php echo $set['game_name']; ?> Bank[/b]</td> </tr> <tr> <td style="border: 1px solid #000000;"> <?php $crystals = (int) round(str_replace("-","",$_POST['crystals1'])); if ($crystals > $ir['crystals']) { ?> <font color="#FF0000">[b]ERROR[/b]</font> You don't have enough crystals. <?php } elseif ($crystals < 1) { ?> <font color="#FF0000">[b]ERROR[/b]</font> You must enter a proper amount. <?php } elseif (($crystals+$bank['bCRYSTAL']) > 5000) { ?> <font color="#FF0000">[b]ERROR[/b]</font> You can only deposit <?php echo number_format(5000-$bank['bCRYSTAL']); ?> crystals. <?php } else { $crystals = (int) $crystals; ?> You sucessfully deposited <?php echo number_format($crystals); ?> crystal(s). <?php $query = " UPDATE users, uBANK SET users.crystals = users.crystals - $crystals, uBANK.bCRYSTAL = uBANK.bCRYSTAL + $crystals WHERE users.userid='".$userid."' AND uBANK.bUID='".$userid."'" ; // chkSQL($query); mysql_query($query); } ?> [url="<?php echo $_SERVER['PHP_SELF']; ?>"]Go Back[/url] </td> </tr> </table> <?php } elseif ($_POST['withdraw'] && $_POST['money2']) { ?> <table width="95%" style="border: 1px solid #000000;"> <tr class="indextr"> <td class="index1">[b]<?php echo $set['game_name']; ?> Bank[/b]</td> </tr> <tr> <td class="infobox2"> <?php $moneys = (int) round(str_replace("-","",$_POST['money2'])); if ($moneys > $bank['bMONEY']) { ?> <font color="#FF0000">[b]ERROR[/b]</font> You don't have that much money. <?php } elseif ($moneys < 1) { ?> <font color="#FF0000">[b]ERROR[/b]</font> You must enter a proper amount. <?php } else { $moneys = (int) $moneys; ?> You sucessfully withdrew $<?php echo number_format($moneys); ?>. <?php $query = " UPDATE users, uBANK SET users.money = users.money + $moneys, uBANK.bMONEY = uBANK.bMONEY - $moneys WHERE users.userid = '".$userid."' AND uBANK.bUID = '".$userid."'" ; // chkSQL($query); mysql_query($query); } ?> [url="<?php echo $_SERVER['PHP_SELF']; ?>"]Go Back[/url] </td> </tr> </table> <?php } elseif ($_POST['withdraw'] && $_POST['crystals2']) { ?> <table width="95%" style="border: 1px solid #000000;"> <tr class="indextr"> <td class="index1">[b]<?php echo $set['game_name']; ?> Bank[/b]</td> </tr> <tr> <td class="infobox2"> <?php $crystals = (int) round(str_replace("-","",$_POST['crystals2'])); if ($crystals > $bank['bCRYSTAL']) { ?> <font color="#FF0000">[b]ERROR[/b]</font> You don't have that many crystals. <?php } elseif ($crystals < 1) { ?> <font color="#FF0000">[b]ERROR[/b]</font> You must enter a proper amount. <?php } else { $crystals = (int) $crystals; ?> You sucessfully withdrew <?php echo number_format($crystals); ?> crystal(s). <?php $query = " UPDATE users, uBANK SET users.crystals = users.crystals + $crystals, uBANK.bCRYSTAL = uBANK.bCRYSTAL - $crystals WHERE users.userid = '".$userid."' AND uBANK.bUID = '".$userid."'" ; // chkSQL($query); mysql_query($query); } ?> [url="<?php echo $_SERVER['PHP_SELF']; ?>"]Go Back[/url] </td> </tr> </table> <?php } $h->endpage(); ?>   Crons <?php /* daily cron to reset deposits to daily value */ $db->query("UPDATE `uBANK` SET `bDEPOSIT` = `bMAXDEP`"); /* cron to give interest! */ $db->query("UPDATE `uBANK` SET `bMONEY` = `bMONEY` + floor(`bINTEREST` * `bMONEY` / 100) WHERE `bMONEY` > 100"); ?>   Have phun!
  7. i don't want to sound rude, though the best way to fix it is... first remove the uneeded stuff then look into the real problem if it still persists...
  8. at a quick glance... the delete i suppose is for staff only right? so you will need at least 2 more if's there before generating the links. on the image thing it looks you are missing some closing ' or . to display the image properly.
  9. extra links ought to work just fine if you add them on the right place. somewhere along the $link variable.
  10. Bump it to top?
  11. @Danny: your query is exactly the same (yet tidier) so it won't make a a difference.
  12. hmmm... GameIP field type is... INT? if it is... there lays your problem. change it to VARCHAR(15) and you might have your issue solved...
  13. the original code ought to work... unless table is gameip (which i believe it is) and you are calling Gameip... Tables are case sensitive in most cases... also one minor detail... echo "Ip set to"; echo make_ip(); you are echoing one fake IP that ought to be set off though you already had one... so the correct line there ought to be... echo "Ip set to ".$gip;
  14. Signed up for CE
  15. Lithium

    CSS Questions

    well... i'm not fancy with html/css/design, though, any of those could be applied inside a div or even a table, making it the size you want... someone correct me here if i am wrong...
  16. Lithium

    CSS Questions

    @ Lilith: the example given by DJK is what you are looking for, you got a few ones here... http://www.noupe.com/javascript/37-great-ajax-css-tab-based-interfaces.html
  17. It matters a lot if you are native english, and for what i have seen around those who bitch are mostly english native speakers. I must agree with Pudda... who cares about how it is written, as long as the message passes by? Also, and most important, there are quite a lot of users from other places where english is far from being native and english might just be a bit too difficult to express the ideas, so why not putting as they know and hopefully the message will pass by when someone understands what is asked! And let's go to the unprofessionalism (Yes Dave it's about you), you do have a "real big issue" with people typing as it sounds, but before you bitch about it or even trying to correct, look at your own posts on a not so long time ago, and see the same things you bitch about these days. And don't even bother to correct my english as it is not my native language and i really don't give a **** if either the grammar is incorrect or if it looks unprofessional.
  18. I haven't been been around for 6 month or more, and well, for the past hours looking around the forum, and throughout the latest posts... honestly... there is nothing that catches my eye to be around much more. Had my handfull of quirrels, some good some not that good, helped (or i think i did) a few guys/girls around. But as i stated... at this point... the forum seems too much "dead" and entering into a limbo... As a quick reply to OP questions... 1. No 2. No idea as for this moment 3. I noticed a huge clean up on posts, or i missed the place where they where, if they were deleted... minus to that, if they were simply moved, minus to me as i can't seem to find them :) Cheers, Pedro
  19. yet simpler is to chmod the directory as 664
  20. Jquery has a few tools to do the trick, resizing the images evenly, so you can use them throughout any resolution. Check the here... http://plugins.jquery.com/plugin-tags/image-resize
  21. As a_bertrand pointed correctly, foreign keys are way slower, and also as he stated, myisam and memory tables are one way to go, though you can still (should) use InnoDB for "static" (the ones that usually have very little updates/inserts/deletes) tables. That if you are performance concerned! So a mix on the 3 would be the perfect choice, MyIsam, InnoDB and Memory!
  22. echo $weapon = ($wep['itmname']) ? $wep['itmname'] : 'Fists';   Same as Bama's though a bit cleaner! :)
  23. Despite the sense of security, i must say that this will fail, mainly if you are going to deal with GIF images. Arbitrary code can be placed inside the image, still making a valid image file and it will get executed as soon as the file is called. You ought to consider allowing users to upload their own images and then locking with .htaccess the execution of any code from within the upload directory, with something along these lines... Order allow,deny allow from all <FilesMatch "\.php$"> deny from all </FilesMatch>   The given example goes to php, yet you can expand it for whatsoever your host allows to execute!
  24. $db->query(sprintf("DELETE FROM cars_inv WHERE (CI_ID = %d) AND (CI_USERID = %d)", $_GET['ID'], $ir['useird'])); $ir['userid'] not $ir['useird'] That seems to be the only problem at sight, other than that please post the error!
  25. @wrx It seems that somehow, there's something missing on the whole you placed... as it simply opens the min file as it was the regular one! If you could point out on the right direction that would be great. my knowledge on jquery is way far limited to help out on this!
×
×
  • Create New...