
newttster
Members-
Posts
513 -
Joined
-
Last visited
-
Days Won
14
Content Type
Profiles
Forums
Events
Everything posted by newttster
-
Thanks. That worked. Any suggestions on why the ID of the player does not show. if($r['laston'] >= time()-15*60) { $on="<font color=green><b>Online</b></font>"; } else { $on="<font color=red><b>Offline</b></font>"; } print "<h3>Profile for {$r['username']}</h3> <table width=100% cellspacing=1 class='table'><tr style='background:gray'><th>General Info</th><th>Financial Info</th> <th>Display Pic</th></tr> <tr><td>Name: {$r['username']} [{$r['userid']}] $d<br /> User Level: $userl<br /> Duties: {$r['duties']}<br /> Gender: {$r['gender']}<br /> Signed Up: $sup<br /> Last Active: $lon<br />
-
When I add an NPC or another player I am getting an error message when I go to view that profile. The weird thing is it only does this when added via the staff page. If I add them through the normal register page they show up just fine. Any ideas? Error messge: Referals: QUERY ERROR: 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 '' at line 1 Query was SELECT * FROM referals WHERE refREFER= Signed Up: $sup<br /> Last Active: $lon<br /> Last Action: $str<br /> Last Login: $str2<br /> Online: $on<br /> Days Old: {$r['daysold']}<br /> Location: {$r['cityname']}</td><td> Money: {$fm}<br /> Crystals: {$r['crystals']}<br /> Property: {$r['hNAME']}<br /> Referals: "; $rr=$db->query("SELECT * FROM referals WHERE refREFER={$r['userid']}"); print $db->num_rows($rr); print "<br /> Marital Status: "; if ($r['marriage']) { $part=$db->query("SELECT * FROM users WHERE userid={$r['marriage']}"); $pr=$db->fetch_row($part); print "Married to <a href='viewuser.php?u={$pr['userid']}'>{$pr['username']}</a>"; } else { print "Single"; } print "<br /> Friends: {$r['friend_count']}<br /> Enemies: {$r['enemy_count']} </td> <td>";
-
Try doing your checks before your switch statement.
-
I'm not sure but couldn't you do something with a drop down for the colours and the letters. Click the alphabet drop down, choose letter A then click the colour drop down, choose your colour, then do an update.
-
Well hell! *laughs* Believe it or not ... I did search for something like this before trying to write this and did not see yours. All those hours. *sighs* Oh well back to the drawing board and trying to write some more.
-
It's not all that different from the cyber bank, no. It just gives you more options for different accounts. And of course the interest is different as well.
-
Part Four #----------------------Begin Master Account Functions---------------------------------------------------------------------# #----this function confirms if they want to open an account------# function conf_open_ma() { global $db,$ir,$c,$userid,$h; if($ir['cybermoneysa']<100000000) { echo "You have not reached \$100,000,000.00 or more in your Senior Bank Account.<br /> You have to have a minimum of \$100,000,000.00 in your Senior Bank Account before opening a Master Bank Account.<br /> <a href='banking.php'>Back to the bank.</a><br /> <a href='explore.php'>Back to town.</a><br />"; $h->endpage(); exit; } if($ir['maacct']=="closed") { echo "Are you sure you want to open a Master Bank Account today?<br /> It will cost you \$1,000,000.00 to do so.<br /> <a href='banking.php?action=openma2'>Yes</a> OR <a href='banking.php'>No</a>"; } else { echo "You already have a Master Bank Account. <br /> Why are you trying to open another one?<br /> <a href='banking.php'>Back to the bank.</a><br /> <a href='explore.php'>Back to town.</a><br />"; } } #----this function confirms opening the account------# function do_open_ma() { global $db, $ir, $c; if ($ir['money'] >= 1000000) { echo "Congratulations! You've opened a Master Bank Account for $1,000,000.00.<br /> You will earn 0.25% on your balance daily.<br > If you have a MBA Investment Certificate you will earn 1%.<br /> <a href='banking.php?action=mabanking'>Begin using my account now.</a>"; $db->query("UPDATE `users` SET `money` = `money` - '50000', `cybermoneyma` = '0', `maacct` = 'open' WHERE `userid` = '{$ir['userid']}'", $c) or die ((($ir['user_level'] == 2) ? mysql_error() : 'Error in mysql query')); } else { echo "You don't have enough money available to open a Master Bank Account at this time.<br /><br /> <a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a>"; } } #----this function determines if they want to deposit or withdraw-----# function conf_ma_banking() { global $db,$ir,$c,$userid,$h; echo "<h3>What would you like to do with your Master Bank Account today?</h3><br />"; echo "\n<b>You currently have \${$ir['cybermoneyma']} in the bank.</b><br /><br /> <table width='75%' border='2'> <tr> <td width='50%'><b>Deposit Money</b><br /> <form action='banking.php?action=depositma' method='post'> Amount: <input type='text' name='depositma' value='{$ir['money']}' /><br /> <input type='submit' value='Deposit' /></form></td> <td> <b>Withdraw Money</b><br /> <form action='banking.php?action=withdrawma' method='post'> Amount: <input type='text' name='withdrawma' value='{$ir['cybermoneyma']}' /><br /> <input type='submit' value='Withdraw' /></form></td> </tr> </table>"; echo "<br /><br /> Changed your mind about banking?<br /><br /><a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a>"; } #---deposit function-------# function deposit_ma() { global $db,$ir,$c,$userid,$h; $_POST['depositma']=abs((int)$_POST['depositma']); if($_POST['depositma']>($ir['money'])) { echo "You don't have enough money to deposit this amount.<br /> <a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a><br />"; $h->endpage(); exit; } if($ir['maacct']=="closed") { echo "You have not opened a Master Bank Account yet.<br /> <a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a><br />"; } else { $gain=$_POST['depositma']; $ir['cybermoneyma']+=$gain; $db->query("UPDATE `users` SET `cybermoneyma`=`cybermoneyma`+'$gain', `money`=`money`-'{$_POST['depositma']}' where `userid`='$userid'", $C); echo "You hand over \${$_POST['depositma']} to be deposited. <br /> <b>You now have \${$ir['cybermoneyma']} in your Master Bank Account.</b><br /> <a href='banking.php'>Continue banking</a><br /> <a href='explore.php'>Back to town</a>"; } } #----withdraw function------# function withdraw_ma() { global $db,$ir,$c,$userid,$h; $_POST['witdhrawma']=abs((int)$_POST['withdrawma']); if(($_GET['withdrawma'])>$ir['cybermoneyma']) { echo "You don't have enough money in your Master Bank Account to withdraw this amount.<br /> <a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a><br />"; $h->endpage(); exit; } if ($ir['maacct']=="closed") { echo "You can't withdraw money from an account that you have not opened yet.<br /> <a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a><br />"; } else $gain=$_POST['withdrawma']; $ir['cybermoneyma']-=$gain; $db->query("UPDATE `users` SET `cybermoneyma`=`cybermoneyma`-'$gain', `money`=`money`+'{$_POST['withdrawma']}' where `userid`='$userid'", $C); echo "The teller hands you \${$_POST['withdrawma']}. <br /> <b>You now have \${$ir['cybermoneyma']} in your Master Bank Account.</b><br /> <a href='banking.php'>Continue banking</a><br /> <a href='explore.php'>Back to town</a>"; } #-----------------------------End Master Account Functions------------------------------------# #-------if they already have accounts open this brings them to the deposit/withdraw functions----# function accts_open() { global $db,$ir,$c,$userid,$h; echo "<h3>Which account do you want to work with today?</h3></br>; <a href='banking.php?action=babanking'>Starter Bank Account.</a><br /> <a href='banking.php?action=jabanking'>Junior Bank Account.</a><br /> <a href='banking.php?action=sabanking'>Senior Bank Account.</a><br /> <a href='banking.php?action=mabanking'>Master Bank Account.</a><br />"; } $h->endpage(); ?>
-
Part Three #----------------------Begin Junior Account Functions---------------------------------------------------------------------# #----this function confirms if they want to open an account------# function conf_open_ja() { global $db,$ir,$c,$userid,$h; if($ir['cybermoneyba']<10000000) { echo "You have not reached \$10,000,000.00 or more in your Starter Bank Account.<br /> You have to have a minimum of \$10,000,000.00 in your Starter Bank Account before opening a Junior Bank Account.<br /> <a href='banking.php'>Back to the bank.</a><br /> <a href='explore.php'>Back to town.</a><br />"; $h->endpage(); exit; } if($ir['juacct']=="closed") { echo "Are you sure you want to open a Junior Bank Account today?<br /> It will cost you \$50,000.00 to do so.<br /> <a href='banking.php?action=openja2'>Yes</a> OR <a href='banking.php'>No</a>"; } else { echo "You already have a Junior Bank Account. <br /> Why are you trying to open another one?<br /> <a href='banking.php'>Back to the bank.</a><br /> <a href='explore.php'>Back to town.</a><br />"; } } #----this function confirms opening the account------# function do_open_ja() { global $db, $ir, $c; if ($ir['money'] >= 50000) { echo "Congratulations! You've opened a Junior Bank Account for $50,000.00.<br /> You will earn 0.75% on your balance daily.<br > If you have a JBA Investment Certificate you will earn 3%.<br /> If you have <u>more than</u> \$50,000,000.00 in your account you will <u>NOT</u> earn any interest.<br /> <a href='banking.php?action=jabanking'>Begin using my account now.</a>"; $db->query("UPDATE `users` SET `money` = `money` - '50000', `cybermoneyja` = '0', `juacct` = 'open' WHERE `userid` = '{$ir['userid']}'", $c) or die ((($ir['user_level'] == 2) ? mysql_error() : 'Error in mysql query')); } else { echo "You don't have enough money available to open a Junior Bank Account at this time.<br /><br /> <a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a>"; } } #----this function determines if they want to deposit or withdraw-----# function conf_ja_banking() { global $db,$ir,$c,$userid,$h; echo "<h3>What would you like to do with your Junior Bank Account today?</h3><br />"; echo "\n<b>You currently have \${$ir['cybermoneyja']} in the bank.</b><br /><br /> <table width='75%' border='2'> <tr> <td width='50%'><b>Deposit Money</b><br /> <form action='banking.php?action=depositja' method='post'> Amount: <input type='text' name='depositja' value='{$ir['money']}' /><br /> <input type='submit' value='Deposit' /></form></td> <td> <b>Withdraw Money</b><br /> <form action='banking.php?action=withdrawja' method='post'> Amount: <input type='text' name='withdrawja' value='{$ir['cybermoneyja']}' /><br /> <input type='submit' value='Withdraw' /></form></td> </tr> </table>"; echo "<br /><br /> Changed your mind about banking?<br /><br /><a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a>"; } #---deposit function-------# function deposit_ja() { global $db,$ir,$c,$userid,$h; $_POST['depositja']=abs((int)$_POST['depositja']); if($_POST['depositja']>($ir['money'])) { echo "You don't have enough money to deposit this amount.<br /> <a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a><br />"; $h->endpage(); exit; } if($ir['juacct']=="closed") { echo "You have not opened a Junior Bank Account yet.<br /> <a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a><br />"; } else { $gain=$_POST['depositja']; $ir['cybermoneyja']+=$gain; $db->query("UPDATE `users` SET `cybermoneyja`=`cybermoneyja`+'$gain', `money`=`money`-'{$_POST['depositja']}' where `userid`='$userid'", $C); echo "You hand over \${$_POST['depositja']} to be deposited. <br /> <b>You now have \${$ir['cybermoneyja']} in your Junior Bank Account.</b><br /> <a href='banking.php'>Continue banking</a><br /> <a href='explore.php'>Back to town</a>"; } } #----withdraw function------# function withdraw_ja() { global $db,$ir,$c,$userid,$h; $_POST['witdhrawja']=abs((int)$_POST['withdrawja']); if(($_GET['withdrawja'])>$ir['cybermoneyja']) { echo "You don't have enough money in your Junior Bank Account to withdraw this amount.<br /> <a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a><br />"; $h->endpage(); exit; } if ($ir['juacct']=="closed") { echo "You can't withdraw money from an account that you have not opened yet.<br /> <a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a><br />"; } else $gain=$_POST['withdrawja']; $ir['cybermoneyja']-=$gain; $db->query("UPDATE `users` SET `cybermoneyja`=`cybermoneyja`-'$gain', `money`=`money`+'{$_POST['withdrawja']}' where `userid`='$userid'", $C); echo "The teller hands you \${$_POST['withdrawja']}. <br /> <b>You now have \${$ir['cybermoneyja']} in your Junior Bank Account.</b><br /> <a href='banking.php'>Continue banking</a><br /> <a href='explore.php'>Back to town</a>"; } #-----------------------------End Junior Account Functions------------------------------------# #----------------------Begin Senior Account Functions---------------------------------------------------------------------# #----this function confirms if they want to open an account------# function conf_open_sa() { global $db,$ir,$c,$userid,$h; if($ir['cybermoneyja']<50000000) { echo "You have not reached \$50,000,000.00 or more in your Junior Bank Account.<br /> You have to have a minimum of \$50,000,000.00 in your Junior Bank Account before opening a Senior Bank Account.<br /> <a href='banking.php'>Back to the bank.</a><br /> <a href='explore.php'>Back to town.</a><br />"; $h->endpage(); exit; } if($ir['seacct']=="closed") { echo "Are you sure you want to open a Senior Bank Account today?<br /> It will cost you \$100,000.00 to do so.<br /> <a href='banking.php?action=opensa2'>Yes</a> OR <a href='banking.php'>No</a>"; } else { echo "You already have a Senior Bank Account. <br /> Why are you trying to open another one?<br /> <a href='banking.php'>Back to the bank.</a><br /> <a href='explore.php'>Back to town.</a><br />"; } } #----this function confirms opening the account------# function do_open_sa() { global $db, $ir, $c; if ($ir['money'] >= 100000) { echo "Congratulations! You've opened a Senior Bank Account for $100,000.00.<br /> You will earn 0.5% on your balance daily.<br > If you have a SeBA Investment Certificate you will earn 2%.<br /> If you have <u>more than</u> \$100,000,000.00 in your account you will <u>NOT</u> earn any interest.<br /> <a href='banking.php?action=sabanking'>Begin using my account now.</a>"; $db->query("UPDATE `users` SET `money` = `money` - '50000', `cybermoneysa` = '0', `seacct` = 'open' WHERE `userid` = '{$ir['userid']}'", $c) or die ((($ir['user_level'] == 2) ? mysql_error() : 'Error in mysql query')); } else { echo "You don't have enough money available to open a Senior Bank Account at this time.<br /><br /> <a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a>"; } } #----this function determines if they want to deposit or withdraw-----# function conf_sa_banking() { global $db,$ir,$c,$userid,$h; echo "<h3>What would you like to do with your Senior Bank Account today?</h3><br />"; echo "\n<b>You currently have \${$ir['cybermoneysa']} in the bank.</b><br /><br /> <table width='75%' border='2'> <tr> <td width='50%'><b>Deposit Money</b><br /> <form action='banking.php?action=depositsa' method='post'> Amount: <input type='text' name='depositsa' value='{$ir['money']}' /><br /> <input type='submit' value='Deposit' /></form></td> <td> <b>Withdraw Money</b><br /> <form action='banking.php?action=withdrawsa' method='post'> Amount: <input type='text' name='withdrawsa' value='{$ir['cybermoneysa']}' /><br /> <input type='submit' value='Withdraw' /></form></td> </tr> </table>"; echo "<br /><br /> Changed your mind about banking?<br /><br /><a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a>"; } #---deposit function-------# function deposit_sa() { global $db,$ir,$c,$userid,$h; $_POST['depositsa']=abs((int)$_POST['depositsa']); if($_POST['depositsa']>($ir['money'])) { echo "You don't have enough money to deposit this amount.<br /> <a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a><br />"; $h->endpage(); exit; } if($ir['seacct']=="closed") { echo "You have not opened a Senior Bank Account yet.<br /> <a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a><br />"; } else { $gain=$_POST['depositsa']; $ir['cybermoneysa']+=$gain; $db->query("UPDATE `users` SET `cybermoneysa`=`cybermoneysa`+'$gain', `money`=`money`-'{$_POST['depositsa']}' where `userid`='$userid'", $C); echo "You hand over \${$_POST['depositsa']} to be deposited. <br /> <b>You now have \${$ir['cybermoneysa']} in your Senior Bank Account.</b><br /> <a href='banking.php'>Continue banking</a><br /> <a href='explore.php'>Back to town</a>"; } } #----withdraw function------# function withdraw_sa() { global $db,$ir,$c,$userid,$h; $_POST['witdhrawsa']=abs((int)$_POST['withdrawsa']); if(($_GET['withdrawsa'])>$ir['cybermoneysa']) { echo "You don't have enough money in your Senior Bank Account to withdraw this amount.<br /> <a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a><br />"; $h->endpage(); exit; } if ($ir['seacct']=="closed") { echo "You can't withdraw money from an account that you have not opened yet.<br /> <a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a><br />"; } else $gain=$_POST['withdrawsa']; $ir['cybermoneysa']-=$gain; $db->query("UPDATE `users` SET `cybermoneysa`=`cybermoneysa`-'$gain', `money`=`money`+'{$_POST['withdrawsa']}' where `userid`='$userid'", $C); echo "The teller hands you \${$_POST['withdrawsa']}. <br /> <b>You now have \${$ir['cybermoneysa']} in your Senior Bank Account.</b><br /> <a href='banking.php'>Continue banking</a><br /> <a href='explore.php'>Back to town</a>"; } #-----------------------------End Senior Account Functions------------------------------------#
-
Part Two function banking_home() { global $db,$ir,$c,$userid,$h; if ($ir['stacct']=="closed") { echo "<h2>Your Financial Trust</h2><br /> <h4><u>What would you like to do today?</u></h4> <a href='banking.php?action=openba'>Open a Starter Bank Account today</a><br /> <a href='banking.php?action=openja'>Open a Junior Bank Account today</a><br /> <a href='banking.php?action=opensa'>Open a Senior Bank Account today</a><br /> <a href='banking.php?action=openma'>Open a Master Bank Account today</a><br /> <u>If you already have any accounts that are open and wish to use them,</u> <br /> <a href='banking.php?action=acctsopen'>ENTER HERE<a/<br /><br /><br /> <u>Changed your mind?</u><br /> <a href='explore.php'>Go back to town.</a><br />"; } elseif ($ir['juacct']=="closed") { echo "<h2>Your Financial Trust</h2><br /> <h4><u>What would you like to do today?</u></h4> <a href='banking.php?action=openja'>Open a Junior Bank Account today</a><br /> <a href='banking.php?action=opensa'>Open a Senior Bank Account today</a><br /> <a href='banking.php?action=openma'>Open a Master Bank Account today</a><br /> <u>If you already have any accounts that are open and wish to use them,</u> <br /> <a href='banking.php?action=acctsopen'>ENTER HERE<a/<br /><br /><br /> <u>Changed your mind?</u><br /> <a href='explore.php'>Go back to town.</a><br />"; } elseif ($ir['seacct']=="closed") { echo "<h2>Your Financial Trust</h2><br /> <h4><u>What would you like to do today?</u></h4> <a href='banking.php?action=opensa'>Open a Senior Bank Account today</a><br /> <a href='banking.php?action=openma'>Open a Master Bank Account today</a><br /> <u>If you already have any accounts that are open and wish to use them,</u> <br /> <a href='banking.php?action=acctsopen'>ENTER HERE<a/<br /><br /><br /> <u>Changed your mind?</u><br /> <a href='explore.php'>Go back to town.</a><br />"; } elseif ($ir['maacct']=="closed") { echo "<h2>Your Financial Trust</h2><br /> <h4><u>What would you like to do today?</u></h4> <a href='banking.php?action=openma'>Open a Master Bank Account today</a><br /> <u>If you already have any accounts that are open and wish to use them,</u> <br /> <a href='banking.php?action=acctsopen'>ENTER HERE<a/<br /><br /><br /> <u>Changed your mind?</u><br /> <a href='explore.php'>Go back to town.</a><br />"; } else { echo "<h3>Which account do you want to work with today?</h3></br>; <a href='banking.php?action=babanking'>Starter Bank Account.</a><br /> <a href='banking.php?action=jabanking'>Junior Bank Account.</a><br /> <a href='banking.php?action=sabanking'>Senior Bank Account.</a><br /> <a href='banking.php?action=mabanking'>Master Bank Account.</a><br />"; } } function conf_open_ba() { global $db,$ir,$c,$userid,$h; if($ir['stacct']=="closed") { echo "Are you sure you want to open a Starter Bank Account today?<br /> It will cost you \$10,000.00 to do so.<br /> <a href='banking.php?action=openba2'>Yes</a> OR <a href='banking.php'>No</a>"; } else { echo "You already have a Starter Bank Account. <br /> Why are you trying to open another one?<br /> <a href='banking.php'>Back to the bank.</a><br /> <a href='explore.php'>Back to town.</a><br />"; } } function do_open_ba() { global $db, $ir, $c; if ($ir['money'] >= 10000) { echo "Congratulations! You've opened a Starter Bank Account for $10,000.00.<br /> You will earn 1% on your balance daily.<br > If you have a StBA Investment Certificate you will earn 4%.<br /> If you have <u>more than</u> \$10,000,000.00 in your account you will <u>NOT</u> earn any interest.<br /> <a href='banking.php?action=babanking'>Begin using my account now.</a>"; $db->query("UPDATE `users` SET `money` = `money` - '10000', `cybermoneyba` = '0', `stacct` = 'open' WHERE `userid` = '{$ir['userid']}'", $c) or die ((($ir['user_level'] == 2) ? mysql_error() : 'Error in mysql query')); } else { echo "You don't have enough money available to open a Starter Bank Account at this time.<br /><br /> <a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a>"; } } function conf_ba_banking() { global $db,$ir,$c,$userid,$h; echo "<h3>What would you like to do with your Starter Bank Account today?</h3><br />"; echo "\n<b>You currently have \${$ir['cybermoneyba']} in the bank.</b><br /><br /> <table width='75%' border='2'> <tr> <td width='50%'><b>Deposit Money</b><br /> <form action='banking.php?action=depositba' method='post'> Amount: <input type='text' name='depositba' value='{$ir['money']}' /><br /> <input type='submit' value='Deposit' /></form></td> <td> <b>Withdraw Money</b><br /> <form action='banking.php?action=withdrawba' method='post'> Amount: <input type='text' name='withdrawba' value='{$ir['cybermoneyba']}' /><br /> <input type='submit' value='Withdraw' /></form></td> </tr> </table>"; echo "<br /><br />Changed your mind about banking?<br /><br /><a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a>"; } function deposit_ba() { global $db,$ir,$c,$userid,$h; $_POST['depositba']=abs((int)$_POST['depositba']); if($_POST['depositba']>($ir['money'])) { echo "You don't have enough money to deposit this amount.<br /> <a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a><br />"; $h->endpage(); exit; } if($ir['stacct']=="closed") { echo "You have not opened a Starter Bank Account yet.<br /> <a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a><br />"; } else { $gain=$_POST['depositba']; $ir['cybermoneyba']+=$gain; $db->query("UPDATE `users` SET `cybermoneyba`=`cybermoneyba`+'$gain', `money`=`money`-'{$_POST['depositba']}' where `userid`='$userid'", $C); echo "You hand over \${$_POST['depositba']} to be deposited. <br /> <b>You now have \${$ir['cybermoneyba']} in your Starter Bank Account.</b><br /> <a href='banking.php'>Continue banking</a><br /> <a href='explore.php'>Back to town</a>"; } } function withdraw_ba() { global $db,$ir,$c,$userid,$h; $_POST['witdhrawba']=abs((int)$_POST['withdrawba']); if(($_GET['withdrawba'])>$ir['cybermoneyba']) { echo "You don't have enough money in your Starter Bank Account to withdraw this amount.<br /> <a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a><br />"; $h->endpage(); exit; } if ($ir['stacct']=="closed") { echo "You can't withdraw money from an account that you have not opened yet.<br /> <a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a><br />"; } else $gain=$_POST['withdrawba']; $ir['cybermoneyba']-=$gain; $db->query("UPDATE `users` SET `cybermoneyba`=`cybermoneyba`-'$gain', `money`=`money`+'{$_POST['withdrawba']}' where `userid`='$userid'", $c); echo "The teller hands you \${$_POST['withdrawba']}. <br /> <b>You now have \${$ir['cybermoneyba']} in your Starter Bank Account.</b><br /> <a href='banking.php'>Continue banking</a><br /> <a href='explore.php'>Back to town</a>"; }
-
This is a mod I wrote to replace cyberbank.php. I couldn't have done it without the help of SomeRandomBastard and Lithium. Thank you! It's fairly long so I will break it up. I tested it fully on my game and it works there, however, if you find any errors, please let me know and I will do my best to help fix it. And as always you can change the names to suit your game. First the table entries. ALTER table users ADD cybermoneyba int(11) NOT NULL default '-1'; ALTER table users ADD cybermoneyja int(11) NOT NULL default '-1'; ALTER table users ADD cybermoneysa int(11) NOT NULL default '-1'; ALTER table users ADD cybermoneymba int(11) NOT NULL default '-1'; ALTER table users ADD stacct enum('open','closed') NOT NULL default 'closed'; ALTER table users ADD juacct enum('open','closed') NOT NULL default 'closed'; ALTER table users ADD seacct enum('open','closed') NOT NULL default 'closed'; ALTER table users ADD maacct enum('open','closed') NOT NULL default 'closed'; Part One <?php include "globals.php"; switch ($_GET['action']) { case "openba": conf_open_ba(); break; case 'openba2': do_open_ba(); break; case 'babanking': conf_ba_banking(); break; case 'depositba': deposit_ba(); break; case 'withdrawba': withdraw_ba(); break; case 'openja': conf_open_ja(); break; case 'openja2': do_open_ja(); break; case 'jabanking': conf_ja_banking(); break; case 'depositja': deposit_ja(); break; case 'withdrawja': withdraw_ja(); break; case 'opensa': conf_open_sa(); break; case 'opensa2': do_open_sa(); break; case 'sabanking': conf_sa_banking(); break; case 'depositsa': deposit_sa(); break; case 'withdrawsa': withdraw_sa(); break; case 'openma': conf_open_ma(); break; case 'openma2': do_open_ma(); break; case 'mabanking': conf_ma_banking(); break; case 'depositma': deposit_ma(); break; case 'withdrawma': withdraw_ma(); break; case 'acctsopen': accts_open(); break; default: banking_home(); break; }
-
Thank you, Lithium ... that did it. Thank you everyone for your help with this. Once I have the whole mod worked out ... I will be putting it up as a free one as a payback for the help. I know for the ones who helped me, it won't be worth much to you but I believe in paying forward ... so thanks again.
-
Thank you so much for all of your help on this. It is all working fantastically now. Can you explain to me why it is depositing or withdrawing more than what it should? For example if I have $10,000 ($ir['money']) out I can enter $110,000 ($ir['cybermoneyba']) and it will deposit that amount to the Starter Account leaving me with a $100,000 ($ir['money'])deficit in the cash on hand. It does the same with the withdraw as well. I can have $50,000 ($ir['cybermoneyba']) and yet I can withdraw $100,000 from the cyber account leaving me with a deficit of $50,000 in the Starter Account. In the code I have it set up with the if statement ... if($_POST['depositba']>($ir['money'])) ... and the error message and it does post the error message. Obviously I am missing something here ... but I don't know what it is. Any ideas?
-
That worked perfectly as well. Thank you once again. It deposits the money correctly. It also withdraws the money correctly ... but I am getting the below error message on the withdraw_ba function. Which is weird considering the function does what it is supposed to do. QUERY ERROR: 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 ' money=money+ WHERE userid=42' at line 1 Query was UPDATE users SET cybermoneyba = cybermoneyba-, money=money+ WHERE userid=42
-
Oh crap! Just give me the Herpa Derp award now and get it over with. *laughs* They would be either the deposit_ba function or the withdraw_ba function. Sorry about that.
-
That worked perfectly ... it now sets the account to open and cybermoneyba to 0. Which is fantastic. Thank you so much. Now I am getting another issue. *facepalms* When I try and use the deposit/withdraw function it tells me "You can't deposit/withdraw money from an account that you have not opened yet."
-
@gupreet ... I have tried the two options that you have suggested as well. Neither worked. Though I do thank you for that. @SomeRandomBastard ... okay ... it does change stacct to open once I run the query through phpmyadmin. I also verified on my users table that the enum () is lower case.
-
I am trying to get a mod that I am working on to work ... and it does ... sort of. The code that I am posting is part and parcel of a much larger mod, however, if I can't get this to work the rest won't. I don't get any error messages. In the function do_open-ba ... it is not switching the status of the account from closed to open. On my users table I have it set up as enum with closed being the default. Any suggestions as to how I can fix this? <?php include "globals.php"; switch ($_GET['action']) { case "openba": conf_open_ba(); break; case 'openba2': do_open_ba(); break; case 'babanking': conf_ba_banking(); break; case 'depositba': deposit_ba(); break; case 'withdrawba': withdraw_ba(); break; case 'acctsopen': accts_open(); break; default: banking_home(); break; } #-----------------------------------------------------# #----this is the defalt function--------# function banking_home() { global $db,$ir,$c,$userid,$h; echo "<h3>Financial Trust</h3><br /><br /> <a href='banking.php?action=openba'>Open a Starter Bank Account today</a><br /> If you already have any accounts that are open and wish to use them, <a href='banking.php?action=acctsopen'>ENTER HERE<a/<br /><br /> <a href='explore.php'>Changed your mind? Go back to town.</a><br />"; } #----this function confirms if they want to open an account------# function conf_open_ba() { global $db,$ir,$c,$userid,$h; if($ir['stacct']=="closed") { echo "Are you sure you want to open a Starter Bank Account today?<br /> <a href='banking.php?action=openba2'>Yes</a> OR <a href='banking.php'>No</a>"; } else { echo "You already have a Starter Bank Account. Why are you trying to open another one?<br /> <a href='banking.php'>Back to the bank.</a><br /> <a href='explore.php'>Back to town.</a><br />"; } } #----this function confirms opening the account------# function do_open_ba() { global $db,$ir,$c,$userid,$h; if ($ir['money']>9999) { echo "Congratulations! You've opened a Starter Bank Account for \$10,000.00.<br /> You will earn 1% on your balance daily. If you have a SBA Investment Certificate you will earn 4%.<br /> If you have <b>more than</b> \$10,000,000.00 in your account you will <b>not</b> earn any interest.<br /> <a href='banking.php?action=babanking'>Begin using my account now.</a><br />"; $db->query("UPDATE users SET stacct='open' WHERE userid=$userid"); $db->query("UPDATE users SET money=money-10000, cybermoneyba=0 WHERE userid=$userid"); } else { echo "You don't have enough money available to open a Starter Bank Account at this time.<br /> <a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a><br />"; } } #----this function determines whether they want to deposit or withdraw------# function conf_ba_banking() { global $db,$ir,$c,$userid,$h; echo "What would you like to do today?<br /> <a href='banking.php?action=depositba'>Deposit</a></br /> <a href='banking.php?action=withdrawba'>Withdraw</a><br />"; } #---deposit function-------# function deposit_ba() { global $db,$ir,$c,$userid,$h; $_POST['depositba']=abs((int)$_POST['depositba']); if($_POST['depositba']>$ir['money']) { echo "You don't have enough money to deposit this amount.<br /> <a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a><br />"; } if($ir['stacct']='closed') { echo "You have not opened a Starter Bank Account yet.<br /> <a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a><br />"; } else { echo "You currently have \${$ir['cybermoneyba']} in your Starter Bank Account.<br /> <table width='75%' cellspacing=1 class='table'> <tr><td width='50%'>Deposit Money<br /> <form action='banking.php?action=depositba' method='POST'> Amount: <input type='text' name='depositba' value='{$ir['money']}/><br /> <input type='submit' value='Deposit'/> </form></td></tr></table><br />"; $gain=$_POST['depositba']; $db->query ("UPDATE users SET cybermoneyba = cybermoneyba+$gain, money=money-{$_POST['depositba']} WHERE userid=$userid"); echo "You give the teller \${$_POST['depositba']}.<br /> You now have \${$ir['cybermoneyba']} in your Starter Bank Account.<br /> <a href='banking.php'>Continue banking.</a><br /> <a href='explore.php'>Go back to town.</a><br />"; } } #----withdraw function------# function withdraw_ba() { global $db,$ir,$c,$userid,$h; $_POST['witdhrawba']=abs((int)$_POST['withdrawba']); if(($_POST['withdrawba'])>$ir['cybermoneyba']) { echo "You don't have enough money in your Starter Bank Account to withdraw this amount.<br /> <a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a><br />"; } if ($ir['stacct']='closed') { echo "You can't withdraw money from an account that you have not opened yet.<br /> <a href='banking.php'>Back to the bank</a><br /> <a href='explore.php'>Back to town</a><br />"; } else { echo "You currently have \${$ir['cybermoneyba']} in your Starter Bank Account.<br /> <table width='75%' cellspacing=1 class='table'> <tr><td width='50%'>Withdraw Money<br /> <form action='banking.php?action=withdrawba' method='POST'> Amount: <input type='text' name='withdrawba' value='{$ir['cybermoneyba']}/><br /> <input type='submit' value='Withdraw'/> </form></td></tr></table><br />"; $gain=$_POST['withdrawba']; $db->query ("UPDATE users SET cybermoneyba = cybermoneyba-$gain, money=money+{$_POST['withdrawba']} WHERE userid=$userid"); echo "The teller gives you \${$_POST['withdrawba']}.<br /> You now have \${$ir['cybermoneyba']} left in your Starter Bank Account.<br /> <a href='banking.php'>Continue banking.</a><br /> <a href='explore.php'>Go back to town.</a><br />"; } } #-------if they already have accounts open this brings them to the deposit/withdraw functions----# function accts_open() { global $db,$ir,$c,$userid,$h; echo "<h3>What would you like to do with your accounts today?<h3></br> <a href='banking.php?action=depositba'>Deposit money to you Starter Bank Account.</a><br /> <a href='banking.php?action=withdrawba'>Withdraw money to you Starter Bank Account.</a><br /> } $h->endpage(); ?>
-
That's all well and good ... but if you are hiring someone to build you a game, can you run it once it has been built. Will you be able to fix any errors that occur? Just curious.
-
I have noticed that the only way that I can get any mods from here into Notepad++ (lately) is to first put it into Word as an html file, then copy it from there into Notepad++. For some reason Notepad++ takes the mod and just writes it as one continual line without line breaks. It does not seem to recognize the formatting of the mods anymore.
-
Thank you so much for your input and the link, Anonymous. This will be a huge help to me. Obviously I will have to play with it ... alot ... until I understand it fully. I am sure that there are others looking for this kind of "upgrade" to crons. Again, thanks ever so much.
-
Thanks everyone. Really appreciate your input on this. @SacreBleu ... I am not having any issues as of yet because I don't have a site running yet ... I just want to configure my game well in advance to try and avoid lag issues that occur from "crons". Basically I want to cure it before it starts. Too often you see numerous complaints in game forums about lag issues. Seems to me that this could obviously be a game killer. @Anonymous ... would it be possible for you to discuss the "last_generated" field option with me via messages? This sounds very interesting. Would this be something like adding a where clause stating only to do said action if user has only been active?
-
I have been reading up on how some people have been using timestamps to replace cron jobs ... http://makewebgames.io/showthread.php/33392-Another-5-minute-cron-removal?highlight=minute http://makewebgames.io/showthread.php/32642-any-version-Removal-of-1-minute-crons/page9?highlight=minute http://makewebgames.io/showthread.php/32949-Crons-Timestamp-or-none?highlight=crons%2C+timestamp http://makewebgames.io/showthread.php/31481-Crons-VS.-Time-Stamp/page2?highlight=crons%2C+timestamp Those are just a few examples ... but I have not been able to find anything where it is stated emphatically which works best with which cron more importantly ... which offers the least amount of lag for your players. Any input on this would be appreciated. Thanks.
-
This is not meant to be sarcastic in any way. My first and foremost thought on this is why would that be one of your first questions. Shouldn't it be something along the lines of what interests you in a game and what keeps you there? Features, layout, support staff etc. Secondly ... I don't think anyone does or should go into designing a text based game hoping to support themselves with it. I have been working on my own game now since November and I have maybe about 10% of it completed, if that. Part of that is due to the fact that I am learning step by step. If you already know php and mysql then you are already way ahead of me. The other part is that I have 2 full time jobs, neither of which allow me to devote the time necessary to complete my "project" and get it out there. Issues to consider (IMO) Can you devote 100% (or close to it) to the game once you have it up and running? Are you willing to give up your full time job to do so? Can you afford to? The reason I ask this is because I have played some games where the owners are only in it for the money and it shows in their attitude. Poor support ... sarcastic answers when asking for help ... that kind of thing. If you are fortunate to find people to help you with your game, such as moderators, game greeters etc that you absolutely trust and that you can give them your personal contact information to that they can call you to elt you know when there are issues AND you have a job that allows you the freedom to respond to the calls then that is fantastic. Otherwise you run the risk of losing players at a very quick rate. Don't get me wrong ... when my game is up and running ... it would be fantastic to see some income from this, even if it's just enough to pay for the server time but my first priority would be to have something that I am proud of and that players enjoy spending their spare time playing and that they know that the support is there if and when needed. If you can accomplish that ... then I think you will see people will be more than willing to make those donations to your game. Any amount would be considered a bonus. Right?
-
Thank you, Nickson. My apologies for posting in the wrong area.
-
I'm trying to understand how tables associate with one another and the question I have is if I set up a users table with 3 field names of char1_id, char2_id, and char3_id and auto_increment them will those id's increment like the userid does? For example the way I would like this to work is like this: Player one enters his info and this is the table userid = 1 char1_id = 1 char2_id = 2 char3_id = 3 Player two enters his info userid = 2 char1_id = 4 char2_id = 5 char3_id = 6 Then to update any tables associated with that character would I then update with a query that references both the userid and the char1_id. ( WHERE userid = userid AND char1_id = char1_id) or would I simply update it with a single WHERE char1_id = char1_id. I want it so that each char has a unque number ... but the 3 chars are then associated with just one unserid. If I do it the way I have written it above ... will that accomplish this.