Jump to content

Strider64

Members
  • Content Count

    282
  • Joined

  • Last visited

  • Days Won

    3

Strider64 last won the day on January 6

Strider64 had the most liked content!

Community Reputation

18 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,560 profile views
  1. 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
  2. Exactly what the error says $data is a string not an array. You also have other errors.
  3. 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 -
  4. 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)
  5. My opinion using grid and flex together would do the trick. Though you could even even accomplish with just flex, but it gets a little tricky if you have to change the number of columns. Though you can fix that problem using JavaScript.
  6. Well, I find syntax bugs to be a pain when you have logic errors on top of them. You fix all the syntax bugs and you code doesn't work the way you expect it to then you feel like you just wasted a couple hours of work, plus you feel like banging you head against the desk. The best way to learn PHP in my opinion is to learn the code syntax properly by going to php.net and following tutorials. An IDE is just away to debug syntax errors more quickly in order for you to concentrate on the logical errors. That's my opinon.
  7. I don't know if I'm on the right track and I use DateTime(), but I'm sure it can be done with date as well. <?php $firstMonday = new DateTime("January 1, 2021", new DateTimeZone("America/Detroit")); if ($firstMonday->format("l") === "Sunday") { $firstMonday->modify("last Monday"); echo $firstMonday->format("F j, Y -l") . "<br>"; } else { $firstMonday->modify("Monday"); echo $firstMonday->format("F j, Y -l"); }
  8. I agree learning a basic programming language services is a great foundation in learning other programming languages. I'm 56 years and when I first was learning programming I was had a class in Pascal (I think that was the language) that set the tone for other languages. After learning the first language I would suggest learning C+ as that programming language is very similar to a lot of languages that will make you say I seen that before and then realize it was C+. It doesn't have to be that in-depth learning C+ as getting the basics would be enough in my opinion.
  9. Personally I just redirect to another php file if a certain about of text should only be displayed. I do it like the following: public function getIntro($content = "", $count = 200, $pageId = 0) {; $this->content = (string) $content; return substr($this->content, 0, (int)$count) . '<a class="moreBtn" href="mainArticle.php?page=' . (int)$pageId . '"> ...more</a>'; } If I want to have is stay on the same page I simply would just introduce vanilla javascript. (Which I might after I get done overhauling my website) I just simply display a page
  10. Personally I wouldn't start off learning PDO by doing try-catch statements as in my opinion will cause more confusion than it is worth. Simply have error reporting turned on to catch the errors. I personally don't like writing foreach statements that way, I would write it something like the following: <?php foreach ($result as $text) { echo '<blockquote>'; echo '<p>' . htmlspecialchars($text['joketext']) . '</p>'; echo '</blockquote>'; } ?> as for the pdo I would do something like the following: $db_options = array( /* i
  11. I know it would mean basically starting over, but something like this is screaming pagination. Here's a small cms example using pagination for my website: /* * Pagination Code */ $current_page = htmlspecialchars($_GET['page'] ?? 1); // Current Page Location: $per_page = 3; // Total articles per page $total_count = $journal::countAll(); // Totoal articles in database table: $pagination = new Pagination($current_page, $per_page, $total_count); Here's the Pagination Class: <?php namespace Miniature; use PDO; use Miniature\Database as DB; class Pagination extends Jo
  12. Throw that in file 13 and look for a safe secure login using PDO (My Suggestion) or mysqli. I did a Google search and found this https://levelup.gitconnected.com/how-to-build-a-secure-login-page-in-php-954f51d08701 and I am sure there are many others out there.
  13. Checkout https://www.php.net/manual/en/datetime.format.php it should get you on the right track.
  14. This can also be achieved by simply using HTML and CSS. I have done it plenty of times and you don't even need javascript though using javascript you could give some flare to it.
  15. What's the purpose of having a form if there's no submit button?
×
×
  • 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.