Jump to content
MakeWebGames

Gungneer

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Gungneer's Achievements

Newbie

Newbie (1/14)

2

Reputation

  1. Aye, that seems like a good idea aswell. XD And yeah, I am planning on rewritting pretty much everything that way it'd be easier for me to edit it future reference, and for debugging.
  2. Edited due to my idiocy. ^_^   JUust a couple questions though, what are the restrictions on a licence? Like, how many domains am I allowed to host the scripts on and stuff? And am I allowed to make a site where I have modded the scripts to allow people to run their own versions of the scripts from a sub domain on my server, and they don't actually get to see any of the source and shit?
  3. fixd... Damn, I've been spending too much time on 4chan. -_- But yeah, I DO know that. ;D
  4. That doens't always happen... Have you seen ThePirateBay? They're still active despite NUMEROUS legal threats, and even a raid or two. XD
  5. Ok, I have a copy of MMCv2 scripts, and I'm currently thinking of making it so I don't actually control teh conten in the game, instead, people sign up and take control of a "version" of the game that would be on a sub domain, so they're the admin and stuff on their version of the game... Already I have a host that supports wildcard sub domains, so I can make it so the games run on "http://subdomain.mydomain.com" but it would resolve to "http://www.mydomain.com" and based on the subdomain used, it would use a differnt database but same set of scripts. My problem, I don't know how to efficiently go about dealing with the DB in such a manner, atleast without making entire new databases for every account, which I kind of don't want to do, so basically, any theoretical help on how I could do this would be superb, but if needed, I could make new databases per account, I just didn't want too for the sake of ease when it comes to implmenting mods so I didn't need to mod every DB... Now, I know that I can make little to no sense in real life, and right now, I'm writting this with noise around me and a headache, so I don't expect this to make much sense, so if anyone needs me to clarify something, just ask. ^_^ DANKE IN ADVANCE! =D
  6. But what would happen if the scripts were hosted on off shore server that specifically says it hosts Warez sites, and Nulled scripts? ;D
  7. Normally if I wasn't feeling so lazy, I would recode shit so it based it on timestamps (mainly for jail and hospital) but since i AM lazy, I jused used the origin script from here, and modded it to work for ALL crons. XD The only thing I've left out just now is teh validate crap, appart from that, it seems to be running fine... Here's my codes... Note: As with all my posts made so far, I don't expect this to work, and don't care if it does or doesn't... I'm really still not sure why I'm posting this crap here. XD ENJOY! Also, ALL credit goes to the genius who started this thread. updates.sql [mysql] CREATE TABLE IF NOT EXISTS `updates` ( `name` varchar(255) NOT NULL default '', `last` int(255) NOT NULL default '60' ) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO `updates` (`name`, `last`) VALUES ('1min', 1273503540), ('5min', 1273503300), ('1hour', 1273500000), ('1day', 1273449600); [/mysql] Add include_once'crons.php'; RIGHT under $db->connect();$c=$db->connection_id; in globals.php crons.php <? include_once'cron_minute.php'; include_once'cron_fivemins.php'; include_once'cron_hour.php'; include_once'cron_day.php'; ?>   cron_minute.php <?php $result = $db->query("SELECT * FROM `updates` WHERE `name` = '1min'"); $result = $db->fetch_row($result); $hla = time() - $result['last']; if($hla > (60)) { $n = floor($hla / 60); $hospital = (1 * $n); $jail = (1 * $n); $query_hos = sprintf("UPDATE users SET hospital = hospital - %u WHERE hospital <> 0", $hospital); $query_jail = sprintf("UPDATE users SET jail = jail - %u WHERE jail <> 0", $jail); $db->query($query_hos); $db->query($query_jail); $db->query("UPDATE `users` SET `hospital` = 0 WHERE `hospital` < 0"); $db->query("UPDATE `users` SET `jail` = 0 WHERE `jail` < 0"); $time = time(); $db->query("UPDATE `updates` SET `last` = ".$time." WHERE `name` = '1min'"); $floor = $time - (floor($time / 60) * 60); if($floor > 0) { $newUpdate = time() - $floor; $db->query("UPDATE `updates` SET `last` = ".$newUpdate." WHERE `name` = '1min'"); } } ?>   cron_fivemins.php <?php $result = $db->query("SELECT * FROM `updates` WHERE `name` = '5min'"); $result = $db->fetch_row($result); $hla = time() - $result['last']; if($hla > (300)) { $n = floor($hla / 300); $brave = (1 * $n); $hp = (1 * $n); $energy = (1 * $n); $energyd = (6 * $n); $will = (10 * $n); //brave update $query="UPDATE users SET brave=brave+((maxbrave/10)+0.5) WHERE brave<maxbrave "; $query2="UPDATE users SET brave=maxbrave WHERE brave>maxbrave"; $query3="UPDATE users SET hp=hp+(maxhp/3) WHERE hp<maxhp"; $query4="UPDATE users SET hp=maxhp WHERE hp>maxhp"; for($x=0;$x<$n;$x++) $db->query($query); $db->query($query2); for($x=0;$x<$n;$x++) $db->query($query3); $db->query($query4); //enerwill update $query="UPDATE users SET energy=energy+(maxenergy/(12.5)) WHERE energy<maxenergy AND donatordays=0"; $query5="UPDATE users SET energy=energy+(maxenergy/(6)) WHERE energy<maxenergy AND donatordays>0"; $query2="UPDATE users SET energy=maxenergy WHERE energy>maxenergy"; $query3="UPDATE users SET will=will+'$will' WHERE will<maxwill"; $query4="UPDATE users SET will=maxwill WHERE will>maxwill"; for($x=0;$x<$n;$x++) $db->query($query); for($x=0;$x<$n;$x++) $db->query($query5); $db->query($query2); $db->query($query3); $db->query($query4); /* if($set['validate_period'] == 5 && $set['validate_on']) { $db->query("UPDATE users SET verified=0"); } if($set['validate_period'] == 15 && $set['validate_on'] && in_array(date('i'),array("00", "15", "30", "45"))) { $db->query("UPDATE users SET verified=0"); } */ $time = time(); $db->query("UPDATE `updates` SET `last` = ".$time." WHERE `name` = '5min'"); $floor = $time - (floor($time / 300) * 300); if($floor > 0) { $newUpdate = time() - $floor; $db->query("UPDATE `updates` SET `last` = ".$newUpdate." WHERE `name` = '5min'"); } } ?>   cron_hour.php <?php $result = $db->query("SELECT * FROM `updates` WHERE `name` = '1hour'"); $result = $db->fetch_row($result); $hla = time() - $result['last']; if($hla > (3600)) { $n = floor($hla / 3600); $gch = (1 * $n); $db->query("UPDATE gangs SET gangCHOURS=gangCHOURS-'$gch' WHERE gangCRIME>0"); $db->query("UPDATE gangs SET gangCHOURS=0 WHERE gangCRIME<0"); $q=$db->query("SELECT g.*,oc.* FROM gangs g LEFT JOIN orgcrimes oc ON g.gangCRIME=oc.ocID WHERE g.gangCRIME > 0 AND g.gangCHOURS = 0"); while($r=$db->fetch_row($q)): $suc=rand(0,1); if($suc): $log=$r['ocSTARTTEXT'].$r['ocSUCCTEXT']; $muny=(int) (rand($r['ocMINMONEY'],$r['ocMAXMONEY'])); $log=str_replace(array("{muny}","'"),array($muny,"''"),$log); $db->query("UPDATE gangs SET gangMONEY=gangMONEY+$muny,gangCRIME=0 WHERE gangID={$r['gangID']}"); $db->query("INSERT INTO oclogs VALUES ('',{$r['ocID']},{$r['gangID']}, '$log', 'success', $muny, '{$r['ocNAME']}', unix_timestamp())"); $i=$db->insert_id(); $qm=$db->query("SELECT * FROM users WHERE gang={$r['gangID']}"); while($rm=$db->fetch_row($qm)): event_add($rm['userid'],"Your Gang's Organised Crime Succeeded. Go [url='oclog.php?ID=$i']here[/url] to view the details.",$c); endwhile; else: $log=$r['ocSTARTTEXT'].$r['ocFAILTEXT']; $muny=0; $log=str_replace(array("{muny}","'"),array($muny,"''"),$log); $db->query("UPDATE gangs SET gangCRIME=0 WHERE gangID={$r['gangID']}"); $db->query("INSERT INTO oclogs VALUES ('',{$r['ocID']},{$r['gangID']}, '$log', 'failure', $muny, '{$r['ocNAME']}', unix_timestamp())"); $i=$db->insert_id(); $qm=$db->query("SELECT * FROM users WHERE gang={$r['gangID']}"); while($rm=$db->fetch_row($qm)): event_add($rm['userid'],"Your Gang's Organised Crime Failed. Go [url='oclog.php?ID=$i']here[/url] to view the details.",$c); endwhile; endif; endwhile; /* if($set['validate_period'] == 60 && $set['validate_on']) { $db->query("UPDATE users SET verified=0"); } */ $time = time(); $db->query("UPDATE `updates` SET `last` = ".$time." WHERE `name` = '1hour'"); $floor = $time - (floor($time / 3600) * 3600); if($floor > 0) { $newUpdate = time() - $floor; $db->query("UPDATE `updates` SET `last` = ".$newUpdate." WHERE `name` = '1hour'"); } } ?>   cron_day.php <?php $result = $db->query("SELECT * FROM `updates` WHERE `name` = '1day'"); $result = $db->fetch_row($result); $hla = time() - $result['last']; if($hla > (86400)) { $n = floor($hla / 86400); $jail = (1 * $n); $dig = (1 * $n); $age = (1 * $n); $ddays = (1 * $n); $cdays = (1 * $n); $mailban = (1 * $n); $mailban = (1 * $n); $db->query("UPDATE fedjail set fed_days=fed_days-'$jail'"); $q=$db->query("SELECT * FROM fedjail WHERE fed_days=0"); $ids=array(); while($r=$db->fetch_row($q)): $ids[]=$r['fed_userid']; endwhile; if(count($ids) > 0): $db->query("UPDATE users SET fedjail=0 WHERE userid IN(".implode(",", $ids).")"); endif; $db->query("DELETE FROM fedjail WHERE fed_days<0"); $db->query("UPDATE users SET daysingang=daysingang+'$dig' WHERE gang > 0"); $db->query("UPDATE users SET daysold=daysold+'$age', boxes_opened=0"); $db->query("UPDATE users SET mailban=mailban-'$mailban' WHERE mailban > 0"); $db->query("UPDATE users SET mailban='0' WHERE mailban < 0"); $db->query("UPDATE users SET donatordays=donatordays-'$ddays' WHERE donatordays > 0"); $db->query("UPDATE users SET donatordays='0' WHERE donatordays < 0"); $db->query("UPDATE users SET cdays=cdays-'$cdays' WHERE course > 0"); $db->query("UPDATE users SET cdays='0' WHERE cdays < 0"); for($x=0;$x<$n;$x++): $db->query("UPDATE users SET bankmoney=bankmoney+(bankmoney/50) where bankmoney>0"); $db->query("UPDATE users SET cybermoney=cybermoney+(cybermoney/100*7) where cybermoney>0"); endfor; for($x=0;$x<$n;$x++): $q=$db->query("SELECT * FROM users WHERE cdays=0 AND course > 0"); while($r=$db->fetch_row($q)): $cd=$db->query("SELECT * FROM courses WHERE crID={$r['course']}"); $coud=$db->fetch_row($cd); $userid=$r['userid']; $db->query("INSERT INTO coursesdone VALUES({$r['userid']},{$r['course']})"); $upd=""; $ev=""; if($coud['crSTR'] > 0): $upd.=",us.strength=us.strength+{$coud['crSTR']}"; $ev.=", {$coud['crSTR']} strength"; endif; if($coud['crGUARD'] > 0): $upd.=",us.guard=us.guard+{$coud['crGUARD']}"; $ev.=", {$coud['crGUARD']} guard"; endif; if($coud['crLABOUR'] > 0): $upd.=",us.labour=us.labour+{$coud['crLABOUR']}"; $ev.=", {$coud['crLABOUR']} labour"; endif; if($coud['crAGIL'] > 0): $upd.=",us.agility=us.agility+{$coud['crAGIL']}"; $ev.=", {$coud['crAGIL']} agility"; endif; if($coud['crIQ'] > 0): $upd.=",us.IQ=us.IQ+{$coud['crIQ']}"; $ev.=", {$coud['crIQ']} IQ"; endif; $ev=substr($ev,1); if($upd): $db->query("UPDATE users u LEFT JOIN userstats us ON u.userid=us.userid SET us.userid=us.userid $upd WHERE u.userid=$userid"); endif; $db->query("INSERT INTO events VALUES('',$userid,unix_timestamp(),0,'Congratulations, you completed the {$coud['crNAME']} and gained $ev!')"); endwhile; endfor; $db->query("UPDATE users SET course=0 WHERE cdays=0"); $db->query("TRUNCATE TABLE votes;"); $time = time(); $db->query("UPDATE `updates` SET `last` = ".$time." WHERE `name` = '1day'"); $floor = $time - (floor($time / 86400) * 86400); if($floor > 0) { $newUpdate = time() - $floor; $db->query("UPDATE `updates` SET `last` = ".$newUpdate." WHERE `name` = '1day'"); } } ?>
  8. Ok, so I was just wondering what would happen if someone was caught using a copy of MMCv2 without a licence. (i.e a certian "someone" accquired a nulled version of the script)
  9. Aye, I do that alot. ;D 'Tis fun.
  10. I've run into the same problem, not looked into it yet, but I'm about too... But basically, my Paypal IPN would do shit twice...
  11. inp_donator.php <? include "config.php"; global $_CONFIG; define("MONO_ON", 1); require "class/class_db_{$_CONFIG['driver']}.php"; $db=new database; $db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']); $db->connect(); $c=$db->connection_id; require 'global_func.php'; $set=array(); $settq=$db->query("SELECT * FROM settings"); while($r=$db->fetch_row($settq)) { $set[$r['conf_name']]=$r['conf_value']; } // read the post from PayPal system and add 'cmd' $req = 'cmd=_notify-validate'; foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } // post back to PayPal system to validate $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; $fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30); // assign posted variables to local variables $item_name = $_POST['item_name']; $item_number = $_POST['item_number']; $payment_status = $_POST['payment_status']; $payment_amount = $_POST['mc_gross']; $payment_currency = $_POST['mc_currency']; $txn_id = $_POST['txn_id']; $receiver_email = $_POST['receiver_email']; $payer_email = $_POST['payer_email']; if (!$fp) { } else { fputs ($fp, $header . $req); while (!feof($fp)) { $res = fgets ($fp, 1024); if($payment_status != "Completed") { fclose ($fp);die(""); } if($db->num_rows($db->query("SELECT * FROM dps_accepted WHERE dpTXN='{$txn_id}'")) > 0) { fclose ($fp);;die(""); } if($receiver_email != $set['paypal']) { fclose ($fp);die(""); } if($payment_currency != "USD") { fclose ($fp);die(""); } $packr=explode('|',$item_name); if(str_replace("www.","",$packr[0]) != str_replace("www.","",$_SERVER['HTTP_HOST'])) { fclose($fp);$db->query("INSERT INTO test VALUES('', 'DOMAIN FUCK UP!')"); die(""); } if($packr[1] != "DP") { fclose($fp);die(""); } $pack=$packr[2]; $packinfo = $db->fetch_row($db->query("SELECT * FROM packages WHERE id='$pack' AND deleted='0' LIMIT 1")); if(!$packinfo) { fclose($fp);die(""); } if($packinfo[cost] != $payment_amount) { fclose ($fp); die(""); } $buyer=$packr[3]; $for=$buyer; $db->query("UPDATE users u LEFT JOIN userstats us ON u.userid=us.userid SET u.money=u.money+'$packinfo[money]', u.crystals=u.crystals+'$packinfo[crystals]', us.IQ=us.IQ+'$packinfo[iq]', u.donatordays=u.donatordays+'$packinfo[ddays]' WHERE u.userid='$for'"); $d = $packinfo[ddays]; $t = $packinfo[id]; event_add($for, "Your \${$payment_amount} Pack {$packinfo[name]} Donator Pack has been successfully credited to you.", $c); $db->query("INSERT INTO dps_accepted VALUES('', {$buyer}, {$for}, '$t', unix_timestamp(), '$txn_id')"); ########} ########else if (strcmp ($res, "INVALID") == 0) { ######## $db->query("INSERT INTO test VALUES('', 'INVALID')"); ########} } fclose ($fp); } ?>   I don't give a **** if you don't like the way I've coded it, 'tis a free mod, you get what you pay for and I actually have NO idea what the hell I'm doiing posting it here, but yea... XD
  12. I recently "accuired" a set of MCCv2 codes, and I've been pissing about, anyways, here's a paypal/donation package editor thingy for the Admin panel... staff_paypal.php <?php include "sglobals.php"; if($ir['user_level'] > 2) { die("403"); } //This contains paypal stuffs switch($_GET['action']) { case 'addpackage': add_package(); break; case 'editpackage': edit_package(); break; case 'delpackage': delete_package(); break; default: print "Error: This script requires an action."; break; } function add_package() { global $db, $ir, $c, $h, $userid; $money = abs((int) $_POST['money']); $crystals = abs((int) $_POST['crystals']); $iq = abs((int) $_POST['iq']); $ddays = abs((int) $_POST['ddays']); $cost = abs((int) $_POST['cost']); $name = $_POST['name']; if($cost > 0 && $name): if($db->num_rows($db->query("SELECT * FROM packages WHERE name='{$name}'"))): echo "You can't have two packages with the same name."; else: $db->query("INSERT INTO packages VALUES(NULL, '$money', '$crystals', '$iq', '$ddays', '$name', '$cost', '0')"); print "Package {$name} added to the game."; stafflog_add("Donation Package $name created"); endif; else: echo "<h3>Add Package</h3><hr /> <form action='staff_paypal.php?action=addpackage' method='post'> Name: <input type='text' name='name' /> Money: $<input type='text' name='money' /> Crystals: <input type='text' name='crystals' /> IQ: <input type='text' name='iq' /> Donator Days: <input type='text' name='ddays' /> Cost: $<input type='text' name='cost' /> <input type='submit' value='Add Package' /></form>"; endif; } function edit_package() { global $db, $ir, $c, $h, $userid; $edit = abs((int) $_POST[edit]); $r = $db->fetch_row($db->query("SELECT * FROM packages WHERE id='$edit' LIMIT 1")); if($_POST): if($_POST[id]): $money = abs((int) $_POST['money']); $crystals = abs((int) $_POST['crystals']); $iq = abs((int) $_POST['iq']); $ddays = abs((int) $_POST['ddays']); $cost = abs((int) $_POST['cost']); $id = abs((int) $_POST['id']); $name = $_POST['name']; $db->query("UPDATE packages SET money='$money', crystals='$crystals', iq='$iq', ddays='$ddays', name='$name', cost='$cost' WHERE id='$id' LIMIT 1"); print "Package {$name} edited."; stafflog_add("Donation Package $name editted"); else: echo "<h3>Edit Package</h3><hr /> <form action='staff_paypal.php?action=editpackage' method='post'> <input type='hidden' value='$edit' name='id' /> Name: <input type='text' name='name' value='$r[name]' /> Money: $<input type='text' name='money' value='$r[money]' /> Crystals: <input type='text' name='crystals' value='$r[crystals]' /> IQ: <input type='text' name='iq' value='$r[iq]' /> Donator Days: <input type='text' name='ddays' value='$r[ddays]' /> Cost: $<input type='text' name='cost' value='$r[cost]' /> <input type='submit' value='Edit Package' /></form>"; endif; else: $packs = $db->query("SELECT name,cost,id FROM packages WHERE deleted!='1'"); echo "<form action='staff_paypal.php?action=editpackage' method='post'>Package <select name='edit'>"; while($r = $db->fetch_row($packs)): echo "<option value='$r[id]'>$r[name] (\$$r[cost],--)</option>"; endwhile; echo "</select> <input type='submit' value='Edit Package'></form>"; endif; } function delete_package() { global $db, $ir, $c, $h, $userid; $id = abs((int) $_POST['id']); if($_POST[id]): $db->query("UPDATE packages SET deleted='1' WHERE id='$id' LIMIT 1"); print "Package {$name} deleted."; stafflog_add("Donation Package $name deleted"); else: $packs = $db->query("SELECT name,cost,id FROM packages WHERE deleted!='1'"); echo "<form action='staff_paypal.php?action=delpackage' method='post'>Package <select name='id'>"; while($r = $db->fetch_row($packs)): echo "<option value='$r[id]'>$r[name] (\$$r[cost],--)</option>"; endwhile; echo "</select> <input type='submit' value='Delete Package'></form>"; endif; } $h->endpage(); ?> donator.php (Just replace your old one with this...) <?php include "globals.php"; print <<<EOF <h3>Donations</h3> [b][[url='willpotion.php']Buy Will Potions[/url]][/b] If you become a donator to {$set['game_name']}, you will receive (each time you donate): EOF; if($db->num_rows($db->query("SELECT id FROM packages")) < 1): echo "Sorry, but there are currently no packages in the game yet."; else: $q=$db->query("SELECT * FROM packages WHERE deleted!='1' ORDER BY cost ASC"); while($r=$db->fetch_row($q)): echo "<fieldset><legend>$r[name] (\$$r[cost],--)</legend><ul>"; if($r[money] > 0) echo "[*]\$".number_format($r[money])." game money."; if($r[crystals] > 0) echo "[*]$r[crystals] crystals."; if($r[iq] > 0) echo "[*]$r[iq] IQ, the hardest stat in the game to get."; if($r[ddays] > 0) echo "[*]$r[ddays] days Donator Status: Red name + cross next to your name."; echo "[*]17% Energy every 5 minutes instead of 8%. (For aslong as you have Donator Status)[*]Access to Friends and Black lists[/list]"; echo '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">'; echo '<input type=hidden name=cmd value=_xclick>'; echo '<input type="hidden" name="business" value="'.$set[paypal].'">'; echo '<input type="hidden" name="item_name" value="'.$domain.'|DP|'.$r[id].'|'.$userid.'">'; echo '<input type="hidden" name="amount" value="'.$r[cost].'.00">'; echo '<input type="hidden" name="no_shipping" value="1">'; echo '<input type="hidden" name="return" value="http://'.$domain.'/donatordone.php?action=done&type=standard">'; echo '<input type="hidden" name="cancel_return" value="http://'.$domain.'/donatordone.php?action=cancel">'; echo '<input type="hidden" name="notify_url" value="http://'.$domain.'/ipn_donator.php">'; echo '<input type="hidden" name="cn" value="Your Player ID">'; echo '<input type="hidden" name="currency_code" value="USD">'; echo '<input type="hidden" name="tax" value="0">'; echo '<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but21.gif" border="0" name="submit" alt="Make payments with PayPal - it\'s fast, free and secure!">'; echo '</form>'; echo "</fieldset>"; endwhile; endif; $h->endpage(); smenu.php (Just add this snippet where ever you want. ^_^) if($ir['user_level']==2) { print "<hr />[b]Donaion Packages[/b] > [url='staff_paypal.php?action=addpackage']Add Package[/url] > [url='staff_paypal.php?action=editpackage']Edit Package[/url] > [url='staff_paypal.php?action=delpackage']Delete Package[/url] "; } packages.sql CREATE TABLE IF NOT EXISTS `packages` ( `id` int(11) NOT NULL AUTO_INCREMENT, `money` int(11) NOT NULL, `crystals` int(11) NOT NULL, `iq` int(11) NOT NULL, `ddays` int(11) NOT NULL, `name` varchar(32) NOT NULL, `cost` int(11) NOT NULL, `deleted` int(1) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; Is this perfect? No... Do I care if this works? Not really... Why am I sharing it then? For teh lulz... Teh lulz is the only reason anyone does anything these days. ^_^ ENJOY!
×
×
  • Create New...