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 hack a riddle like game on a website where we enter the correct answer and proceed to next level. In the source I've found the form is defined as <form id="submission-form" class="row" action="#" name="subForm">
and the following script
$('form').on('submit', function(e){e.preventDefault();submitAnswer();});
I tried to find the definition of submitAnswer() function but couldn't find any in all the scripts. And When I submit the form my browser makes a post request to the php file which is mentioned in the page url also.
So my questions are
Is the submitAnswer a php function and if not is there any way to find its definition?
Can I view the php script that the form is posting to anyhow.
This one is lame , Is there any way I can extract the correct answer from the server(by sql injection or some tool) ?
submitAnswer() is a Javascript function and is there somewhere, if you look hard enough.
No.
Probably not, depending on the proficiency of the programmer who setup the PHP code.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I am learning to code and I am in doubt about using HTML or JavaScript. For me, there are some things that JS does that is simpler with HTML. For example:
The action of submitting a form in html I can do with the tag "<input type= 'submit'>" and add an action. What is the advantage of using "example.addEventListener('submit', function(e)...)" ?
If I want to put a link on my website, I can do that with the tag link. Why would I use something like window.open("website url")?
I don't know if my question was clear, but basically I am trying to understand if there is a "best practice" or if JS enables me doing something that HTML doesn't in this cases.
When I am coding, it is better if I do things more simply, right?
Thanks a lot!!
The action of submitting a form in html I can do with the tag "" and add an action. What is the advantage of using "example.addEventListener('submit', function(e)...)" ?
Sometimes, you need to do something programmatically with the form data. For example, rather than submitting the form directly to a URL, JavaScript can handle the form data and load data from the server.
If I want to put a link on my website, I can do that with the tag link. Why would I use something like window.open("website url")?
You usually wouldn't. If you have a specific example, please share it, as there may be an edge case.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I have a form on a website I wish to validate. It is a simple enough Bootstrap 3 marked up form. Please see the image below.
As you can see it's nothing too fancy...
In terms of validation what is the right way to write concise code that serves the designated purpose? For instance if I were to have 20 fields, is it appropriate or considered okay to have isset used on every posted variable?
Typically best practice is to have both client-side and server-side validation, so I think the best answer is both.
This is important because, if you just have client-side (JS) validation anyone can go into DevTools and change your form around to avoid the validation rules. This is especially try for spam bots which look for these types of exploits.
Having server side validation in conjunction with your client side solution can ensure quality data being passed into your database.
Hope this helps.
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 would like to verify that a string is valid HTML, like the W3C Service does. I specifically don't want any browser corrections (like closing open tags), which precludes options that create DOM elements and read the HTML from them. It will run very frequently, so I really need to run it locally. Libraries are OK, jQuery is OK.
Edit #1: I'm asking about HTML validation, not form or input validation.
Edit #2: What I need is basically a Javascript implementation of the Nu HTML Checker.
Provided you're running node.js or python on the server side you can use a library like html5-lint by Mozilla to do all the heavy lifting for you. And for the java world there is a similar library jtidy and there are countless of similar libraries out there.
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
First of all sorry for my English. I'm working on a little website (I'm learning web design and PHP). As you can see in the page index.php, there are three buttons: login, registration (register) and guest. I've three scripts, one for login, one for register and one for guest access to site.
How can I show the script "login.php" or "register.php" or "guest.php", just under the buttons, when I click on the corresponding button?
Here are index.php and css files:
Download
use jQuery http://www.jquery.com makes life soo much easier
$(document).on("click","#login-btn",function(){
$("#div-where-to-load-stuff").load("url/to/login.php");
})
this is very bare bones. there are better ways to do it tho.
http://api.jquery.com/load/
You will have to either use AJAX or an IFRAME to load content asynchronously.
I really like to use the jQuery Forms plugin (in case you are able to use jQuery). Otherwise you have to look into AJAX or iFrame.
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 9 years ago.
Improve this question
Is there any possibility to save a DIV, that has contenteditable="true", to a MySQL Table? I need to use PHP for this (and JS as a "helper").
I though of doing something like this:
Putting a button on the site that copies the content of the contentEditableDIV to a formDIV (a DIV that is in a form with method="POST" action="send_to_mysql.php").
The button is supposed to auto-trigger the submit button/function at the same time.
But is there any other, more convenient way? I am quite a beginner in MySQL, so I couln't think of any other way yet.
I appreciate any kind of help or response.
With best regards,
Dave
Conceptually...
//contenteditable element
//read element with JS
//URIencode to PHP via JS/AJAX
//Send to database with PHP/PDO
You're in for a real can of worms if you want this to work well. Especially if you want this to work well AND be able to accept pasted content from MS Word.