-
Posts
2,210 -
Joined
-
Last visited
-
Days Won
47
Content Type
Profiles
Forums
Events
Everything posted by sniko
-
Missions / Milestones / Achievements - Mod request
sniko replied to dnenb's topic in Requests & In Production
I make adjustment to 1 file only - which fetches all the required files for my system to work :) -
Missions / Milestones / Achievements - Mod request
sniko replied to dnenb's topic in Requests & In Production
Um, sure. I've done this for a game I'm working on currently, and, in theory, it would seem easy to integrate it into McCodes. What you've said suggests you'd have to adapt the engine around this modification, when in actual fact, you adapt the modification to fit the engine. The way that the system - McCodes - is built wouldn't make creating this type of modification any more hard than it would be if the core was coded any differently. Why? Because you would adapt the modification around the existing product you're trying to modify. In my version, I've created a 'generator' to generate custom "codes" I can use to do validation checks on a players progress, which is then interpreted by a custom reader. The only thing which wasn't "easy" about doing it was to make it secure against user created quests. You can probably see this in action early next year, by the way - and I'm not hijacking the thread to build suspense for my product, it was just a bi-product of explaining ;) -
Perhaps you could find one on 4templates. If not, I highly recommend Peter
-
Hi Arson, I've just notified ColdBlooded about the situation. He plans to clean up the withdraw requests today. - sniko
-
Very nice design! I'd buy it if I had time to develop it into sustainable project.
-
Although, `post` would be the standardized API verb @OP It's pretty cool, but I wouldn't consider it a full API - although it does offer abstraction. If you get around to altering it - in my view - I would consider making it much bigger, making use of collections and verbs. I would also change it from returning raw strings to HTTP header codes, or boolean, allowing the end-user to set the 'error' text in their code, rather than them altering the 'API' source - as ideally, they shouldn't have to edit the API to fit their liking as the API should 'adapt' around them.
-
It's only been 5 days. Also, your attempt as some low-level reverse psychology makes you look childish, and needy.
-
Why don't you design for your target market, and not yourself? Pretty sure the screenshot doesn't show the whole template - how can one be sure of what they're purchasing?
-
Bid: £50. Please keep me in the loop if I've been outbid.
-
Ajax requests for what, exactly?
-
Off topic, but kind of on topic. Read your Facebook chat, Magic ;) - - - Updated - - - Off topic, but kind of on topic. Read your Facebook chat, Magic ;)
-
Perhaps adopt some sort of naming convention for your variables Hungarian camel notation will help 3rd party developers, such as those on a forum - like this one - debug your horribly presented code. It'll help you debug your code faster [*]Indent your code logically. It could be the forum software rendering it incorrectly, however I doubt it It will help you debug your code faster [*]Use an IDE or advanced text-editor (you could be that you're already using one, I don't know) I don't mean Notepad. [*]Move away from mysql At the very least, move to MySQLi You're bound to the mysql database What if you wanted to move to ...say... MongoDB? You'd have to rewrite everything [*]Research into PDO Or a 3rd party database class Anyhow, here's your code indented properly. <?php session_start(); require "global_func.php"; if ($_SESSION['loggedin'] == 0) { header("Location: login.php"); exit; } $userid = $_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is = mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid", $c) or die(mysql_error()); $ir = mysql_fetch_array($is); check_level(); $fm = money_formatter($ir['money']); $cm = money_formatter($ir['crystals'], ''); $lv = date('F j, Y, g:i a', $ir['laston']); $h->userdata($ir, $lv, $fm, $cm); $h->menuarea(); echo '<h3><u>Dump</u></h3><hr width="75%" />'; switch ($_GET['step']) { case "dump": dump(); break; case "dump2": dump2(); break; case "search": search(); break; default: index(); } function index() { global $db, $ir, $c, $h, $userid; $num = mysql_query("SELECT * FROM `dump`"); echo 'Welcome to the dump, people all over the city come here to dump there crap. There are currently <font color=blue><b>' . mysql_num_rows($num) . '</b></font> items that are dumped. > <a href="dump.php?step=search">Search the dump!</a>'; } function dump2() { global $db, $ir, $c, $h, $userid; if ($_POST) { $itemid = abs((int) $_GET['id']); $amount = abs((int) $_POST['amount']); $query = mysql_query("SELECT * FROM `inventory` WHERE `inv_userid` = {$ir['userid']} and inv_itemid = " . $itemid . ""); $data = mysql_fetch_array($query); if ($_POST['amount'] < 1) { echo 'You have to dump something to be able to dump it!'; } if ($data['inv_qty'] < $_POST['amount']) { echo 'You do not have that many of this item to dump!'; } else { $query = mysql_query("SELECT * FROM `inventory` WHERE `inv_userid` = " . $userid . ""); $data = mysql_fetch_array($query); item_remove($userid, $itemid, $_POST['amount']); for ($i = 1; $i <= $_POST['amount']; $i++) { mysql_query("INSERT INTO `dump` (dumpID, itmID, dumperID) VALUES (NULL, " . $itemid . ", " . $userid . ")"); } echo 'You have dumped ' . $_POST['amount'] . ' ' . getitmname($itemid) . '(s)!'; } } } function dump() { global $db, $ir, $c, $h, $userid; echo "Please pick which items you would like to dump.<hr width='75%' />"; echo "<table width='75%' cellspacing='1' class='table'><tr style='background:gray'> <th width='70%'>Name</th><th>Qty</th><th width='15%'>Amount</th><th width='15%'>Trash</th></tr>"; $query = mysql_query("SELECT * FROM `inventory` WHERE `inv_userid` = " . $userid . ""); while ($data = mysql_fetch_array($query)) { echo"<td>" . getitmname($data['inv_itemid']) . " </td> <td>x" . $data['inv_qty'] . "</td> <td><input type=text name='amount' size='5' maxlength='5' value='0'></td> <form action=dump.php?step=dump2&id=" . $data['inv_itemid'] . " method='post'> <td><input type='submit' value='Dump' /></td> </tr>"; } echo '</form></table>'; } function search() { global $db, $ir, $c, $h, $userid; $energy = (int) ($ir['maxenergy'] / 100 * 10); $rfc = rand(1, 5); $num = mysql_query("SELECT * FROM `dump`"); if ($energy >= $ir['energy'] + 1) { echo 'You do not have enough energy to search the dump any longer.'; } else if ($rfc != 3) { echo 'You searched the dump for hours but couldn\'t find anything.> <a href="dump.php?step=search">Search again!</a>'; mysql_query("UPDATE `users` SET `energy` = `energy` - {$energy} WHERE `userid` = " . $userid . ""); } else if (mysql_num_rows($num) < 1) { echo 'You searched the dump for hours but couldn\'t find anything.> <a href="dump.php?step=search">Search again!</a>'; mysql_query("UPDATE `users` SET `energy` = `energy` - {$energy} WHERE `userid` = " . $userid . ""); } else { $query = mysql_query("SELECT * FROM `dump` ORDER BY RAND() LIMIT 0,1;"); while ($data = mysql_fetch_array($query)) { $getname = mysql_query("SELECT `username` FROM `users` WHERE `userid` = " . $data['dumperID'] . "", $c); if (mysql_num_rows($getname)) { $a = mysql_fetch_array($getname); $name = '<a href="viewuser.php?u=' . $data['dumperID'] . '" alt="' . $a['username'] . '">' . $a['username'] . '</a>'; } else { $name = "Unknown"; } echo 'You searched the dump and find a <font color = gold>' . getitmname($data['itmID']) . '</font> that was dumped by ' . $name . '!'; item_add($userid, $data['itmID'], 1); mysql_query("UPDATE `users` SET `energy` = `energy` - {$energy} WHERE `userid` = " . $userid . ""); mysql_query("DELETE FROM `dump` WHERE `dumpID`= " . $data['dumpID'] . ""); } echo'> <a href="dump.php?step=search">Search again!</a>'; } } echo ' <hr width="75%" /><table width="75%"> <tr><td width="50%" align="center"> > <a href="dump.php">Back</a> </td><td width="50%" align="center"> > <a href="dump.php?step=dump" alt="Dump your items!">Dump Items</a> </td></tr></table><hr width="75%" />'; function getitmname($itmid) { global $db, $ir, $c, $h, $userid; $getitem = mysql_query("SELECT `itmname` FROM `items` WHERE `itmid` = " . $itmid . ""); if (mysql_num_rows($getitem)) { $itemData = mysql_fetch_array($getitem); $item = $itemData['itmname']; return $item; } } $h->endpage(); ?> What is it? - - - Updated - - - Perhaps adopt some sort of naming convention for your variables Hungarian camel notation will help 3rd party developers, such as those on a forum - like this one - debug your horribly presented code. It'll help you debug your code faster [*]Indent your code logically. It could be the forum software rendering it incorrectly, however I doubt it It will help you debug your code faster [*]Use an IDE or advanced text-editor (you could be that you're already using one, I don't know) I don't mean Notepad. [*]Move away from mysql At the very least, move to MySQLi You're bound to the mysql database What if you wanted to move to ...say... MongoDB? You'd have to rewrite everything [*]Research into PDO Or a 3rd party database class Anyhow, here's your code indented properly. <?php session_start(); require "global_func.php"; if ($_SESSION['loggedin'] == 0) { header("Location: login.php"); exit; } $userid = $_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is = mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid", $c) or die(mysql_error()); $ir = mysql_fetch_array($is); check_level(); $fm = money_formatter($ir['money']); $cm = money_formatter($ir['crystals'], ''); $lv = date('F j, Y, g:i a', $ir['laston']); $h->userdata($ir, $lv, $fm, $cm); $h->menuarea(); echo '<h3><u>Dump</u></h3><hr width="75%" />'; switch ($_GET['step']) { case "dump": dump(); break; case "dump2": dump2(); break; case "search": search(); break; default: index(); } function index() { global $db, $ir, $c, $h, $userid; $num = mysql_query("SELECT * FROM `dump`"); echo 'Welcome to the dump, people all over the city come here to dump there crap. There are currently <font color=blue><b>' . mysql_num_rows($num) . '</b></font> items that are dumped. > <a href="dump.php?step=search">Search the dump!</a>'; } function dump2() { global $db, $ir, $c, $h, $userid; if ($_POST) { $itemid = abs((int) $_GET['id']); $amount = abs((int) $_POST['amount']); $query = mysql_query("SELECT * FROM `inventory` WHERE `inv_userid` = {$ir['userid']} and inv_itemid = " . $itemid . ""); $data = mysql_fetch_array($query); if ($_POST['amount'] < 1) { echo 'You have to dump something to be able to dump it!'; } if ($data['inv_qty'] < $_POST['amount']) { echo 'You do not have that many of this item to dump!'; } else { $query = mysql_query("SELECT * FROM `inventory` WHERE `inv_userid` = " . $userid . ""); $data = mysql_fetch_array($query); item_remove($userid, $itemid, $_POST['amount']); for ($i = 1; $i <= $_POST['amount']; $i++) { mysql_query("INSERT INTO `dump` (dumpID, itmID, dumperID) VALUES (NULL, " . $itemid . ", " . $userid . ")"); } echo 'You have dumped ' . $_POST['amount'] . ' ' . getitmname($itemid) . '(s)!'; } } } function dump() { global $db, $ir, $c, $h, $userid; echo "Please pick which items you would like to dump.<hr width='75%' />"; echo "<table width='75%' cellspacing='1' class='table'><tr style='background:gray'> <th width='70%'>Name</th><th>Qty</th><th width='15%'>Amount</th><th width='15%'>Trash</th></tr>"; $query = mysql_query("SELECT * FROM `inventory` WHERE `inv_userid` = " . $userid . ""); while ($data = mysql_fetch_array($query)) { echo"<td>" . getitmname($data['inv_itemid']) . " </td> <td>x" . $data['inv_qty'] . "</td> <td><input type=text name='amount' size='5' maxlength='5' value='0'></td> <form action=dump.php?step=dump2&id=" . $data['inv_itemid'] . " method='post'> <td><input type='submit' value='Dump' /></td> </tr>"; } echo '</form></table>'; } function search() { global $db, $ir, $c, $h, $userid; $energy = (int) ($ir['maxenergy'] / 100 * 10); $rfc = rand(1, 5); $num = mysql_query("SELECT * FROM `dump`"); if ($energy >= $ir['energy'] + 1) { echo 'You do not have enough energy to search the dump any longer.'; } else if ($rfc != 3) { echo 'You searched the dump for hours but couldn\'t find anything.> <a href="dump.php?step=search">Search again!</a>'; mysql_query("UPDATE `users` SET `energy` = `energy` - {$energy} WHERE `userid` = " . $userid . ""); } else if (mysql_num_rows($num) < 1) { echo 'You searched the dump for hours but couldn\'t find anything.> <a href="dump.php?step=search">Search again!</a>'; mysql_query("UPDATE `users` SET `energy` = `energy` - {$energy} WHERE `userid` = " . $userid . ""); } else { $query = mysql_query("SELECT * FROM `dump` ORDER BY RAND() LIMIT 0,1;"); while ($data = mysql_fetch_array($query)) { $getname = mysql_query("SELECT `username` FROM `users` WHERE `userid` = " . $data['dumperID'] . "", $c); if (mysql_num_rows($getname)) { $a = mysql_fetch_array($getname); $name = '<a href="viewuser.php?u=' . $data['dumperID'] . '" alt="' . $a['username'] . '">' . $a['username'] . '</a>'; } else { $name = "Unknown"; } echo 'You searched the dump and find a <font color = gold>' . getitmname($data['itmID']) . '</font> that was dumped by ' . $name . '!'; item_add($userid, $data['itmID'], 1); mysql_query("UPDATE `users` SET `energy` = `energy` - {$energy} WHERE `userid` = " . $userid . ""); mysql_query("DELETE FROM `dump` WHERE `dumpID`= " . $data['dumpID'] . ""); } echo'> <a href="dump.php?step=search">Search again!</a>'; } } echo ' <hr width="75%" /><table width="75%"> <tr><td width="50%" align="center"> > <a href="dump.php">Back</a> </td><td width="50%" align="center"> > <a href="dump.php?step=dump" alt="Dump your items!">Dump Items</a> </td></tr></table><hr width="75%" />'; function getitmname($itmid) { global $db, $ir, $c, $h, $userid; $getitem = mysql_query("SELECT `itmname` FROM `items` WHERE `itmid` = " . $itmid . ""); if (mysql_num_rows($getitem)) { $itemData = mysql_fetch_array($getitem); $item = $itemData['itmname']; return $item; } } $h->endpage(); ?> What is it?
-
Use an identifier. $query = "SELECT `userid`,`username` FROM `users` ORDER BY `battlepoints` DESC LIMIT 5"; $n = 1; while($r = $db->fetch_row( $db->query($query) ) ) { //Do logic here. //$r['userid'] for their userid //$r['username'] for their username $n++; } Use the value of $n for their position. Simple.
-
$query = "SELECT `userid`,`username` FROM `users` ORDER BY `battlepoints` DESC LIMIT 5"; while($r = $db->fetch_row( $db->query($query) ) ) { //Do logic here. //$r['userid'] for their userid //$r['username'] for their username } :)
-
$fetch = "SELECT `gangNAME` FROM `gangs` ORDER BY `gangRESPECT` DESC LIMIT 5"; echo '<ol>'; while($r = $db->fetch_row( $db->query($fetch) ) ) { echo '<li>'. $r['gangNAME'] .'</li>'; } echo '</ol>'; Also, it's Macaulay.
-
He'd have to redo the gym system, and possibly the attack system, as they piggy-back off the housing system; will. Perhaps make it stock, and not an enforced design. This way, the module will attract more users, and they're not enforced to keep to a design which may not suit their game, or their preference. Razor could go down the road of harnessing a template system; perhaps bespoke to this system, and not something like Twig, or smarty. I'm in favor. Razor, do! ;)
-
Um, try this: $q=mysql_query("SELECT * FROM tickets WHERE name='{$_POST['name']}'"); while($c=mysql_fetch_assoc($q)) { if( in_array($_POST['no1'], array_values($c)) AND in_array($_POST['no2'], array_values($c)) AND in_array($_POST['c3'], array_values($c)) AND in_array($_POST['no4'], array_values($c)) { echo "This ticket already exists. <a href='add.php'>Back</a>"; break; } }
-
MC CODE v3 NEWS RELEASE EVIDENCE !!!!!!!! GET INVOLVED
sniko replied to jedigunz's topic in MCCode v3 Discussion
...of an early alpha build. -
MC CODE v3 NEWS RELEASE EVIDENCE !!!!!!!! GET INVOLVED
sniko replied to jedigunz's topic in MCCode v3 Discussion
Implying early alpha is final build. -
A quick update regarding TopListedGames.
-
It was a pleasure, Guest. See you around...maybe, hopefully... I miss you
-
The problem with sticking to MySQLi, is that you're bound to a MySQL database, whereas PDO offers a layer from the database, allowing you not to be bound to only a MySQL database - so in that respect, yes, it is the way forward for some development/live environments. - murphy's law applies - quasi-perfect equilibrium applies
-
I hate this "saying". By taking the term literal (and I know you didn't mean it to be), it doesn't make sense, as we [humans] have reinvented the wheel many times over. For example, from this to this (Osmos Orbital Wheel) Sure, the shape hasn't changed, but the performance has. Now, taking it as you intended one to take it; Without 're-inventing the wheel', we'd still be stuck with this. Without re-inventing the wheel, Moore's law wouldn't be becoming redundant/wrong due to technological enhancement through 're-inventing the wheel', by throwing out, and starting over what we thought was the best logical solution to a problem; ie. plato iv touch screen terminal (infrared) - optical sensor touchscreen. Although that was just an example of technological enhancement, I'm pretty sure that they re-invented the way that the touchscreen functions behind the scenes. Yes, you could argue that the logic is somewhat the same, therefore you're not 're-inventing the wheel' - but how far would you go? Considering 'never re-invent the wheel' is only limiting your capabilities, and advancement.
-
LAMP stack Install LAMP stack on Ubuntu Install LAMP stack on Arch Linux Install LAMP stack on Fedora Tag Search LAMP stack tag search Node.js tag search Interface Install zpanel on centos 6 Install cpanel on centos 6 :)
-
You could try Digital Ocean. I've not tested their services with something that intensive, but for $5.00 per month, you're not really loosing anything. If you do go with DigitalOcean, you will have to install the services you require.