Jump to content
MakeWebGames

Waffle

Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Everything posted by Waffle

  1. Re: [All Sites] No file images This may be a stupid question.. but what exactly does this code do? :?
  2. Re: [Other] Website Template Try to condense some of your CSS property's.. for example:   div#wrapper { width: 80%; background: #fefefe; margin-top: 50px; margin-bottom: 50px; margin-left: auto; margin-right: auto; padding: 0px; border: thin solid #222222; }   Could just be:   #wrapper { width: 80%; background: #fefefe; margin: 50px auto 50px auto; padding: 0px; border: 1px solid #222; }   Also, try to use a smaller background image, that one is huge. :lol:
  3. Re: [mccode v2] Anolog Clock I can understand a small PHP clock to show the current server time.. but why get all fancy? What the hell is wrong with the clock on the persons computer already? Why slow the page down so that they can see yet another clock, when most already have one in the bottom corner of their screen.. Anyways, on with your argument..
  4. Re: [Mccode V2] Comment Board Although your idea is a good one, the implementation is flawed.. From what I've seen you have two really big security issues in the code. 1). In the form on the second input:   Poster: <input type='text' name='cPOSTER' value='{$ir['username']}' readonly='readonly'>   What stops someone changing the value of that to another username? As the value goes client side before being processed. How about adding the ID to the comment when it gets processed, that way you can query the ID when the comment gets displayed. That way when if the person changes their username, the name to the comment gets changed as well. 2). You don't check and/or sanitize the data before it gets put in the database...   $db->query("INSERT INTO `staff_comments` VALUES ('', '{$_POST['cCOMMENT']}', '{$_POST['cPOSTER']}')");   What stops someone putting their own code in there? Javascript or SQL. How about doing something like:   function confirmadd() { global $db, $ir, $c, $h, $userid; $comment1 = htmlentities($_POST['cCOMMENT']); $comment = addslashes($comment1); $db->query("INSERT INTO `staff_comments` VALUES ('', '$comment', '{$ir['username']}')"); echo 'Your comment has been added to the game!'; }   Anyhoo, nice mod, just always make sure to check the input before it goes into the database.. :-)
  5. Not sure if this has been done before,so yeah, sorry in advance if it has. But, after looking through most of the mods section, and searching for anything like it I found nothing.. Anyhoo, quick small mod to add images to houses. No SQL, yey! One page and a small addon for index.php and smenu.php   First off copy and paste this and save it as house_app.php <?php include "sglobals.php"; global $db, $ir, $c, $h, $userid, $set; if($ir['user_level'] != 2) { echo 'Admins Only!'; exit; } echo '<h3>House Image</h3> <hr /> '; echo "<form method='get' action='house_app.php'>" , house_dropdown($c, "house") , "<input type='submit' value='Submit' /> </form> <hr /> "; $hid = $_GET['house']; $query = mysql_query("SELECT `hNAME` FROM `houses` WHERE `hID` = '$hid'"); $row = mysql_fetch_array($query); $hname = $row['hNAME']; $hash = md5($row['hNAME']); if (empty($hname)) { echo 'Property does not exist!'; exit; } echo <<<EOF <table width='75%' border='1'> <tr> <td>House ID:</td> <td>$hid</td> </tr> <tr> <td>House Name:</td> <td>$hname</td> </tr> <tr> <td>Image SRC:</td> <td>$hash</td> </tr> </table> EOF; ?>   Then add this under the first table in index.php, or any where you want I guess.. $hname = $ir['hNAME']; $hid = $ir['hID']; $src = md5($ir['hNAME']); echo ' ' , '<img src=\'houses/' , $src , '.jpg\' alt=\'' , $hname , '\' />';   Finally, the link for smenu.php > [url='house_app.php']House Image[/url]   What it does: All this app/mod does it generate a md5 hash of the house name in index.php, and then outputs it as part of the filename. Then, all you do is get whatever image you want for the house and lookup the house name and assoctiated hash in house_app.php and save the image as that. Not the prettiest of solutions, but works fine for me. Small note, the default directory for the house images, is 'houses', so if you want to use a different directory you'll need to change this line in index.php: echo ' ' , '<img src=\'houses/' , $src , '.jpg\' alt=\'' , $hname , '\' />';   Changing the "houses" line..
×
×
  • Create New...