ATTENTION: Programming Logic Comparison - Programming (2) - Nairaland
Nairaland Forum › Science/Technology › Programming › ATTENTION: Programming Logic Comparison (3682 Views)
| Re: ATTENTION: Programming Logic Comparison by Nobody: 10:41pm On Nov 13, 2014 |
GozieDiora:I understand it's a pseudocode, I was just questioning his logic. why would we check for passwords if username does not exist? Btw, the first scenario would not fetch you the specified goal, the second would |
| Re: ATTENTION: Programming Logic Comparison by Nobody: 10:45pm On Nov 13, 2014 |
GozieDiora::-D sure boss. That's why I tried to keep things simple from the beginning, explaining with examples. But before this could be understood I'm afraid we might have to consider that option. As this could be confusing sometimes. U seem to be learned about this issue. I admire you. People need to understand what's going on in the background before they could actually decipher how things work. |
| Re: ATTENTION: Programming Logic Comparison by Nobody: 10:52pm On Nov 13, 2014 |
bruceleah:I've actually written off his code. Not that it's not gonna work but like you pointed out, it's amateur. Let's focus on yours, if you will. At what point will a user whose name exists get a prompt asking if he forgot his password? Instead of saying [else {mismatch}], why not put the prompt there? This is because for the logic to have gotten to that point, the username obviously exists but the password is wrong. Then the last "else" should ask the user, 'Ogbeni, who are you?' Because at this point, even the username does not exist. What do you think? |
| Re: ATTENTION: Programming Logic Comparison by Nobody: 10:56pm On Nov 13, 2014*. Modified: 11:12pm On Nov 13, 2014 |
@GozieDiora, are you familiar with the word "offensive security"? I've been working on this project that's based on this idea and I would wanna make it open source. Also, the codes and d app would be available for free as that's the beauty of open source dev. Interested programmers could please join (send me a pm). |
| Re: ATTENTION: Programming Logic Comparison by Nobody: 10:58pm On Nov 13, 2014 |
bruceleah:And where can people learn such? At roadside IT centres? They say, "why spend years studying Computer Science when you can easily get trained along the streets" and I smile knowing that these peeps have never been to a CSc classroom. Not their faults though, some CSc grads aren't representing well. |
| Re: ATTENTION: Programming Logic Comparison by Nobody: 11:02pm On Nov 13, 2014*. Modified: 11:19pm On Nov 13, 2014 |
GozieDiora:Exactly boss. Yeah, that should solve the issue. I was just trying to make the logic understood. I guess this could save some pple headaches if implemented but could consume time. Cos sometimes, I tend to forget my username and I just wanna know if it's actually correct and I'll try to figure the password later. But all I do get is "invalid username or password" In btw, this could be exploited by crackers too. |
| Re: ATTENTION: Programming Logic Comparison by Nobody: 11:09pm On Nov 13, 2014 |
GozieDiora:I tell you, it's really a shame. There's a big difference between understanding a language and how to write an essay with that language. For instance, I could understand english language but I might not be able to write a correct essay. This is applicable to programming too. Road side IT might teach you a language (dey might just brush it for u sef) but would never teach you what's going on in the background. You only get this from csc classrooms or some well-respected IT firms |
| Re: ATTENTION: Programming Logic Comparison by Nobody: 11:21pm On Nov 13, 2014 |
bruceleah:But in real life scenarios, we use this approach mostly when the user's e-mail or phone number is used to log on instead of his actual username. The system them prompts him with his username if the password is wrong. This is because, in popular systems, most usernames will definitely exist in the system but email addresses/phone numbers are more unique so once supplied, the system would be able to match it against a username and still request clarifications like we have in the popular Facebook system. Hackers exploit everything, bro. |
| Re: ATTENTION: Programming Logic Comparison by Nobody: 11:33pm On Nov 13, 2014 |
GozieDiora:Sure boss, it's advisable to use email addresses or phone numbers as unique keys, rather than mere user names. but this could be used too. Talking about exploitation, hackers exploit to resolve while crackers exploit to destroy. I guess this is another story for another thread I keep preaching this every where I go, hackers are NOT crackers. People tend to mistake one for the other. A cracker might sit at his/her desk, trying to get list of valid users in a system. I guess that's why the error "invalid username or password" is being thrown. |
| Re: ATTENTION: Programming Logic Comparison by romme2u(op): 2:32am On Nov 14, 2014 |
GozieDiora:This feature you just explained is called short-circuiting, whereby the second condition is ONLY evaluated if the first condition is true else the inner block statement is skipped and the else block executed if it is available. |
| Re: ATTENTION: Programming Logic Comparison by romme2u(op): 2:43am On Nov 14, 2014*. Modified: 6:00am On Nov 14, 2014 |
bruceleah:Great optimisation reducing system resources consumption (like overhead incurred by database access) and faster code execution. |
| Re: ATTENTION: Programming Logic Comparison by blueyedgeek(m): 9:06am On Nov 14, 2014 |
bruceleah:Cool, I'm actually learning quite a few things from this thread although I do think we might have gone off tangent here from the initial op which is if there is a difference between both and as I have pointed out, there isn't much difference between both except in special cases. |
| Re: ATTENTION: Programming Logic Comparison by Nobody: 9:33am On Nov 14, 2014 |
blueyedgeek:Hehe.... the word "except" simply means there is actually a difference. After all, the OP didn't say, "are there much differences between.....?". He asked if there is any. I do not think we are deviating yet. We are just going beyond scope and that is a different thing. All the same, do you really think this thread will make any headway if we all stick to a couple of "FOR" statements? It has to grow beyond that and that is the scope expansion we are talking about. Lol It would have been better if the thread were about algorithms proper instead of control structures. |
| Re: ATTENTION: Programming Logic Comparison by Nobody: 9:52am On Nov 14, 2014 |
Resolved |
| Re: ATTENTION: Programming Logic Comparison by Raypawer(m): 3:20pm On Nov 16, 2014 |
no need to talk much, the second is nesting. you are nesting a condition inside one. the first (if(condition &&condition){…} the two conditions has to e true, the second condition (if(condition){if(condition)} the first situation has to be true before the second comparison can take place. this is called nesting nd mostly used to check username and password on a login page. like username has to exist before checking if the password z true. |
Help Me Keep My Brain In My Skull! Solve This Logic! • Simple Logic!think U Can Crack This? • The Door-Goat-Car Logic Problem • 2 • 3 • 4
Re: Amazon Recruitment Of Software Developers In Nigeria 2022. Opinion • Results For Programming Challenge Season 2 • Sign Your Online Documents With This App