PHP: Sanitising inputs after migrating to mysqli from mysql I've just converted my code from mysql to mysqli and I used Oracle's converter:    It was my understanding from various questions/answers on Stack Overflow that inputs do not need to be sanitised if you are using mysqli. However it appears this isn't the case - even though I'm on mysqli - i can still input something with an inverted comma e.g. what's and it returns the error as it will try to merge anything after the ' with the rest of my code.   Am I doing something wrong? If I still need to sanitise my input values after using mysqli how could I do it?  UPDATE  If I run a function like this on my inputs would that be enough?  function sanitise($str){   $string = htmlspecialchars($str);   $string = mysql_real_escape_string($str);   return $str; }
How can I prevent SQL injection in PHP? 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?
Take most recent (or concatenate) edit comments when editing during grace period Recently, I edited  to update a link to a better resource. I clicked "Save" without entering a description of the edit (edit #1).  Then I realised that the question was asked by a new user who may not be able to easily identify the change that was made. So I edited it again, this time only to add a detailed edit description (edit #2).  Since edit #2 was made during the grace period (within 5 minutes of edit #1), the system has merged them into a single edit, but only the edit comment from edit #1 was recorded in the revision history, whereas edit #2's comment was simply discarded/ignored.  I'd suggest that either the most recent (non-default) edit comment is taken or that the comments are concatenated to provide a more useful edit history Does the Draconic Bloodline sorcerer's Elemental Affinity feature apply to the spell Dragon's Breath? The  feature Elemental Affinity states:     [When] you cast a spell that deals damage of the type associated with your draconic ancestry, you can add your Charisma modifier to one damage roll of that spell.   The  spell (XGtE, p. 154) incorporates a damage roll, but it is not a direct consequence of the spell:     Until the spell ends, the creature can use an action to exhale energy of the chosen type in a 15-foot cone. Each creature in that area must make a Dexterity saving throw, taking 3d6 damage of the chosen type on a failed save, or half as much damage on a successful one.   Would one of these exhalations qualify for the application of the Elemental Affinity feature? If so, is only one eligible or every one throughout the duration of dragon's breath These are my current disk partitions. /yedek is for some personal backup files. As you can see there is only Ubuntu on my PC. I will install Windows, too. Because of this I want to shrink /dev/sda3 . It currently 546GB and I want to split it: 300GB for / and 246GB for Windows (NTFS) is OK for me.  I'm using GParted for the first time. How can I shrink /?  I don't want to lose any datas from Ubuntu. Suppose I attach an blur function to an HTML input box like this:  &lt;input id="myInput" onblur="function() { ... }"&gt;&lt;/input&gt;   Is there a way to get the ID of the element which caused the blur event to fire (the element which was clicked) inside the function? How?  For example, suppose I have a span like this:  &lt;span id="mySpan"&gt;Hello World&lt;/span&gt;   If I click the span right after the input element has focus, the input element will lose its focus. How does the function know that it was mySpan that was clicked?  PS: If the onclick event of the span would occur before the onblur event of the input element my problem would be solved, because I could set some status value indicating a specific element had been clicked.  PPS: The background of this problem is that I want to trigger an AJAX autocompleter control externally (from a clickable element) to show its suggestions, without the suggestions disappearing immediately because of the blur event on the input element. So I want to check in the blur function if one specific element has been clicked, and if so, ignore the blur event. To prove that if $n$ is odd, then $8 \mid n^2−1$, observe that as $n$ is odd either $n = 4k+1$ for some integer $k$ or $n=4k+3$ for some integer $k$. In the first case $n^2 -1=8(2k^2+k)$ and in the second case $n^2-1 = 8(2k^2 + 3k + 1)$.  Given an odd integer $a$, establish that $a^2 +(a+2)^2 +(a+4)^2 + 1$ is divisible by $12$. Solve by consideration of six cases. How to integrate $\int_0^{\pi/2}\frac{\sin^nx}{\sin^nx+\cos^nx}dx$? Possible Duplicate:          How can we integrate $$\int_0^\frac{\pi}2\frac{\sin^nx}{\sin^nx+\cos^nx}\,\mathrm dx , \,\,\,\,\,\,\,\,\, n\in N \quad?$$ Thanks for any hint. TOC entries and labels for included PDF pages I am embedding full pages from another PDF document (using the pdfpages package), but I would like to be able to declare my own section headings before each embedded document (for e.g. hyperlinking / TOC purposes). pdfpages has an experimental feature which lets me do this, but the problem is that I want to put all of these embedded documents inside a section, so I need to insert a section heading and a subsection heading on the first document I embed. Unfortunately pdfpages doesn't seem to be able to do this. Is there a way for me to do this?  Edit: Thank you for the suggestions. I am also in need of something similar for general labels — at the moment I am abusing the addtolist option of \includePDF but the objects I'm labelling aren't really figures or tables. What does limit actually mean? I have been in a deep confusion for about a month over the topic of limits! According to our book, the limit at $a$ is the value being approached by a function $f(x)$ as $x$ approaches $a$.  I have a doubt that in real number line we can never ever reach the closest value to $a$ because always a more closer value will exist.  Now when talking about our methods for calculating limit, what method comes in our mind when we have to calculate where the value approaches? Let's say we have to find what value $f(x)$ approaches when $x$ moves from $[0,a)$.  So we calculate the value of $f(x)$ at $x=0$, say $4$, and then at $x\to a$.   But the problem is that we don't know the value $x\to a$, so we say the value is $a-h$ where $h\to 0$ and calculate the value of $f(a-h)$, say $5-h$.  Now here is where my doubt starts! In the final step we put the value of $h=0$ say in that it is an infinitesimal quantity.  My doubt is that $h$ was tending to $0$ means that it was never equal to zero  maybe it is infinitesimally small, not a stationary value, not an imaginable value, but we know for sure that it is not  equal to $0$. Maybe it is the point closest to zero, but it is not equal to zero and when we use the result $5-h=5$ we are actually making an error which is tending to zero. Maybe the error is very small, but still, there is some error in that we cannot calculate it but we can see that there is this infinitesimal error present.  That means we don't get the exact limiting value or last value of $f(x)$.  $x$ belongs to $[0,a)$ but a value approximate to infinitesimal? Isn't it right! We get an approximated value? There are 100 ropes in a bag. In each step, two rope ends are picked at random, tied together and put back into a bag. The process is repeated until there are no free ends. What is the expected number of loops at the end of the process? How do I find the files installed by a particular package? Where is the .deb file to look at? I have installed pulseaudio-module-bluetooth using apt.  $ type pulseaudio-module-bluetooth bash: type: pulseaudio-module-bluetooth: not found $ which pulseaudio-module-bluetooth $ whereis pulseaudio-module-bluetooth pulseaudio-module-bluetooth:   Clearly, I'm looking for the wrong thing.  The package does not simply install a command that is the same name as the package.  Alright, then.  I want to find out what all commands (or executables) this package installed, and their locations.  The answers to "" tell me how to find the files installed by the package if I have a .deb file.  I'm not installing directly from a .deb file, though.  I'm using apt.  Where is the .deb file that that used?  Is there a copy on my system somewhere that I can query with the commands in the answers to that question?  Where?  If there isn't a local copy on my system, can I get one with apt?  How?  Is there some handy apt (or similar) command that wraps this up for me, so that I do not have to run dpkg-deb directly?  What is it?  Can I find the package's file list entirely on-line, without explicitly downloading any .deb files and before installing anything with apt?  How? I pressed F2 to take a few Minecraft screenshots. Later I couldn't find them. Where are they stored on my computer? 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. Can a negative charge ionize air? Adding to this question, I have studied that positive charge ionizes air but never studied that negative charge ionize air. If possible, please explain how does it ionize air? Chain-calling parent initialisers in python How can I install Sun/Oracle's proprietary Java JDK 6/7/8 or JRE? I want to install Oracle's JRE and to update to the latest version with the Software Updater when they released. Is there a Ubuntu package that is provided by Canonical or Oracle?  Before release Java 7, I followed  to install Java 6.  But it doesn't work for Java 7. There is no package sun-java7-xxx. How can you install Java 7? How to execute a program or call a system command from Python How do you call an external command (as if I'd typed it at the Unix shell or Windows command prompt) from within a Python script? What is the preferred way to remove spaces from a string in C++? I could loop through all the characters and build a new string, but is there a better way? Where to put my code: plugin or functions.php? Is there an easy to understand scheme to decide what kind of code belongs to a plugin or the theme’s functions.php?  There    and many  about that topic, mostly because there are some misconceptions about the inner workings of WordPress. I am asking for an answer based on facts, not on opinions.  It should explain how to handle these points (and probably more):   custom post types and taxonomies contact forms shortcodes custom widgets  SEO functions like custom meta elements theme switch   There are often pros and cons for both sides. Our most popular question  got a lot of code snippets as answers that are at least debatable. We need criteria a beginner can understand, maybe a check list – with reasons.  See also the related question by Chip Bennett on our meta site:   Related: One thing I liked about Mint was that the terminal would usually show two colors: everything from the left to the $ would be one color, and everything past the $ would be another.   Is there a way to have this setup with Ubuntu? How strong is Superman on Krypton? When Superman goes back to visit his home planet (using his ability to travel through time, I guess), is he:    an exceptionally strong and athletic Kryptonian? just an average Kryptonian male? a weakling on account of spending a lifetime in the comparative microgravity of Earth?   A possibly related question: why is Superman so muscular? What kind of weights does he lift to stay in shape?  The answers to  are all about Superman's superpowers on Earth compared with other visitors from Krypton; I'm asking about Kal El without his superpowers.  Clarification: I'm asking about the "classic"  Superman, say late Golden to early Silver Age, roughly 1945-1960. (Yes, I know the concept evolved during those years.) I'm not sure what that would be in terms of "numbered Earths", those came along after my time. I'm pretty sure the Kryptonians of that era had no superpowers in their native milieu, nor would Kal El if he were deported in space-time to his native world.