I have the following php script to insert a form user input data into the database. Is mysqli_real_escape_string enough to prevent SQL injection if I don't wish to use prepared statements to bind parameters to "?" placeholder?     &lt;?php    $link = mysqli_connect("localhost", "root", "", "bizcontact");     $name = mysqli_real_escape_string($link, $_POST['name']);    $company = mysqli_real_escape_string($link, $_POST['company']);    $position = mysqli_real_escape_string($link, $_POST['position']);    $contact = mysqli_real_escape_string($link, $_POST['contact']);    $email = mysqli_real_escape_string($link, $_POST['email']);    $gender = mysqli_real_escape_string($link, $_POST['gender']);     /* check connection */    if (mysqli_connect_errno()) {    printf("Connect failed: %s\n", mysqli_connect_error());    exit();    }     $sql = "INSERT INTO businesscontact(name, company, position, phone,  email, gender) VALUES('$name', '$company', '$position', '$contact', '$email',  '$gender')";    if (mysqli_query($link, $sql)){    echo "success";    }else{    echo(mysqli_error($link));    };     /* close connection */    mysqli_close($link);    ?&gt;   UPDATE      $stmt = $link-&gt;prepare("INSERT INTO businesscontact(name, company, position, phone, email, gender) VALUES(?,?,?,?,?,?)");     $stmt-&gt; bind_param("ssssss", $name, $company, $position, $contact,  $email, $gender);     if($stmt-&gt;execute()){     echo "success";    }else{     echo(mysqli_error($link));    }
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?
Does commutativity imply associativity? I'm asking this because I was trying to think of structures that are commutative but non-associative but couldn't come up with any. Are there any such examples?  NOTE: I wasn't sure how to tag this so feel free to retag it. No version of Ubuntu can be installed with any Skylake 6th generation Intel processor Gauss's Lemma for polynomials claims that a non-constant polynomial in $\mathbb{Z}[X]$ is irreducible in $\mathbb{Z}[X]$ if and only if it is both irreducible in $\mathbb{Q}[X]$ and primitive in $\mathbb{Z}[X]$.   I wonder if this holds for multivariable case.      Is it true that a non-constant polynomial in $\mathbb{Z}[X_1,\dots,X_n]$ is irreducible in $\mathbb{Z}[X_1,\dots,X_n]$ if and only if it is both irreducible in $\mathbb{Q}[X_1,\dots,X_n]$ and primitive in $\mathbb{Z}[X_1,\dots,X_n]$?    Thank you for your help. How does SO's (or other SE sites) versioning work of questions and answers? Do they use some standard piece of code or is it something homebrew?  With versioning I meant if for example a question is edited you'll see all the changes (a diff). The legacy tray (see the screenshot below) will be removed in GNOME 3.26. I want to wean myself off it before the change arrives in Ubuntu (17.10 or 18.04).    Can I disable the legacy tray in Ubuntu GNOME 17.04? What is the best way to clean lenses and filters? After removing dust with an air pomp and a brush, what are you using to remove stains from the lens and filters?  So far I'm using the liquid from a Giotto's CL 1002 cleaning kit for the lens, but I'm not sure what should I use for the filters, and if there is some better alternative.  Also, what kind of brushes are recommended? Let $A,B \subset \mathbb{R}$. Show that $\sup(A \cup B) = \max\{\sup A, \sup B\}$ Proving $\prod \limits_{k=0}^{n}(1-a_k) \geq1- \sum\limits_{k=0}^{n}a_k$ Does the  core rulebook contain any information that is not included already on  that would make it worth it to buy the PDF version of the manual? Or does it only have extra descriptive text? Programmatically obtaining Big-O efficiency of code I wonder whether there is any automatic way of determining (at least roughly) the Big-O time complexity of a given function?  If I graphed an O(n) function vs. an O(n lg n) function I think I would be able to visually ascertain which is which; I'm thinking there must be some heuristic solution which enables this to be done automatically.  Any ideas?  Edit: I am happy to find a semi-automated solution, just wondering whether there is some way of avoiding doing a fully manual analysis. Can I reduce the MAC size in TLS? The MAC size is reduced to 80 bits in  , which says "forging of MAC values cannot be done off-line: in TLS, a single failed MAC guess will cause the immediate termination of the TLS session."  Question 1 (main question): So can I reduce MAC size to something even smaller, say 32 bits?  Question 2: The truncated_hmac extension does not effect AEAD. Can I reduce the tag's size in AEAD, e.g. GCM or CHACHA-POLY? For each $y \in \mathbb{R}$ either no $x$ with $f(x) = y$ or two such values of $x$. Show that $f$ is discontinuous. This is from Apostol's Mathematical Analysis.  Let $f$ be a function defined in $[0, 1]$ such that for each real number $y$ either there is no value of $x \in [0, 1]$ such that $f(x) = y$ or there are exactly two such values of $x$. Prove that a) $f$ must be discontinuous on $[0, 1]$. b) $f$ has an infinite number of discontinuities in $[0, 1]$.  Long back I had tried to solve the problem. I reasoned for a) as follows: Suppose that $f$ is continuous and let $m, M$ be its minimum and maximum values on $[0, 1]$. Clearly if $m = M$ then $f$ is constant and clearly for every $x \in [0, 1]$ we have $f(x) = m = M$ which contradicts given property of $f$. So we must have $m &lt; M$. Clearly there are now four distinct points $a, b, c, d$ in $[0, 1]$ such that $f(a) = f(b) = m, f(c) = f(d) = M$. By checking possible linear orderings of $a, b, c, d$ I could find a find a value of $y \in (m, M)$ for which there exist more than 2 values of $x$ such that $f(x) = y$. However this approach looks very clumsy and I suspect much simpler and easier proof is possible. Part b) seemed bit complex and my only guess was that probably $f$ was discontinuous on each subinterval of $[0, 1]$ but I could not prove this claim (may be the claim is wrong!). Perhaps there is a simpler solution to this part of the problem. Apostol's also asks to provide an example of such a function. Any hints on the overall problem will be appreciated.  Update: After looking at Marc's answer, I think I have found a way to show that there are infinitely many discontinuities. Earlier the solution was a part of the question itself but it made the question look quite lengthy hence I moved it to a separate answer. Why the CMB has not been dispersed so far? Imagine you have a box of black body radiation. What happens if you open the box for a long time? It becomes dispersed and no radiation remains in the box.   Now, apply this example to the Cosmic Microwave Background radiation. The CMB has been produced about 380,000 years after the Big Bang. Giving that the space is flat as many observations suggest, that radiation has been produced in a universe with no boundaries.   Now, my question is this: in these conditions, why that radiation has not been dispersed completely so far? It is true that the radiation has been produced everywhere in the space but giving that the space is infinite, why has not it been dispersed do far?   Calculations in the standard textbooks are done in such a way as if the CMB has been within a physical box, however expanding with the universal expansion. But, this is not the actual situation. The CMB has not been and is not enclosed by walls of a box, so it must have completely dispersed so far. What has prevented this to happen? I have just dropped a half full latté on my company laptop and am not sure what to do.  Is there a way I can make sure that my laptop is usable again?  What steps must I go through to improve it's chances of survival? Alternating sum of binomial coefficients: given $n \in \mathbb N$, prove $\sum^n_{k=0}(-1)^k {n \choose k} = 0$ Let $n$ be a positive integer. Prove that   \begin{align} \sum_{k=0}^n \left(-1\right)^k \binom{n}{k} = 0 . \end{align}   I tried to solve it using induction, but that got me nowhere. I think the easiest way to prove it is to think of a finite set of $n$ elements, but I can't find the solution. Is it possible to set a CNAME record at the top of a domain? (i.e. @ CNAME www, @ CNAME foobar.com., etc.)  My ISP says that it's only possible to use CNAME's for subdomains but I've read somewhere else that is should be possible even if not recommended. How to ‘guess’ if a noun is countable or uncountable? What IDE to use for Python? What IDEs ("GUIs/editors") do others use for Python coding? Reference for creative set criterion theorem If $p$ is a prime and $p \mid ab$, then $p \mid a$ or $p \mid b$.