Jump to content
MakeWebGames

SRB

Members
  • Posts

    699
  • Joined

  • Last visited

  • Days Won

    60

SRB last won the day on August 28

SRB had the most liked content!

2 Followers

Recent Profile Visitors

39,568 profile views

SRB's Achievements

Apprentice

Apprentice (3/14)

  • Conversation Starter Rare
  • Very Popular Rare
  • Dedicated Rare
  • First Post Rare
  • Collaborator Rare

Recent Badges

210

Reputation

  1. You know, I gave up trying to use AlpineJS on this and just wrote some quick PHP. This means it's not going to generate without a page load, but it's a finished, working copy. Example output (For markings, use comma-separated to extend list) <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Kitten Generator</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/1.1.4/tailwind.min.css"> </head> <body> <div class="antialiased w-screen min-h-screen bg-gray-900 pb-12"> <form action="" method="post"> <div> <div class="max-w-6xl mx-auto flex pt-12"> <div class="w-1/2 p-4"> <h1 class="text-white text-3xl">Mother</h1> </div> <div class="w-1/2 p-4"> <h1 class="text-white text-3xl">Father</h1> </div> </div> <div class="max-w-6xl mx-auto flex"> <div class="w-1/2 p-4 border-r border-gray-500"> <div class="block mb-4"> <label> <span class="block text-gray-300 text-sm">Body Size</span> <input type="text" name="mother-body-size" id="mother-body-size" value="<?=requestValueByKey($_POST, 'mother-body-size') ?>" class="mt-1 block w-full shadow-sm sm:text-lg border-gray-300 rounded px-2" tabindex="1" /> </label> </div> <div class="block mb-4"> <label> <span class="block text-gray-300 text-sm">Build</span> <input type="text" name="mother-build" id="mother-build" value="<?=requestValueByKey($_POST, 'mother-build') ?>" class="mt-1 block w-full shadow-sm sm:text-lg border-gray-300 rounded-md px-2" tabindex="3" /> </label> </div> <div class="block mb-4"> <label> <span class="block text-gray-300 text-sm">Ears</span> <input type="text" name="mother-ears" id="mother-ears" value="<?=requestValueByKey($_POST, 'mother-ears') ?>" class="mt-1 block w-full shadow-sm sm:text-lg border-gray-300 rounded-md px-2" tabindex="5" /> </label> </div> <div class="block mb-4"> <label> <span class="block text-gray-300 text-sm">Eye Color</span> <input type="text" name="mother-eye-color" id="mother-eye-color" value="<?=requestValueByKey($_POST, 'mother-eye-color') ?>" class="mt-1 block w-full shadow-sm sm:text-lg border-gray-300 rounded-md px-2" tabindex="7" /> </label> </div> <div class="block mb-4"> <label> <span class="block text-gray-300 text-sm">Nose / Paw Pads</span> <input type="text" name="mother-nose-paw-pads" id="mother-nose-paw-pads" value="<?=requestValueByKey($_POST, 'mother-nose-paw-pads') ?>" class="mt-1 block w-full shadow-sm sm:text-lg border-gray-300 rounded-md px-2" tabindex="9" /> </label> </div> <div class="block mb-4"> <label> <span class="block text-gray-300 text-sm">Pelt Length</span> <input type="text" name="mother-pelt-length" id="mother-pelt-length" value="<?=requestValueByKey($_POST, 'mother-pelt-length') ?>" class="mt-1 block w-full shadow-sm sm:text-lg border-gray-300 rounded-md px-2" tabindex="11" /> </label> </div> <div class="block mb-4"> <label> <span class="block text-gray-300 text-sm">Pelt Color</span> <input type="text" name="mother-pelt-color" id="mother-pelt-color" value="<?=requestValueByKey($_POST, 'mother-pelt-color') ?>" class="mt-1 block w-full shadow-sm sm:text-lg border-gray-300 rounded-md px-2" tabindex="13" /> </label> </div> <div class="block mb-4"> <label> <span class="block text-gray-300 text-sm">Pelt Markings</span> <input type="text" name="mother-pelt-markings" id="mother-pelt-markings" value="<?=requestValueByKey($_POST, 'mother-pelt-markings') ?>" class="mt-1 block w-full shadow-sm sm:text-lg border-gray-300 rounded-md px-2" tabindex="15" /> </label> </div> <div class="block mb-4"> <label> <span class="block text-gray-300 text-sm">Mutation</span> <input type="text" name="mother-mutation" id="mother-mutation" value="<?=requestValueByKey($_POST, 'mother-mutation') ?>"class="mt-1 block w-full shadow-sm sm:text-lg border-gray-300 rounded-md px-2" tabindex="17" /> </label> </div> </div> <div class="w-1/2 p-4"> <div class="block mb-4"> <label> <span class="block text-gray-300 text-sm">Body Size</span> <input type="text" name="father-body-size" id="father-body-size" value="<?=requestValueByKey($_POST, 'father-body-size') ?>" class="mt-1 block w-full shadow-sm sm:text-lg border-gray-300 rounded-md px-2" tabindex="2" /> </label> </div> <div class="block mb-4"> <label> <span class="block text-gray-300 text-sm">Build</span> <input type="text" name="father-build" id="father-build" value="<?=requestValueByKey($_POST, 'father-build') ?>" class="mt-1 block w-full shadow-sm sm:text-lg border-gray-300 rounded-md px-2" tabindex="4" /> </label> </div> <div class="block mb-4"> <label> <span class="block text-gray-300 text-sm">Ears</span> <input type="text" name="father-ears" id="father-ears" value="<?=requestValueByKey($_POST, 'father-ears') ?>" class="mt-1 block w-full shadow-sm sm:text-lg border-gray-300 rounded-md px-2" tabindex="6" /> </label> </div> <div class="block mb-4"> <label> <span class="block text-gray-300 text-sm">Eye Color</span> <input type="text" name="father-eye-color" id="father-eye-color" value="<?=requestValueByKey($_POST, 'father-eye-color') ?>" class="mt-1 block w-full shadow-sm sm:text-lg border-gray-300 rounded-md px-2" tabindex="8" /> </label> </div> <div class="block mb-4"> <label> <span class="block text-gray-300 text-sm">Nose / Paw Pads</span> <input type="text" name="father-nose-paw-pads" id="father-nose-paw-pads" value="<?=requestValueByKey($_POST, 'father-nose-paw-pads') ?>" class="mt-1 block w-full shadow-sm sm:text-lg border-gray-300 rounded-md px-2" tabindex="10" /> </label> </div> <div class="block mb-4"> <label> <span class="block text-gray-300 text-sm">Pelt Length</span> <input type="text" name="father-pelt-length" id="father-pelt-length" value="<?=requestValueByKey($_POST, 'father-pelt-length') ?>" class="mt-1 block w-full shadow-sm sm:text-lg border-gray-300 rounded-md px-2" tabindex="12" /> </label> </div> <div class="block mb-4"> <label> <span class="block text-gray-300 text-sm">Pelt Color</span> <input type="text" name="father-pelt-color" id="father-pelt-color" value="<?=requestValueByKey($_POST, 'father-pelt-color') ?>" class="mt-1 block w-full shadow-sm sm:text-lg border-gray-300 rounded-md px-2" tabindex="14" /> </label> </div> <div class="block mb-4"> <label> <span class="block text-gray-300 text-sm">Pelt Markings</span> <input type="text" name="father-pelt-markings" id="father-pelt-markings" value="<?=requestValueByKey($_POST, 'father-pelt-markings') ?>" class="mt-1 block w-full shadow-sm sm:text-lg border-gray-300 rounded-md px-2" tabindex="16" /> </label> </div> <div class="block mb-4"> <label> <span class="block text-gray-300 text-sm">Mutation</span> <input type="text" name="father-mutation" id="father-mutation" value="<?=requestValueByKey($_POST, 'father-mutation') ?>" class="mt-1 block w-full shadow-sm sm:text-lg border-gray-300 rounded-md px-2" tabindex="18" /> </label> </div> <div class="block mb-4"> <label> <span class="block text-gray-300 text-sm">Randomize Amount</span> <select name="amount" class="mt-1 block w-full shadow-sm sm:text-lg border-gray-300 rounded-md px-2 pl-2"> <?php foreach (array_reverse(range(1, 10)) as $number) { $selected = array_key_exists('amount', $_POST) && (int)$_POST['amount'] === $number ? 'selected="selected"' : ($number === 5 ? 'selected="selected"' : ''); echo "<option value=\"$number\" $selected>$number</option>"; } ?> </select> </label> </div> </div> </div> <div class="max-w-4xl mx-auto flex justify-center mt-8"> <button type="submit" class="inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-gray-600 hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500">Randomize</button> </div> </div> </form> <div class="max-w-6xl mx-auto flex justify-center flex-wrap mt-6 border-t pt-6"> <?php $amount = array_key_exists('amount', $_POST) ? (int)$_POST['amount'] : false; if ($amount) { for ($i = 1; $i <= $amount; $i++) { $body_size = randomizeAttribute([$_POST['mother-body-size'], $_POST['father-body-size']]); $build = randomizeAttribute([$_POST['mother-build'], $_POST['father-build']]); $ears = randomizeAttribute([$_POST['mother-ears'], $_POST['father-ears']]); $eye_color = randomizeAttribute([$_POST['mother-eye-color'], $_POST['father-eye-color']]); $nose_paw_pads = randomizeAttribute([$_POST['mother-nose-paw-pads'], $_POST['father-nose-paw-pads']]); $pelt_length = randomizeAttribute([$_POST['mother-pelt-length'], $_POST['father-pelt-length']]); $pelt_color = randomizeAttribute([$_POST['mother-pelt-color'], $_POST['father-pelt-color']]); $pelt_markings = randomizeAttribute(array_merge( array_map(static function($arg) { return trim($arg); }, explode(',', $_POST['mother-pelt-markings'])), array_map(static function($arg) { return trim($arg); }, explode(',', $_POST['father-pelt-markings'])), )); $mutation = randomizeAttribute([$_POST['mother-mutation'], $_POST['father-mutation']]); echo <<<KITTEN <div class="inline text-left box-border p-3 w-1/4"> <div class="border box-border p-2"> <h3 class="text-gray-300 font-bold border-b pb-1 mb-1"> Random Kitten #$i </h3> <div class="text-gray-300 body-size"> <span class="font-semibold">Body Size : </span> <span class="float-right">$body_size</span> </div> <div class="text-gray-300 build"> <span class="font-semibold">Build : </span> <span class="float-right">$build</span> </div> <div class="text-gray-300 ears"> <span class="font-semibold">Ears : </span> <span class="float-right">$ears</span> </div> <div class="text-gray-300 eye-color"> <span class="font-semibold">Eye Color : </span> <span class="float-right">$eye_color</span> </div> <div class="text-gray-300 nose-paw-color"> <span class="font-semibold">Nose / Paw Color : </span> <span class="float-right">$nose_paw_pads</span> </div> <div class="text-gray-300 pelt-length"> <span class="font-semibold">Pelt Length : </span> <span class="float-right">$pelt_length</span> </div> <div class="text-gray-300 pelt-color"> <span class="font-semibold">Pelt Color : </span> <span class="float-right">$pelt_color</span> </div> <div class="text-gray-300 pelt-markings"> <span class="font-semibold">Pelt Markings : </span> <span class="float-right">$pelt_markings</span> </div> <div class="text-gray-300 mutation"> <span class="font-semibold">Mutation : </span> <span class="float-right">$mutation</span> </div> </div> </div> KITTEN; } } ?> </div> </div> </body> </html> <?php function randomizeAttribute(array $array = []): string { if (!count($array)) { return 'N/A'; } return ucwords($array[rand(0, count($array) - 1)]); } function requestValueByKey(array $array, string $key) { if (!is_array($array) || !array_key_exists($key, $array)) { return ''; } return $array[$key]; }
  2. SRB

    My own engine

    MC Codes crime formula was what allowed people to drop databases if they could get access to an admin account - or reverse engineer that privilidge. It passes via eval(), which allows you to execute drop table queries. Oh, the memories and good time 😄
  3. Null Coalesce, baby! $this->sex = $row['gender'] ?? null; Onto that function - that is TOTALLY the wrong approach. At the very least, that function should early-return an error, since you are selecting from the database by an integer field. If you are selecting by integer, your $id default should be an integer, so: function __construct($id = 0) Querying and then converting all the queries seems like you're adding complexity for no reason too. Simply assign the results of $row to $this->user, like so: function __construct($id = 0) { global $db; $db->query('SELECT userid, name, pass, level, experance, jail, hospital, gender, race FROM players WHERE userid = ?'); $db->execute([$id]); $row = $db->fetch_row(true); if (is_null($row)) { throw new Exception('User could not be found.'); } $this->user = $row; } Also, note the early-return? If there is no result, you should stop processing because you don't have the data required for the function I'd say, since you're loading this in the __construct, that would normally indicate it's needed. The above then let's you access all object properties using $this->user->field $this->user->userid $this->user->name $this->user->pass $this->user->level $this->user->experience $this->user->jail $this->user->hospital $this->user->gender $this->user->race PS: Experience is spelt wrong. Shouldn't be a comma after race in the query either; that will break the query and return nothing.
  4. It's telling you it's returning null in the error, so I'd say that either, 1) You do not have a default, or have not set, the value for gender (use NOT NULL in the database creation SQL) 2) You are selecting an invalid response. Note: If you are posting code, please post code - 5 lines before, 5 lines after - PHP's error handling doesn't already pick the correct line.
  5. The AlpineJS is where my confusion is. I'm so used to using jQuery, which will eventually die off as more JS front ends come along, and work is kicking my ass. The form is already done (using TailwindCSS): https://codepen.io/MrMarlow/pen/zYwyRRx If someone wants to wrap it up, the base is there - just needs to generate the list when clicking Randomize
  6. $1 a month? Shoot me your PayPal and I'll give you $12 for a year.
  7. I don't think it's needed - sounds pretty much standalone, unless the answers to my previous questions say otherwise. I'm in the process of building something (for free), just so I have an excuse to play around with TailwindCSS and AlpineJS just... because I wanna play with them. (All random results are currently static, obviously)
  8. The post doesn't state much detail with regards to what happens with the data; 1. Does the list save anywhere, or is this just so people can copy and paste the results for whatever reason this is needed? 2. From that picture, it makes me feel like it randomly (for each kitten) just picks between the options from the mothers and fathers details - is that correct? Or can random options be a result? 3. Does this have an admin panel for adding/removing options for each drop down, or do you have a pre-defined list? Re-read and saw text fields. Think that covers the questions that'll be needed to realistically build a picture of work needed 🙂
  9. SRB

    Romewars

    Might want to disable the profiler on production. It exposes a lot of information that shouldn't be exposed.
  10. SRB

    Blackjack Battle

    https://www.virustotal.com/gui/url/47391a0c11d1bd36a07c3f182f4b580206914839e316bc02b150abc38ab589c0/detection
  11. Please do continue to selectively take the pieces you want for your narrative. Let’s not discuss the years where everyone who signed up was a freeloader and expected everything handed to them. @MTG - if you want to tell me directly to stop posting, please do so. Both times you say to stop the off topic, is after someone replies to me. Feels biased.
  12. Oh, we are now at the point we call each other derogatory names? I'm fine with the one you want to use, and do not mind if you wish to dig deeper in your insulting name box. I've been SomeRandomBastard for many years here, now shortened to SRB as the forum made the name format like shit when it was updated. You can also call me a bastard if you wish, I'm a big boy and don't need to sulk because your twisted panties have you throwing insults around. Since you questioned where I started, and my story, you can have it: When I started here in 2005 (as one of the first 300 accounts on the original criminal existence forums), the likes of Cronus, Arson, Silver, etc, would literally berate your work when you posted - and yes, when I started, my code was shit. I was told that a lot too. Did I cry? No, I took it and threw myself at learning, and 12 months later I hacked their games and took their games offline - you know, because "fuck them", right? I believe it was Cronus who actually called me a bastard for doing it, and then the name SomeRandomBastard was born. I then spent many years releasing bug fixes for other people's paid mods, for free, because the same people who berated me wouldn't support their own (paid) work. I then took it upon myself to build my own versions of their paid mods and release them for free to disrupt their sales, because once again "fuck them", right? I still have that folder of mods, and looking back, they suck shit too. That said, it was 16 years ago, so I was probably more focused on alcohol and booty. Anyway, after the initial years where this place was booming and most people were learning to code, we had a couple years of "Can someone fix this for me", "How do I do X", "I NEED HELP" threads where hardly anybody who signed up actually wanted to (a) pay for experience or (b) spend any time learning ANYTHING themselves. We had a wave of little asshats who wanted spoon feeding. Those years caused a lot of people to leave, or become bored of people putting in ZERO effort - much like this template - and posting for the sake of posting. I stand by my original post - if he's serious about design, stop focusing on owning a game and load up some tutorials. Nobody here is deluded, if he wants to learn, he can get a cracked version of photoshop from a torrent somewhere. If he wants to own a game, he should focus on code and just buy a cheap ass template, and learn code. There's very few people who are actually good at both code and design, so he needs to pick one. Yes, I am aware some people are capable of both, but they are few and far between. @Dave being one of the first ones that come to mind. Moving on: I went in like I was some kind of genius in that field? I outright said I suck at graphics, but even knowing I suck, I would do somewhat better than what was posted here. Anyway, back to programming as my day job because I am a professional in my field. I look forward to your response, but be aware, I don't value your opinion - I've earned my stripes here and supported more code, and games, over the years when CE/MWG was at it's peak, than any newcomer probably ever will. Wait, now I understand. I just need to call it baby poop rather than shit, even thought both mean faeces? Sweet. The template is absolute poop.
  13. Bet you're fun at parties. Let's be honest on 2 fronts though: 1) The advertising doesn't matter. The tumbleweed has more life here than the message form. 2) The design sucks shit. Honestly, what way can that be better expressed? Not like we can say "Hey, move that line a little and thicken the font, and it'll look sleeker", or something. Literally needs deleting, and some graphic tutorials watched. Sorry if some brutal honesty gets your lacy underwear all twisted up, but this isn't a neopets fluffy group.
  14. Nope, he's coming to collect his reality check.
×
×
  • Create New...