Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation since 09/24/2023 in all areas

  1. What does it do when you try it?
    2 points
  2. FYI - jquery makes it easier... let w1 = $("#dotBorder").css("width"))
    1 point
  3. Because you tried to "get attribute" and CSS is not attributes.
    1 point
  4. What do you mean, "remove"? What "other operations"? You've managed to post a whole bunch of code, but wouldn't you know, when asking for help with a thing, giving a description of what you want to do is more important than the code itself! One-time password. Like those 6-digit numbers you get from SMS or "authenticator" apps that cycle every 30 seconds. Such as this algorithm, $acct_otp = substr(number_format(time() * rand(), 0, '', ''), 0, 6); (which is terrible and should never be used by anyone for any reason)
    1 point
  5. Or do both: put the validation inside a function, and put the function inside a file. <?php function is_valid_name($name) { return preg_match("/^[a-zA-Z\'\-\s]*$/", $name); } if ($_SERVER['REQUEST_METHOD'] === 'POST') { require_once "the other file.php"; if (!is_valid_name($firstname)) { $firstnameErr2 = "Only letters allowed"; } if (!is_valid_name($lastname)) { $lastnameErr = "Only letters allowed"; } Kinda. I'd say that you're going about it the naive and simplistic way. Which is typically the first step towards doing it in a smarter and more flexible way. If you're doing this for a personal project then don't mind it. Unless you specifically want to learn how to do this better...? But I will say one thing: don't validate people's names. Just don't. It's a bad practice because you're always going to end up rejecting the valid name of someone, somewhere. Additionally, separating names by first and last isn't even correct either: there are people with single names. The right way to do names is to use a single full-name input and ensure it has something in it. Nothing more.
    1 point
  6. In much the same way as Superman uses kryptonite.
    0 points
This leaderboard is set to New York/GMT-04:00
×
×
  • 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.