Jump to content

Strider64

Members
  • Content Count

    293
  • Joined

  • Last visited

  • Days Won

    3

Strider64 last won the day on January 6

Strider64 had the most liked content!

Community Reputation

19 Neutral

About Strider64

  • Rank
    Advanced Member
  • Birthday 08/28/1964

Contact Methods

  • Website URL
    http://www.pepster.com

Profile Information

  • Gender
    Male
  • Location
    A burb of Detroit, MI

Recent Profile Visitors

5,671 profile views
  1. To me that would be more ideal for a client side web app (like JavaScript) than a server-side app (PHP). They wouldn't have to use the back button at all and you could even use JavaScript, Ajax and PHP if you want to use a MySQL table. To give you an idea here is an example of a trivia game that I wrote for my website - https://www.miniaturephotographer.com/game.php I'm still developing it, but it works pretty darn good and you can do all sorts of things to it.
  2. You're not echoing out the content <h4><?php the_title(); ?> </h4> should be <h4><?php echo the_title(); ?> </h4> /* or this */ <h4><?= the_title() ?> </h4>
  3. e.preventDefault() will stop the HTML button from firing: submit.addEventListener('click', (e) => { e.preventDefault(); sendEmail.phone = phone.value; sendEmail.website = website.value; sendEmail.response = submit.getAttribute('data-response'); if (sendStatus.name && sendStatus.email && sendStatus.comments) { saveRequest(sendUrl, sendUISuccess, sendUIError); } else { notice.style.display = "block"; notice.textContent = "Name, Email, and Message Required!"; } }, false);
  4. If the code doesn't work, but the only solution is to use arrays then learning about arrays is probably only option? There's a reason why the code stopped working and that is you added extra conditions to the script. Instead of single images there are now multiple images? (I'm assuming and you know what they say about assuming. 😃) Learning arrays isn't that tough. It is one of the first things that is taught in any coding language.
  5. Well, it's not actually cropping, but resizing function that I wrote and I have been testing it out on my website. So far it's been working like I expect it to. Though I imagine you could modify the script to do cropping? <?php function imageResize($imageSrc, $imageWidth, $imageHeight, $newImageWidth, $newImageHeight): GdImage|bool { $newImageLayer = imagecreatetruecolor($newImageWidth, $newImageHeight); imagecopyresampled($newImageLayer, $imageSrc, 0, 0, 0, 0, $newImageWidth, $newImageHeight, $imageWidth, $imageHeight); return $newImageLayer; } function resize($file_tem
  6. or you could simply have a small function of some kind to use a full name: function fullname($user) { return $user['firstname'] . " " . $user['lastname']; }
  7. If you are not using Fetch then you need to parse the data: var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { var myObj = JSON.parse(this.responseText); document.getElementById("demo").innerHTML = myObj.name; } }; xmlhttp.open("GET", "json_demo.txt", true); xmlhttp.send();
  8. The methods/functions in the DbBox class to me is redundant unless you are going to override them, but like requinix stated "really, really, really vague question" to help with. I use the Active Record Design Pattern and those two classes would just be silly to me.
  9. Ooops read it wrong ..... please delete 😃
  10. 🤔 Hmm? Something tells me that isn't true. 🤥😔
  11. I have been updating my website to include the Active Response Design pattern using PHP pdo. I have most to the pdo done with a few minor refinements and improvements. If you want to get some ideas or inspiration check out my GitHub repository : https://github.com/Strider64/Miniature01282021 I know there's better out there, but it' not to bad for a person who is 56 that has only been programming in PHP the last 6-7 years (though I have previous coding experience in other languages).
  12. I would personally just do it silently with an unique constraint in MySQL and not advertising it too much to users. The more you broadcast it or let it be known that an username exists the more like they will attack your website. I'm not saying NOT to do it, but simply say "username can't be used at this time", "Choose a different username" or something more vague than that after the user attempts to registers. It's usually not that big of deal having to come up with a different username as you can save all the other registration info (except password) back on the HTML form as a convenience to
  13. Exactly what the error says $data is a string not an array. You also have other errors.
  14. This is how I do it: My Database Class: <?php namespace Miniature; use PDO; class Database { private $_connection; // Store the single instance. private static $_instance; // Get an instance of the Database. // @return Database: protected static function getInstance(): Database { if (!self::$_instance) { self::$_instance = new self(); } return self::$_instance; } public static function pdo(): PDO { $db = static::getInstance(); return $db->getConnection(); } // Constructor -
  15. I will chime in with my thoughts. I bet most of your website could be fixed to look good on mobile devices by doing some CSS tweaks. It doesn't have to look the greatest as all it needs to look good. Here's what I do, first for all browsers including mobile: /*-------------------------------------------------------------- Basic responsive layout for all browsers: --------------------------------------------------------------*/ .site { background-color: #fff; max-width: 75em; margin: 0 auto; } Then inside a media query for modern browsers (Firefox, Chrome for PCs)
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.