
boionfire81
Members-
Posts
532 -
Joined
-
Last visited
-
Days Won
6
Content Type
Profiles
Forums
Events
Everything posted by boionfire81
-
hmmm, IPv6 may only be of interest in terms of host, but IPv4 is in the process of being depreciated to IPv6. At least according to some tech news.
-
mccode-v2 Currency Exchange *Tested*
boionfire81 replied to boionfire81's topic in Free Modifications
yeah those are my standard go to's lol. and thanks! -
So why was it included in the standard McCodes v2?
-
IPv4 is good. Not sure how to read IPv6
-
mccode-v2 Currency Exchange *Tested*
boionfire81 replied to boionfire81's topic in Free Modifications
I have a bad habit of starting with one thing and ending up with another >.< -
[uSER=73850]Bjorn Westergaard[/uSER] never heard back from you. I'm trying to hire a dev in freelance areas but they ALL want the game files sent to them before they say yes or no pffft.
-
Well...... I literally just now got this error on my profile...I tried logging out and back in, but yeah same error. AND it's me >.<
-
Just made this today. It's not the prettiest code, but it works and it's FREE. My site is a low economy game so feel free to tweak to your liking. <?php //Created By: Boi //This is a Free Modification //You can redistribute, but you can not sell it! //Made for the makewebgames.io community include "globals.php"; $_GET['action'] = isset($_GET['action']) && ctype_alpha($_GET['action']) ? $_GET['action'] : null; switch($_GET['action']) { case "cash": cashin(); break; case "credits": getcredits(); break; default: index(); break; } function index() { global $ir, $h; echo "<center><h1>Currency Echange Center</h1></center> <table width='80%'><tr><td height='90px'></td><td rowspan='3' class='lily'></td></tr><tr><td class='bubbleright'><b>Lily:</b><p><i> Hello! And welcome to the currency exchange center! I'm here to assist with your transaction. Our current exchange rate is 1000/1. This rate can change from time to time, so it's better to get your credits now. The market is good, and credits are the only way to exchange currencies.</p> <p>You currently have " . money_formatter($ir['money']) . " and " . number_format($ir['crystals']) . " credits.</i></p></td></tr><tr><td><center>What transaction would you like to make?<br><br><a href='exchangecurrency.php?action=credits' class='button'>Purchase Credits</a> <a href='exchangecurrency.php?action=cash' class='button'>Trade In Credits</a><br><br></td></tr></table>"; $h->endpage(); } function getcredits() { global $ir, $db, $userid, $h; $_POST['credits'] = isset($_POST['credits']) && ctype_digit($_POST['credits']) ? $_POST['credits'] : null; $cost = $_POST['credits'] * 1000; if(!$_POST['credits']) { echo" <center><h1>Currency Echange Center</h1></center> <table width='80%'><tr><td height='90px'></td><td rowspan='3' class='lily'></td></tr><tr><td class='bubbleright'><b>Lily:</b><p><i> Great idea! How many credits would you like? Remember each credit costs \$1,000.</i></td></tr><tr><td><form action='' method='post'><input type='text' name='credits'><input type='submit' value'Buy' class='formbutton'></form></td></tr></table>"; $h->endpage(); } elseif($_POST['credits']) { if ($cost > $ir['money']) { echo " You can not afford this transaction"; $h->endpage(); } else { echo "You have purchased {$_POST['credits']} credits for " . money_formatter($cost) . ". <br /><br />Where would you like to go next?<br><br><center><a href='explore.php' class='button'>The City</a> <a href='travel.php' class='button'>Travel Agency</a></center>"; $db->query("UPDATE `users` SET `crystals` = `crystals` + {$_POST['credits']}, `money` = `money` - $cost WHERE `userid` = $userid"); $h->endpage(); } } } function cashin() { global $ir, $db, $userid, $h; $_POST['credit'] = isset($_POST['credit']) && ctype_digit($_POST['credit']) ? $_POST['credit'] : null; if(!$_POST['credit']) { echo" <center><h1>Currency Echange Center</h1></center> <table width='80%'><tr><td height='90px'></td><td rowspan='3' class='lily'></td></tr><tr><td class='bubbleright'><b>Lily:</b><p><i> Great idea! How many credits would you like to exchange? Remember each credit is worth \$750.</i></td></tr><tr><td><form action='' method='post'><input type='text' name='credit'><input type='submit' value='Exchange' class='formbutton'></form></td></tr></table>"; $h->endpage(); } else { if($_POST['credit'] > $ir['crystals']) { echo " You can not afford this transaction"; $h->endpage(); } else { $exchange = $_POST['credit'] * 750; echo "You have exchanged {$_POST['credit']} credits for " . money_formatter($exchange) . ". <br /><br />Where would you like to go next?<br><br><center><a href='explore.php' class='button'>The City</a> <a href='travel.php' class='button'>Travel Agency</a></center>"; $db->query("UPDATE `users` SET `crystals` = `crystals` - {$_POST['credit']}, `money` = `money` + $exchange WHERE `userid` = $userid"); $h->endpage(); } } } CSS .bubbleright { position: relative; width: 275px; height: 70px; padding: 10px; background: #FFFFFF; -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; border: #7F7F7F solid 1px; } .bubbleright:after { content: ''; position: absolute; border-style: solid; border-width: 15px 0 15px 15px; border-color: transparent #FFFFFF; display: block; width: 0; z-index: 1; right: -15px; top: 30px; } .bubbleright:before { content: ''; position: absolute; border-style: solid; border-width: 15px 0 15px 15px; border-color: transparent #7F7F7F; display: block; width: 0; z-index: 0; right: -16px; top: 30px; } .lily { width: 175px; height: 350px; background-image: url(/css/images/people/lily.png); background-size: cover; } you will need to find your own "lily" enjoy :)
-
Need someone who can help me install this mod - http://mccodes.com/viewmod.php?id=68 I can not get it to work for me for some reason. :( Message me your price.
-
My current question. Before I include in the above post is dealing with yet again the $ get/ $ post variables. What is the best form when the $_POST has various characters, including spaces? [uSER=68711]KyleMassacre[/uSER] [uSER=69001]Zettieee[/uSER] Anyways, will keep updating in this post to keep the thread clean.
-
So I'm making this thread to help myself and others find answers to some of the questions I have come across a lot. Here are some of the things I have learned. Undefined index (action). This is located for your "switch" function. In order to call a specific part of the file to run. Depending on the type of action you are calling you could use: $_GET['action'] = isset($_GET['action']) && ctype_alpha($_GET['action']) ? $_GET['action'] : null; when the ***.php?action= only uses letters You can use $_GET['action'] = isset($_GET['action']) && ctype_alnum($_GET['action']) ? $_GET['action'] : null; for when you need to use both letters and number values or $_GET['action'] = isset($_GET['action']) && ctype_digit($_GET['action']) ? $_GET['action'] : null; For only numbers ALOT of undefined functions are found in this line: global $ir,$c,$userid, $db; These are queries located in the global files. So if for instance you are trying to call $ir but your global line does not contain $ir you might get a undefined function. Simply by adding $ir to the global line can fix this in most cases. I have found $db and $h are the most common functions left out of the global line. $h is mostly to end a page, while $db is used to define the mysql or mysqli engine. They $c variable is included in a lot of the mods you will find, but basically is no longer used in the most recent version of McCodes. Using arrays over a single variable can add a wider range of functionality and choices for your members. They are no longer stuck to only one way, black & white. Now there are grey areas where a member can choose their route over a time way road. Code example thanks to [uSER=70347]NonStopCoding[/uSER] if(in_array($r['itmtype'],array(15,19,33))) Adding an item to users inventory, you would use item_add(*userid*,*itemID*,*quantity*); Removing an item from inventory item_remove(*userid*,*itemID*,*quantity*); Sending an event event_add(*userid*,*message*); Restrictions based on time - thanks to [uSER=70574]TheMasterGeneral[/uSER] require('globals.php'); $endtime=140000000; $starttime=130000000; $currenttime=time(); if ($endtime < $currenttime) { //nope } Delete logs after 24 hours - Thanks to [uSER=70574]TheMasterGeneral[/uSER] $Time=time(); $DeleteTime=$Time-86400; //86400 is 24 hours $db->query("DELETE FROM `your_logs_table` WHERE `timestamp` <= {$DeleteTime}"); I'm curious as the what are the most common questions you see asked. As in relation to a new mod install and configuration into McCodes general details. Many mods have questions specific to just themselves. I'd like to keep this as a universal thread so we don't confuse readers with details unrelated to them. (such as myself!, lol)
-
lost mod details need help with 1 line
boionfire81 replied to boionfire81's topic in Modification Support
lol true. But I think the idea is that the bounty info is being post through the get url which then is passed on to the attack/hosp script. Hence the get in the url. Maybe a coniditional if post for the url? if get url has bounty echo bounty string url, else echo normal? -
So I'm adding a new mod, and I'm just now noticing an unfound error. In attack.php if the user being attacked does not have a bounty on them this line returns an error. echo "<a href='attack.php?nextstep=$ns&ID={$_GET['ID']}&wepid={$r['itmid']}&bounty={$_GET['bounty']}'>{$r['itmname']}</a><br />"; Also, going to be a bit more behind than usual. Had to replace a burnt out laptop. >.< And..if anyone is willing to help me test the system out a bit, pm me so I can send you the website address.TY
-
But does it work with the item market like TC?
-
yeah I saw that with the NPC, but the inactive also has the same issue. He signed up and only came online once or twice. I'm having him login now to see if the error goes away
-
It was ok, until I ran into the to drunk to do anything lol! Typically the denies were a simple 1 or 0. But now it's a matter of an increasing number. Not sure how to approach this. For the most part drunk is whatever, but if you are soooo drunk you wouldn't be able to walk, smart thing is to wait it out or sober up. Meaning spending in game cash, meaning now is a shot at making money. Any idea's?
-
inactives are giving a gethostbyaddr(): Address is not a valid IPv4 or IPv6 address (2) on viewing profile
-
Just thought I'd post an update. Since pages like the club would be unavailable during most things like traveling, jail, hosp, etc. I simply included this line in the pages to override the inclusion of the script when it would not be needed. Much simplier :) :) if ($ir['club'] = 0) { include "access.php";}
-
[uSER=70347]NonStopCoding[/uSER] [uSER=69001]Zettieee[/uSER] [uSER=68711]KyleMassacre[/uSER] [uSER=65371]sniko[/uSER] [uSER=65530]Coly010[/uSER] [uSER=67703]adamhull[/uSER] Ok, you guys are kinda smart. There has to be a way to select multiple cities. By changing the select to multiselect, editting the shopLOCATION column to accept an array of options. & edit the one line in shops.php that says if shopLOCATION = ir[location] to be able to pull an array not single location. If you have seen my tables, there ARE a lot of cities. And some I would like standard in ALL cities, and others just in a few cities. Those three tweaks should be able to solve that issue. If you guys have time...mind taking a look?
-
Account page layout with display pic upload
boionfire81 replied to boionfire81's topic in Requests & In Production
Actually, just got it working this morning :) <?php include "globals.php"; echo "<h3>Edit Account</h3>"; if(!empty($_POST['username']) && !empty($_POST['email'])) { foreach($_POST as $k => $v) { $v=trim($v); } $username=$db->escape($_POST['username']); $email=$db->escape($_POST['email']); $gender=!empty($_POST['gender']) ? $db->escape($_POST['gender']) : ''; $forum_sig=!empty($_POST['forums_sig']) ? $db->escape($_POST['forums_sig']) : ''; $signature=!empty($_POST['signature']) ? $db->escape($_POST['signature']) : ''; $unqr=$db->query("SELECT `userid` FROM `users` WHERE `username`='{$username}'"); $emqr=$db->query("SELECT `userid` FROM `users` WHERE `email`='{$email}'"); $display_pic=!empty($_POST['display_pic']) ? $db->escape($_POST['display_pic']) : ''; $error=false; if($db->num_rows($unqr) && $db->escape($ir['username']) !=$_POST['username']) { $error=true; echo "Username in use.<br />"; } if($db->num_rows($emqr) && $db->escape($ir['email']) !=$_POST['email']) { $error=true; echo "Email in use.<br />"; } if((!empty($_POST['newpw']) || !empty($_POST['newpw2'])) && $_POST['newpw'] !=$_POST['newpw2']) { echo "New passwords do not match."; } elseif(!empty($_POST['newpw']) && !empty($_POST['newpw2']) && $_POST['newpw']==$_POST['newpw2']) { $pass=md5($_POST['newpw']); $db->query("UPDATE `users` SET `userpass`='{$pass}' WHERE `userid`='{$ir['userid']}'"); } if(!empty($_POST['display_pic'])) { $maxsize = 1000000; if(!$_SERVER['REQUEST_METHOD'] == "POST" || !isset($_SERVER['HTTP_USER_AGENT'])){ echo 'Hack Attempt!'; $h->endpage(); exit; } $headerinject = array("Content-Type:", "MIME-Version:", "Content-Transfer-Encoding:", "bcc:", "cc:"); foreach($_POST as $k => $v){ foreach($headerinject as $v2){ if(strpos($v, $v2) !== false){ logBadRequest(); header("HTTP/1.0 403 Forbidden"); exit; } } } /*What extensions can be used?*/ $valid = array('image/gif', 'image/png', 'image/pjpeg','image/jpeg', 'image/jpg'); /*If the extension isnt allowed...*/ if(!in_array($_FILES['imagefile']['type'], $valid)) { $type = strrchr($_FILES['imagefile']['name'], '.'); echo 'This file type '.$type.' is not allowed. Back'; $h->endpage(); exit; } /*Check image size*/ if ($_FILES['imagefile']['size'] > $maxsize) { echo 'Image to large Back'; $h->endpage(); exit; } $check = ''.$_FILES['imagefile']['tmp_name'].''; /*Check for .exe files*/ if (is_executable($check) || !is_file($check)) { echo 'The file '.$_FILES['imagefile']['name'].' seems to be harmful to the server Back'; @unlink($check); $h->endpage(); exit; } /*Now to create the correct image using php*/ if ($_FILES['imagefile']['type']=="image/jpeg") { $create = @ImageCreateFromJPEG(''.$_FILES['imagefile']['tmp_name'].''); $image = @Imagejpeg($create, 'profilepics/'.$_FILES['imagefile']['name'].''); } if ($_FILES['imagefile']['type']=="image/png") { $create = @ImageCreateFromPNG(''.$_FILES['imagefile']['tmp_name'].''); $image = @Imagepng($create, 'profilepics/'.$_FILES['imagefile']['name'].''); } if ($_FILES['imagefile']['type']=="image/jpg") { $create = @ImageCreateFromJPEG(''.$_FILES['imagefile']['tmp_name'].''); $image = @Imagejpeg($create, 'profilepics/'.$_FILES['imagefile']['name'].''); } if ($_FILES['imagefile']['type']=="image/gif") { $create = @ImageCreateFromGIF(''.$_FILES['imagefile']['tmp_name'].''); $image = @Imagegif($create, 'profilepics/'.$_FILES['imagefile']['name'].''); } if ($_FILES['imagefile']['type']=="image/pjpeg") { $create = @ImageCreateFromJPEG(''.$_FILES['imagefile']['tmp_name'].''); $image = @Imagejpeg($create, 'profilepics/'.$_FILES['imagefile']['name'].''); } /*Destroy the php image*/ @unlink(''.$_FILES['imagefile']['tmp_name'].''); @ImageDestroy($create); /*If php could not create the image*/ if (!$create) { echo 'The image you are trying to upload seems to be corrupt please try again! Back'; $h->endpage(); exit; } $path = 'profilepics/'; $pic = $_FILES['imagefile']['name']; $picture = $path.$pic; $oldpic = $ir['display_pic']; /*Check to see if its already uploaded*/ if ($picture == $oldpic) { echo ' Image already uploaded!Back'; $h->endpage(); exit; } /*Delete previous image to save space*/ $delete = ($oldpic); if ($delete) { echo 'Previous image deleted from system... '; } if (!$delete) { echo 'No Previous image to be deleted... '; } $dataa = $_FILES['imagefile']['size']; $datab = $_FILES['imagefile']['type']; $datad = $_FILES['imagefile']['name']; /*Information for user*/ echo 'Old Image Location: '.$oldpic.' New Image Location: '.$picture.' Image Uploaded <u>Info:</u> Image Name: '.$datad.' Image Size: '.$dataa.' bytes Type: '.$datab.' Back'; /*Check DB*/ $check = $db->query( sprintf("SELECT COUNT(*) as cnt FROM `users` WHERE `display_pic` = '%s'", $db->escape($picture))); $checks = $db->fetch_row($check); if ($checks['cnt'] > 0) { echo 'Please use another image name Back'; $h->endpage(); exit; } /*Update DB*/ } if($error==false) { $db->query("UPDATE `users` SET `username`='{$username}',`email`='{$email}',`gender`='{$gender}',`forums_signature`='{$forum_sig}',`signature`='{$signature}' WHERE `userid`='{$ir['userid']}'"); $path = 'profilepics/'; $pic = $_FILES['imagefile']['name']; $picture = $path.$pic; $db->query( sprintf("UPDATE `users` SET `display_pic` = '%s' WHERE `userid` = %u", $db->escape($picture), $userid)); } } else { echo '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data"><table width="95%"> <tr><td>Username:</td><td><input type="text" name="username" value="'.htmlspecialchars($ir['username']).'" class="inputs"/></td></tr> <tr><td>Email:</td><td><input type="text" name="email" value="'.htmlspecialchars($ir['email']).'" class="inputs"/></td></tr> <tr><td>Password:</td><td><input type="password" name="newpw1" class="inputs"/></td></tr> <tr><td>Confirm Password:</td><td><input type="password" name="newpw2" class="inputs"/></td></tr> <tr><td>Gender:</td><td><select name="gender" class="inputs">'; $gens=array('Male','Female'); foreach($gens as $k => $v) { if($ir['gender']==$v) { echo '<option selected="selected">'.$v.'</option>'; } else { echo '<option>'.$v.'</option>'; } } echo '</select> </td></tr> <tr><td>Display Pic:</td><td><input type="file" name="imagefile" class="inputs"/></td></tr> <tr><th style="text-align: left;">Forum Signature</th> <td><textarea rows="4" cols="100" name="forums_sig">'.htmlspecialchars($ir['forums_signature']).'</textarea></td></tr> <tr><th style="text-align: left;">Profile Signature</th> <td><textarea rows="6" cols="100" name="signature">'.htmlspecialchars($ir['signature']).'</textarea></td></tr> <tr><td></td><td><input type="submit" value="Save" class="formbutton"/></td></tr> </table></form>'; } $h->endpage(); exit(); ?> -
Account page layout with display pic upload
boionfire81 replied to boionfire81's topic in Requests & In Production
[uSER=68711]KyleMassacre[/uSER] any idea? -
Yeah, I'm not good with Inner joins. So here is the new pack it file. <?php /********* Created by: Boi Fixed By: MWG Community This is a FREE mod for McCodes V2 Distribution is ok BUT It is NOT to be sold **********/ require_once('globals.php'); global $db, $userid, $ir; $_GET['ID'] = (isset($_GET['ID']) && is_numeric($_GET['ID'])) ? abs(intval($_GET['ID'])) : ''; $_POST['qty'] = (isset($_POST['qty']) && is_numeric($_POST['qty'])) ? abs(intval($_POST['qty'])) : ''; if (!empty($_POST['qty']) && !empty($_POST['ID'])) { $id = $db->query( "SELECT `inv_qty`, `inv_itemid`, `itmname`, `itmid`, `inv_id`, `bp_qty`, `bp_itemid`, `bp_id` FROM `inventory` AS `iv` INNER JOIN `items` AS `it` ON `iv`.`inv_itemid` = `it`.`itmid` INNER JOIN `backpack` AS `bp` ON `iv`.`inv_itemid` = `bp`.`bp_itemid` WHERE `iv`.`inv_id` = {$_POST['ID']} AND `bp`.`bp_id` = {$_POST['ID']} AND iv.`inv_userid` = {$userid} LIMIT 1"); if ($db->num_rows($id) == 0) { echo 'Invalid item ID'; } else { $r = $db->fetch_row($id); $space = ($ir['maxbackpack'] - $ir['backpack']); if ($_POST['qty'] > $r['inv_qty']) { echo 'You are trying to pack more than you have!'; } else if ($_POST['qty'] > $space) { echo 'You do not have that much room in your backpack!'; } else { item_remove($userid, $_GET['ID'], $_POST['qty']); $db->query("INSERT INTO `backpack`(`bp_id`, `bp_itemid`, `bp_userid`, `bp_qty`, `bp_lent`, `bp_helmet`, `bp_boots`, `bp_amulet`, `bp_braclet`, `bp_ring`, `bp_special`) VALUES ('',{$_POST['ID']},{$userid},{$_POST['qty']},'','','','','','','')"); echo 'You packed ' . $_POST['qty'] . ' ' . $r['itmname'] . '(s)'; } } $db->free_result($id); } else if (!empty($_GET['ID'])) { $id = $db->query( "SELECT `inv_qty`, `itmname` FROM `inventory` iv INNER JOIN `items` AS `it` ON `iv`.`inv_itemid` = `it`.`itmid` WHERE `iv`.`inv_id` = {$_GET['ID']} AND `iv`.`inv_userid` = $userid LIMIT 1"); if ($db->num_rows($id) == 0) { echo 'Invalid item ID'; } else { $r = $db->fetch_row($id); $space = ($ir['maxbackpack'] - $ir['backpack']); echo " <b>Enter how many {$r['itmname']} you want to pack. You have {$r['inv_qty']} and $space spaces available.</b> <br /> <form action='packit.php' method='post'> Quantity: <input type='text' name='qty' value='' /> <br /> <input type='hidden' name='userid' value='{$userid}' /> <input type='hidden' name='ID' value='{$_GET['ID']}'> <input type='submit' value='Pack' /> </form>"; } echo $_GET['ID']; $db->free_result($id); } else { echo 'Invalid use of file.'; } $h->endpage(); now it is Invalid item ID
-
ok changed all instances of inv_ to bp_ in phpmyadmin modified the item insert to $db->query("INSERT INTO `backpack`(`bp_id`, `bp_itemid`, `bp_userid`, `bp_qty`, `bp_lent`, `bp_helmet`, `bp_boots`, `bp_amulet`, `bp_braclet`, `bp_ring`, `bp_special`) VALUES ('',{$_POST['ID']},{$userid},{$_POST['qty']},'','','','','','','')"); but not sure about how to mod this part $id = $db->query( "SELECT `inv_qty`, `itmname` FROM `inventory` iv INNER JOIN `items` AS `it` ON `iv`.`inv_itemid` = `it`.`itmid` WHERE `iv`.`inv_id` = {$_GET['ID']} AND `iv`.`inv_userid` = $userid LIMIT 1"); as is it gives this error: A critical error has occurred, and page execution has stopped. Below are the details: 1054: Unknown column 'itmname' in 'field list' Action taken: Attempted to execute query: SELECT `inv_qty`, `inv_itemid`, `itmname`, `itmid`, `inv_id` FROM `inventory` AS `iv` INNER JOIN `backpack` AS `bp` ON `iv`.`inv_itemid` = `bp`.`itmid` WHERE `iv`.`inv_id` = 156 AND iv.`inv_userid` = 1 LIMIT 1
-
Ok, UPDATE else { item_remove($userid, $_GET['ID'], $_POST['qty']); $db->query("INSERT INTO `backpack`(`inv_id`, `inv_itemid`, `inv_userid`, `inv_qty`, `inv_lent`, `equip_helmet`, `equip_boots`, `equip_amulet`, `equip_braclet`, `equip_ring`, `equip_special`) VALUES ('{$_POST['ID']}',{$_POST['ID']},{$userid},{$_POST['qty']},'','','','','','','')"); echo 'You packed ' . $_POST['qty'] . ' ' . $r['itmname'] . '(s)'; } A critical error has occurred, and page execution has stopped. Below are the details: 1052: Column 'inv_qty' in field list is ambiguous Action taken: Attempted to execute query: SELECT `inv_qty`, `inv_itemid`, `itmname`, `itmid`, `inv_id` FROM `inventory` AS `iv` INNER JOIN `backpack` AS `it` ON `iv`.`inv_itemid` = `it`.`itmid` WHERE `iv`.`inv_id` = 156 AND iv.`inv_userid` = 1 LIMIT 1