Thread: Why I hate web developers...

  1. #31
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Use exponential backoff for that user. If the user gets the password wrong X times, wait for N minutes. If the user gets the password wrong X + Y times, wait for N + M minutes, and so on. If the user gets it wrong too many times, require manual unlocking via customer service. 'Course, this annoys people, so use with care.

    You might want to extend it to blocking by IP too if some IP is trying a lot of different user combinations. Problem with that is basically that you might be under a DDoS attack and they're not easy to protect against.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  2. #32
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by MutantJohn View Post
    I'm awful at styling though so maybe I'm biased but that just seems weird. So much CSS...
    Well, in all fairness CSS biggest power comes from its user-defined classes feature. And that requires you to tag your HTML with their names. Inline CSS however is a no-no, despite so many people still thinking it is a good idea.

    Quote Originally Posted by MutantJohn View Post
    I realized I was being silly by printing whether or not a username or password was incorrect
    If you are referring to the last code you posted, there was nothing wrong with it other than perhaps an excessive use of if-else statements. You could have probably set default values for some of those variables and avoid the if/else clutter. PHP is already a burden to maintain without you adding more code to it unnecessarily.

    But in any case you were setting a new user account, not having the user log in. So there is nothing wrong with telling the users exactly what was their input errors.

    Quote Originally Posted by MutantJohn View Post
    I actually thought back to this site and how it gives you 5 tries before you have to wait 15 minutes.
    You don't actually need to complicate the life of your users because of security. And let this be your first lesson in security: It shouldn't come at the expense of the user or the UI.

    3 or 5 seconds between subsequent attempts after the third is enough to defeat any brute force attack even on an offline application login form. Those 3 seconds will remove any chance of a malicious person running thousands of combinations per second over the web, which is the only way a brute-force attack can be reasonably expected to succeed.

    But other methods include sending an email to the account owner after X failed attempts with a reactivation code. The account will stay otherwise disabled. Or employing a good captcha (they weren't designed exactly for this task, but they will work nicely for this too). Apache offers some options too in ModSecurity, but it essentially amounts to the same strategy of temporarily disabling or delaying further login attempts.

    Also of note, by protecting yourself against DDoS you will be in fact also removing any chance of a brute force attack on your stored accounts (through the web interface only). So research also DDoS protection methods.
    Last edited by Mario F.; 09-16-2015 at 11:32 AM.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #33
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    If you are referring to the last code you posted, there was nothing wrong with it other than perhaps an excessive use of if-else statements. You could have probably set default values for some of those variables and avoid the if/else clutter. PHP is already a burden to maintain without you adding more code to it unnecessarily.
    Interesting. How would you have rewritten it?

    Also, I am not talking about the code I last posted. Now that I have registration functionality, it's time to add login functionality so I created a small login script.

    I figured, it'd be best to just use the $_SESSION variable.

    I'm trying to secure my sessions with some code like this :
    Code:
    define( "SECURE", false ); // no HTTPS for me!
    
    function sec_session_start()
    {
        $session_name = "sec_session_id"; // I'm not entirely sure how this helps, but it's whatever, right? XD
    
    
        $secure = SECURE;
        $httponly = true;
    
    
        ini_set( "session.use_only_cookies", 1 );
    
    
        $params = session_get_cookie_params();
        session_set_cookie_params( $params[ "lifetime" ],
                                   $params[ "path" ],
                                   $params[ "domain" ],
                                   $secure,
                                   $httponly );
    
    
        session_name( $session_name );
        session_start();
        session_regenerate_id( true );
    }
    And my login script does all the basic database querying and checking and I windup just doing this :
    Code:
    $_SESSION[ "username" ] = $username;
    This is all I really need. All data is associated with just the user. I know I need to create a logout script and a timeout functionality as well.

    Not gonna lie, frameworks are starting to look really attractive now...

  4. #34
    Registered User
    Join Date
    May 2003
    Posts
    1,619
    Quote Originally Posted by MutantJohn View Post
    It's true though. I did receive some awesome code from the PHP forums (I call it "awesome" lol) and while there were some kinks to work out, the poster had clearly spent a good amount of time styling the page. In fact, on a per-line basis, I think there was more CSS than there was PHP.

    I'm awful at styling though so maybe I'm biased but that just seems weird. So much CSS...
    It's not really that unusual. Markup defines content, and CSS describes presentation. A lot of web development is presentation, and CSS is a lot better than trying to use various HTML layout and styling tools.
    You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.

  5. #35
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    Quote Originally Posted by Cat View Post
    It's not really that unusual. Markup defines content, and CSS describes presentation. A lot of web development is presentation, and CSS is a lot better than trying to use various HTML layout and styling tools.
    Oh, of course. Presentation is incredibly important. But for me, I prefer to develop from form to function. During development, it's all pure markup and sever-side code. Once that's done and working as it should, yes, it's time to style.

    But I think what Mario hates (and I do too to a lesser extent) is the desire to put CSS before PHP, for example. I actually caught a few errors in the code that I was given which is fine (I mean, they're coding for free, right?) but it was clear that if half the effort they put into CSS was put into double-checking their PHP, there wouldn't have been any mistakes or at least, any obvious ones.

    I always figured I'd just hire someone to do the CSS lol.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Man, I hate having to do this...
    By Jaken Veina in forum Windows Programming
    Replies: 4
    Last Post: 07-05-2005, 12:23 AM
  2. WHY, WHY, does this hate me?!
    By Death_Wraith in forum C++ Programming
    Replies: 5
    Last Post: 03-16-2004, 09:15 AM
  3. I know you all must hate me but another ?
    By Thantos in forum Windows Programming
    Replies: 4
    Last Post: 08-15-2003, 01:09 PM