How to make a password that unlocks with buttons clicked in a specific order [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I've recently created a few piano keys using HTML, CSS and some Javascript and I would like to know how to go about creating a password that only unlocks when certain keys are played in a specific order.
I imagine the code would go something like:
if (correct sequence of keys are input) {
unlocks secret content;
}else{
message: try again!;
}
I've never made a password lock of any kind and I'm not sure what language would be idea for a password... Ideally it would word in browsers and on phones. I'm really new to javascript and I know that people can easily see your code so I guess I can't really use that because people would look for the password. Any ideas/guidance would be greatly appreciated!

If you don't want users to see the login credentials, you'll need to include some server side code with PHP, or ASP.NET for example so that the check is done on the server and not in the users browser.
But otherwise it would be fairly simple to do this piano key check by making each click on the buttons add a new character to a string.
var pw="";
document.getElementById('key1').onclick=function(){pw +="x"};
And then just do a standard check on that string to a saved password.

Related

Exchange Html Data form in Real Time [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
hey guys I'm totally new to programing and I need your help to walk me through this .
lets say we have 2 users that want to communicate through HTML forms
The first users fills out a html form ( first name , last name , age etc ... ) and submits it .
The second user receives the form without being able to apply any modifications to it and then submits back to the first user as either approved or disapproved ( by ticking a radio button )
all of this has to happen in Real Time.
can somebody please explain to me how it works ? Is it done with Ajax ?
what should i research ?
You should look into Web Sockets, this is how you can accomplish the functionality you would like. Here is a link to some information on web sockets and it has a few different libraries that implement and abstract web socket to make it easier to use:
https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API
If you develop in Visual Studio with .NET, then you can check out Microsoft's SignalR library. It makes WebSocket coding easy:
http://www.asp.net/signalr
If you are wanting to stay away from WebSockets completely, then you would be looking to use AJAX and "Long Polling". here is a good SO post on this:
how does long polling work javascript?

Browsing a database as the user is typing [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
This is probably a simple question, but I'm struggling with this.
Basically, how to browse in a database, as the user is typing something?
For example, in a website such as https://www.doesthedogdie.com/, how do they do it to show all the movies beggining with the string of characters you're typing, as you're typing it?
I guess javascript is involved?
It's called autocomplete
Please do some googling next time yourself.
You can use jQuery autocomplete or Bootstrap typeahead to achieve this.
Hope this helps
My personal preference on how to make these kind of systems is fairly awkward, yet it seems to work just fine for me without requiring too much client-side scripting.I use ASP.NET's Page_Load event to save all content in a SQL database into an XML file. Then, when the user enters some text into the field, I make a hidden div class underneath it unhidden to display filtered results from the XML document. This way, you can update the SQL database at any time fairly simply to add new records which should be listed on the website.This is server-side scripting, which I prefer to client-side because the user can disable features and mess around with it to view your code which is something I personally hate.I hope this helps you somewhat.

boostrap hide/show buttons based on variable [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm (trying) to build an app based on boostrap/javascript/ and a nosql DB
a sort of small CRM/invoicing system
i need to show/hide button based on variable
for example for a quote, status could be "open", "lost" "win"
so on my quote details page when status of quote is open i want to show button
- win (who change status of quote id in db to win and copy quote to an order)
- lost (who change status of quote id in db)
but i want to hide button "Re-open" who change a cancel status to open
and so on for my different status..
so want i'm looking for is a way to collapse/hide some button depending of the status of my quote (i put the status of my quote in a variable called quoteStatus)
any suggestion will be welcome
thanks
jeebee
You can do something like that
if (quoteStatus==="value"){
document.getElementById("buttonId").style.display='none';
}
else{
document.getElementById("button").style.display='block';
}
this is just javascript, you could use jquery it will make it easier for you, so your code may look like that
if (quoteStatus==="value"){
$("#buttonId").hide();
}
else{
$("#buttonId").show();
}
To get more positive reactions to your question you have to show some research effort. This question is not useful in that mather that you havent actually showed us what you have tried, and the purpose of your functionality have possibly been asked and explained before? How to hide/show div based on variable using javascript. A div and a button is both elements.
Either way, as for your question, we need to know what you already have. The task in itself have several ways to be accomplished, and based on your existing code there could be a way to complete this task in a more correct manner than others.

PHP saving and re fetching checkbox values [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am an electronic engineering student. I have a doubt concerning Web development. I have to make a web site for doctors to enter patients data. Most of the data are in check box format. My question is regarding saving and re fetching check box status from the data base, so that the user can see what all are checked previously and what all are not checked when he log's in back the next time.
And also how can i replace the check-box status in database if i change the status. I searched about this in internet but there is no much data concerning this. So if anyone could guide me or give me a link or example codes where i can look and study, it will be a great help for me.
You can save the values of a particular check box in many different way and there are tons of resources online for this, I am sure you have come accross this information before.
You could save your check box values as a string with a string delimiter, for example: A-B-C-D-E. This was you can split/explode the string whenever you need to retrieve the values again as an array and appropriately mark the corresponding check boxes once they sign in again.
Some Resources: http://www.html-form-guide.com/php-form/php-form-checkbox.html
send checkbox value in PHP form

Sniffing the "Print Screen" key to attach its' contents on a composed mail automatically [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
How can I sniff the Print Screen key so that when it is pressed, a number of events happen on a web page:
There will be a dialog box that will pop up so that the user will only have to input the email address of the recipient.
The image on the clipboard is automatically attached to the composed mail.
If it helps, I'm using PHP 5.3.5, Javascript and Swift mailer.
This is completely impossible.
You might be able to get access using a signed Java applet. I do that to read some network properties for a web-based Wake-On-Lan service, but I've never tried to access the system clipboard. I suspect that there's probably a better way to do what you're trying but you don't give any information on the actual application to make a suggestion.
You can not access clipboard and other system-specific facilities with javascript, due to security. Let alone sniff the keyboard.

Categories