I've read a couple of post's on here and followed the queries word for word (minus my variable names) and I cannot get my code to run on a website I'm working on without errors appearing. All I have is a form where user's can upload an image.  My original code which was vulnerable but worked:  &lt;?php   $uploadDir = 'images/';     if(isset($_POST['upload']))   {     $fileName = $_FILES['userfile']['name'];     $tmpName = $_FILES['userfile']['tmp_name'];     $fileSize = $_FILES['userfile']['size'];     $fileType = $_FILES['userfile']['type'];     $memberID = $_POST['member-id'];     $imgTitle = $_POST['img-title'];     $catID = $_POST['catID'];      $filePath = $uploadDir . $fileName;      $result = move_uploaded_file($tmpName, $filePath);      if (!$result) {       echo "Error uploading file";       exit;      }      echo "&lt;br&gt;Files uploaded&lt;br&gt;";      if(mysqli_connect_errno())      {        printf("Connect failed: %s\n", mysqli_connect_error());        exit();      }       if(!get_magic_quotes_gpc())         {          $fileName = addslashes($fileName);          $filePath = addslashes($filePath);         }           $query = "INSERT INTO `tblImage` (`fldImageID`, `fldMemberID`, `fldCatID`, `fldFilePath`, `fldName`) VALUES (NULL, '$memberID', '$catID', '$filePath', '$imgTitle')";          $query = "SELECT `fldImageID` FROM `tblImage` ORDER BY `fldImageID` DESC LIMIT 1";           $result = $conn-&gt;query($query) or die ("error");   }  ?&gt;   and then the below is where I have tried to carry out prepared statements with no luck, please can someone point where my error is I've only pasted the below code which overwrites the above code where $query begins....      $stmt = $conn-&gt;prepare = ("INSERT INTO tblImage (fldImageID, fldMemberID, fldCatID, fldFilePath, fldName) VALUES (NULL, ?, ?, ?, ?)");      $stmt-&gt;bind_param($stmt, "ssss", $memberID, $catID, $filePath, $imgTitle);      mysqli_stmt_execute($stmt);     $stmt-&gt;execute();     $result = mysqli_stmt_get_result($stmt) or die ("error");   Error Message on web page:
If user input is inserted without modification into an SQL query, then the application becomes vulnerable to , like in the following example:  $unsafe_variable = $_POST['user_input'];   mysql_query("INSERT INTO `table` (`column`) VALUES ('$unsafe_variable')");   That's because the user can input something like value'); DROP TABLE table;--, and the query becomes:  INSERT INTO `table` (`column`) VALUES('value'); DROP TABLE table;--')   What can be done to prevent this from happening?
MAXDOP not working? I wanted to test out MAXDOP on my computer. So I set MAXDOP to 2 for a specific query. However, when I looked at my logical processors in Task Manager as I ran the query, it looked like they were all being used. I thought that it would only be using 2 logical processors if MAXDOP was set to 2? Does anyone know what is happening? Please see image below.  Another issue is, the DOP returned by the execution plan said 1. Now I know that setting MAXDOP does not mean SQL Server will actually use the number set. However, given that it seemed all my 4 logical processors were being used to process the query, it made it even more strange to see DOP 1.  This is the query I ran:   This was what happened as I ran it (i.e. it looks like all 4 logical processors are being used to run the query): I want to implement an addition key layer, so that I can access non-alphanumeric keys without having to move my wrists.  I've been using Autokey for this purpose, but the experience was unsatisfactory: it had occasional lags and let original keystrokes slip into certain apps.  So I need a low-level solution. Prevent browser caching of AJAX call result It looks like if I load dynamic content using $.get(), the result is cached in browser.  Adding some random string in QueryString seems to solve this issue (I use new Date().toString()), but this feels like a hack.   Is there any other way to achieve this? Or, if unique string is the only way to achieve this, any suggestions other than new Date()? What sci-fi work first showed a weapon of galactic-scale mass destruction? Currently, I have two examples in my mind:   Halo (Halo video game series; 2001): Can destroy all sentient life within three galactic radii The Moment/ Eye of Discord/ Galaxy Eater (Doctor Who (2005) TV series; 2013): Can destroy entire galaxy within a moment   What sci-fi work first showed a weapon of galactic-scale mass destruction? Code snippet comments in code formatting break the formatting of the post The relationship between the eigenvalues of matrices $XY$ and $YX$ If $X \in \mathbb{C}^{m \times n}$ and $Y \in \mathbb{C}^{n \times m}$ ($m \geq n$), how to prove the following?  $$\sigma (XY) = \sigma(YX) \cup \underbrace{\left \{ 0, ..., 0 \right \}}_{m-n}$$  Here, $\sigma$ denotes the set of eigenvalues/spectrum. If $f:E\rightarrow S$ is an elliptic curve over a scheme $S$ (so $f$ is proper and smooth of relative dimension one with geometrically connected fibers of genus one, equipped with a section $0:S\rightarrow E$), then is the sheaf $\underline{\omega}_{E/S}:=f_*\Omega_{E/S}^1$ actually free of rank one? According to the statement of Grothendieck-Serre duality in Hida's book Geometric Modular Forms and Elliptic Curves, there should be a canonical isomorphism $\underline{\omega}_{E/S}\cong\mathcal{Hom}_{\mathscr{O}_S}(R^1f_*\mathscr{O}_E,\mathscr{O}_S)$, and the first result on elliptic curves in this book is that $R^1f_*\mathscr{O}_E\cong\mathscr{O}_S$. It's also not clear to me whether $S$ is being assumed (locally) Noetherian, but if that's necessary for Grothendieck-Serre duality to hold, then I'm fine with assuming it. I can't find another reference with a statement of Grothendieck-Serre duality in this generality which does not use the language of derived categories (which I unfortunately don't understand).  The reason I'm kind of skeptical about this is that in Hida's book, as well as in Katz-Mazur, it is said that $\underline{\omega}_{E/S}$ is invertible, so that an $\mathscr{O}_S$-basis $\omega$ for $\underline{\omega}_{E/S}$ can be found locally on $S$. If the invertible sheaf in question were really trivial then one would be able to choose a global $\mathscr{O}_S$-basis for $\underline{\omega}_{E/S}$, and there would be no reason to talk about doing so locally. Hida goes on to say that, choosing an $\mathscr{O}_S$-basis $\omega$ locally on $S$ allows one to regard $(\Omega_{E/S}^1,\omega)$ as a relative effective Cartier divisor in $E/S$, which also doesn't make complete sense to me because if we can only find $\omega$ locally, how are we getting a global section $\omega\in H^0(E,\Omega_{E/S}^1)=H^0(S,\underline{\omega}_{E/S})$ (unless $\underline{\omega}_{E/S}$ really is trivial)? How to prove $\text{Rank}(AB)\leq \min(\text{Rank}(A), \text{Rank}(B))$? How to prove $\text{Rank}(AB)\leq \min(\text{Rank}(A), \text{Rank}(B))$? How do I get the local machine name in C#? Difference in System. exit(0) , System.exit(-1), System.exit(1 ) in Java Read MIME data using PHP How to cite sources written in a different language than English? When shooting in mRAW or sRAW, how does the camera generate smaller files? Most mid- and high-end DLSRs offer two or three sizes for RAW capture.  When the camera is generating the medium or small sized RAW files, how does it make them smaller?  Does it capture less information onto the sensor?  Does it capture the full amount of information and then apply some sort of in-camera compression?  Does it do something else that I'm not describing? Get all possible partitions of number Is there a way to get all possible partitions of an integer? Possibly specifying max and/or min summand. I'm interested in partitions themselves, not just partition count. Update 02/02/2019 I appreciate all the responses and help but unfortunately i must have not seen the emails stating there were responses! I am now looking into a NEST thermostat and was curious if they too, use the same connections. Lastly, looking for a quick recommendation on which WiFi Compatible therms are preferred by the memebers that respond! Thanks again your knowledge is highly appreciated! Bob  I Purchased the Honeywell WiFi Prog Thermostat to replace my Round Digital Honeywell Thermostat. I have separate Heating and Cooling (Heating is a Weil McLain Boiler for Hot water baseboard and Hot water(no tank) and Cooling is a separate unit that was added later.)  Wires:  RC Cool R Heat W Heat Y Cool G Cool   3 wires from AC unit and 2 from Heater.  If I were to go the separate transformer route to power the thermostat, where would I land the 2 wires?  C and ??? Logistic regression cost surface not convex I am building a simple logistic regression model on 2D data. Here is the input I use.    I built a logistic regression model using this data and it successfully is able to find the discriminating line between these two classes. Here is the separating line found by my program:    Also, just for debugging, I plotted number of iterations vs J(theta), which also looks fine:    Now, confusing part comes into play. I am investigating the cost surface of this model that the logistic regressions is doing the gradient descent on. I am considering three different loss functions. Sum-of-squared loss, hinge-loss, log-loss.  Hinge loss:    Log-loss:    Sum-of-squared loss:    As far as I know, both hinge loss, sum-of-squared loss and log-loss should produce a convex surface. When I look at my surfaces, however, sum-of-squared surface does not look convex to me. Why is that the case?  For convenience, here is the two critical functions from my code:  function retval = J(X, y, theta)     M = size(y, 1);     % sum of squared error     retval = (1/(2*M)) * sum((h(X, theta) - y).^2);  endfunction  function retval = h (X, theta)     % logistic     retval =  1 ./ (1+ exp(-1 * (X * theta))); endfunction Obligatory: This is not a duplicate of , which is concerning the much older duplicate closure process.  Have a gander at . Notice anything weird?  The Community♦ user was invoked by the question asker to self-close as a duplicate (presumably of the comment below, which links to ), but the list of duplicates is entirely empty. So it would seem the question asker was able to close their own question as a duplicate of... nothing?  Screenshot, in case the post is altered later:    Any idea what happened here? Determining relationship (e.g. number of removes) with cousin? How do I figure out if someone is a first cousin, second cousin, cousin once-removed, etc? Tips to extend battery life for laptops and notebooks This question is present as a matter of historical interest.  While you are encouraged to help maintain its answers, please understand that "big list" questions are not generally allowed on Ask Ubuntu and will be closed per the .   It is possible to greatly extend the usage time of a laptop or netbook running on battery by disabling various services and installing various packages.   What tricks or tips do people have for getting an extra hour or two out of their batteries? Do vulnerability and resistance cancel out?