web-applications

Displaying an uploaded file from $_FILES

自闭症网瘾萝莉.ら 提交于 2021-02-08 09:04:18
问题 I'm having some issues with uploading files from HTML to a PHP based web server. The following is my HTML code. No issues here I believe. <html> <body> <form action="upload.php" method="post" enctype="multipart/form-data" action="2.2.2.cgi"> <input type="file" name="file" id="file" size="35"><br> <input type="submit" name="submit" id="submit" value="Submit"> </form> </body> </html> PHP code: <?php define ('MAX_FILE_SIZE', 1000000); $permitted = array('image/gif', 'image/jpeg', 'image/png',

Invoke-Webrequest gets 401 on POST but not on GET with Basic Auth

﹥>﹥吖頭↗ 提交于 2021-02-08 07:35:48
问题 I have a dev site with Basic Auth enabled. I am get to GET a page using the following to add basic auth to the headers: $creds = "$($BASIC_AUTH_USER):$($BASIC_AUTH_PASS)" $encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($creds)) $basicAuthValue = "Basic $encodedCreds" $headers = @{ Authorization = $basicAuthValue } $login = Invoke-WebRequest $url -SessionVariable session -UseBasicParsing -Headers $headers But I am unable to post to the same URL: $fields

How to make actionButton only work when all inputs are given in R shiny?

无人久伴 提交于 2021-02-08 04:19:30
问题 Currently my actionButton is taking in user input through drop down lists, and then when the actionButton is pressed it outputs this to a csv file. However, if the user only inputs 2 out of the 5 drop down lists and presses the actionButton this will still go to the csv file. How can I make it so it only accepts the actionButton if all inputs are given? I am using observeEvent(). 回答1: if you use the packages shinyjs you can deactivate the button when not all inputs are given with something

What are the implications of using custom tags in HTML, or What are the advantages of not using custom tags?

自作多情 提交于 2021-02-08 03:57:34
问题 I am only talking about custom tags which has a start tag and an end tag. For example: <toy>Content</toy> (And if I really need to support old browsers, I will have the shiv in) I want to know what's the advantage of not using custom tags? or what are the implications of using them? Don't tell me it's bad because it does not follow standards. Tell me what will i lose from not following this standard. Similarly, don't tell me it's good because it follows standards. Tell me what can i gain from

How to update MongoDb database in Java?

佐手、 提交于 2021-02-07 21:35:26
问题 I'm newbie with the MongoDb, there are a lot of examples about updating a collection in 2.x versions but I couldn't find any source about 3.x versions. JAVA CODE: MongoClient mongoClient = new MongoClient("localhost",27017); MongoDatabase database = mongoClient.getDatabase("dbTest"); MongoCollection<Document> collection = database.getCollection("colTest"); Document updateQuery = new Document(); updateQuery.append("$set", new Document().append("_id", "test")); Document searchQuery = new

Distributing and using API-keys for web-applications

我怕爱的太早我们不能终老 提交于 2021-02-07 20:34:59
问题 I have a web-application for which I'm building a Drupal module that allows my customers to access certain data on my application. I intend to distribute secret API-keys to my customers who need to enter that value in their copy of the Drupal module. This Drupal module then talks to my web-application, but I need to make sure that the POST requests are indeed coming from that source. How can this 'secret key' be used to pass some information that when my application receives it, it knows: (a)

How does Facebook do it?

落爺英雄遲暮 提交于 2021-02-07 08:13:26
问题 Have you ever noticed how facebook says “3 friends and 33 others liked this”? I was wondering what the best approach to do this is. I don’t think going through the friends list, and the list of users who “liked this” and comparing them is efficient at all! Do they keep a track of this in the database? That will make the database size very huge. What do you guys think? Thanks! 回答1: I would guess they outer join their friends table with their likes table to count both regular likes and friend

Uniquely identify a duplicated Chrome tab

自作多情 提交于 2021-02-07 08:01:42
问题 I am currently using window.sessionStorage to store a uniquely generated session ID. This ID is passed to all ajax calls to the server and persists across page navigation and reloads. This seems to work perfectly for my target browsers, with one caveat: the duplicate tab functionality in Chrome. Duplicating the tab copies the session storage to the new tab. When the new tab loads and communicates with the server, it now has the same "unique" identifier as the duplicated target tab. Are there

Uniquely identify a duplicated Chrome tab

断了今生、忘了曾经 提交于 2021-02-07 07:58:40
问题 I am currently using window.sessionStorage to store a uniquely generated session ID. This ID is passed to all ajax calls to the server and persists across page navigation and reloads. This seems to work perfectly for my target browsers, with one caveat: the duplicate tab functionality in Chrome. Duplicating the tab copies the session storage to the new tab. When the new tab loads and communicates with the server, it now has the same "unique" identifier as the duplicated target tab. Are there

Fuzz test (framework) web application?

浪尽此生 提交于 2021-02-06 02:41:54
问题 Are there frameworks that can perform fuzztesting on WebApplications? I know that Selenium and WebDriver are used to build tests for web-applications, but I am particulary interested in libraries, frameworks or projects that have fuzz-testing built-in, so I do not need to re-invent the wheel. For example, I could benefit from these features: randomized link clicking randomized form filling 'back' and 'forward' clicking random mouse movement and clicking javascript support Does anyone know of