I'm new to PHP and database programming and have been attempting to add data from a form to MySQL database. It works fine but is this open to my MySQL injection? I've read plenty of tutorials and I'm thinking PDO prepared statements. How can I do this for my comments field for example? This field (it's a text field) will be fairly open to whatever the user wants to put. How can I write this in order to make it more secure?  &lt;?php ob_start(); $username = 'name';  $password = 'pass';  $host = 'localhost';  $dbname = 'map';    try { $dbh = new PDO("mysql:host=$host;dbname=$dbname", $username, $password); // set the PDO error mode to exception $dbh-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = "INSERT INTO Incidents (           protocol,         jurisdiction,         date,         time,         comments,         video,         lat,         lng                )          VALUES (           '".$_POST["protocol"]."',         '".$_POST["jurisdiction"]."',         '".$_POST["date"]."',         '".$_POST["time"]."',         '".$_POST["comments"]."',         '".$_POST["video"]."',         '".$_POST["lat"]."',         '".$_POST["lng"]."'           )          ";  // use exec() because no results are returned $dbh-&gt;exec($sql); header("Location: map1.php");   } catch(PDOException $e) { echo $sql . "&lt;br&gt;" . $e-&gt;getMessage(); }  $dbh = null;     ob_end_flush(); ?&gt;
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?
I have dual US and UK citizenship, but the US citizenship has only just been realized (wasn't aware I had claim to US citizenship earlier).  Unfortunately I haven't received my US passport yet. Can I still travel to the US only using my UK passport?  I understand that the US does require citizens to travel on a US passport, but would they even know that I am a dual citizen if I've only ever traveled on my UK passport? (Especially considering that my US passport has never been used before in any form - as I haven't received it).  If I was only entering the US for a small trip,  would it show on the screen that I also have US citizenship when they scan my UK passport? Labeling Multiple Equations Per Row of a Table How do I escape a backtick ` within a code block?  This is probably a duplicate, since I'm sure it's a common concern, but I can't find a question that addresses this specifically.  How do I write List'1 with the "1" character still in the code-text format? Can Hydrogen Fusion via CNO Cycle Occur in First Generation Stars CNO cycle requires the presence of carbon, nitrogen and oxygen to undergo hydrogen fusion. Does this mean that for first generation stars, no matter how big they are, can't undergo hydrogen fusion by CNO cycle because there is no carbon, nitrogen and oxygen present?   I can't seem to find any website which mentions this. All they say is if a star is large enough, it will undergo hydrogen fusion via CNO cycle, they don't specifically mention it having to be a second generation star. Expectation values of the position operator is equal to zero in case of even potentials? Isn't the uncertainty principle just non-fundamental limitations in our current technology that could be removed in a more advanced civilization? From what I understand, the  states that there is a fundamental natural limit to how accurately we can measure velocity and momentum at the same time. It's not a limit on equipment but just a natural phenomenon.  However, isn't this just an observational limit? There is a definite velocity and momentum, we just don't know it. As in, we can only know so much about the universe, but the universe still has definite characteristics.  Considering this, how do a wide range of quantum mechanical phenomena work? For example, quantum tunneling - its based on the fact that the position of the object is indefinite. But the position is definite, we just don't know it definitely. Or the famous light slot experiment? The creation of more light slots due to uncertainty of the photon's positions?  What I am basically asking is why is a limit on the observer, affecting the phenomenon he is observing? Isn't that equivalent to saying  because we haven't seen Star X, it doesn't exist? It's limiting the definition of the universe to the limits of our observation! Is "Five dollars is all I have" correct? Can I move the Unity launcher? How to access an object from another class? How can I match multiple occurrences with a regex in JavaScript similar to PHP's preg_match_all()? I am trying to parse url-encoded strings that are made up of key=value pairs separated by either &amp; or &amp;amp;.   The following will only match the first occurrence, breaking apart the keys and values into separate result elements:  var result = mystring.match(/(?:&amp;|&amp;amp;)?([^=]+)=([^&amp;]+)/)   The results for the string '1111342=Adam%20Franco&amp;348572=Bob%20Jones' would be:  ['1111342', 'Adam%20Franco']   Using the global flag, 'g', will match all occurrences, but only return the fully matched sub-strings, not the separated keys and values:  var result = mystring.match(/(?:&amp;|&amp;amp;)?([^=]+)=([^&amp;]+)/g)   The results for the string '1111342=Adam%20Franco&amp;348572=Bob%20Jones' would be:  ['1111342=Adam%20Franco', '&amp;348572=Bob%20Jones']   While I could split the string on &amp; and break apart each key/value pair individually, is there any way using JavaScript's regular expression support to match multiple occurrences of the pattern /(?:&amp;|&amp;amp;)?([^=]+)=([^&amp;]+)/ similar to PHP's preg_match_all() function?  I'm aiming for some way to get results with the sub-matches separated like:  [['1111342', '348572'], ['Adam%20Franco', 'Bob%20Jones']]   or   [['1111342', 'Adam%20Franco'], ['348572', 'Bob%20Jones']] Relationship between complex number and vectors Imagine that a pebble is placed on a uniformly rotating, frictionless disk.  What will happen to this pebble? Will the disk slide under it and the pebble stay as is? Or will there be a centrifugal force on the pebble and it'll be thrown off the disk? Looking for a curly script capital A A math book I'm studying uses a symbol and I'd like to be able to reproduce it.  I used detexify to search for it, but was unsuccessful. Most likely it is the letter 'a' in some font I'm not familiar with.   Here's a zoomed in image of the symbol:    Here it is in context: I have a unique problem with an older Toshiba satellite laptop that happens to be a LegacyFree laptop meaning you can't access the bios via the normal F2, Del, Esc, etc.  I can only select a boot option in the beginning such as HDD, Removeable, CD, Floppy, etc.  The problem I ran into is the bootable USB I created is appearing as a bootable HDD not as a removable device and thus it is booting from the HDD in the computer because I can't change the HDD device priority.  Is there anyway when making the bootable USB to make it appear as a USB instead of HDD?  I've been using unetbootin and LinuxLive to create these bootable USBs.  NOTE: I am aware you can access LegacyFree Bios is through a program called Tsetup or HwSetup through windowsXP problem is that The laptop doesn't have any OS currently installed. Do file-extensions have any purpose (for the operating system)? There are several distinct usages:   kernel density estimation   kernel trick   kernel smoothing   Please explain what the "kernel" in them means, in plain English, in your own words. I'm playing on a Survival world with cheats on, "easy" difficulty, and at night in-game. I didn't have a sword or anything to make a sword with, and I was starving, so I switched to Creative to give myself a stack of food and a bed to set my spawn point. When I switched back to Survival, I couldn't destroy or place blocks. I'm on single player, and my Internet is fine, and I can destroy blocks still if I switch to creative. I've tried resetting the button one, and reloading the map, and it still doesn't work. I've even tried deleting everything I gave myself in Creative. This happened before on a different world and I ended up deleting it.  This only happens on this world. How do I fix it?  If I know I'm in the correct game mode, what else can cause this?  Are there different causes in multiplayer? When and why will a compiler initialise memory to 0xCD, 0xDD, etc. on malloc/free/new/delete? I know that the compiler will sometimes initialize memory with certain patterns such as 0xCD and 0xDD.  What I want to know is when and why this happens.  When  Is this specific to the compiler used?  Do malloc/new and free/delete work in the same way with regard to this?  Is it platform specific?  Will it occur on other operating systems, such as Linux or VxWorks?  Why  My understanding is this only occurs in Win32 debug configuration, and it is used to detect memory overruns and to help the compiler catch exceptions.  Can you give any practical examples as to how this initialization is useful?  I remember reading something (maybe in Code Complete 2) saying that it is good to initialize memory to a known pattern when allocating it, and certain patterns will trigger interrupts in Win32 which will result in exceptions showing in the debugger.  How portable is this? What are the different ways I can use to upgrade Ubuntu from one release to another? Limit point compactness implies compactness. I have a question about the following counterexample, why  $U_n = \{n\} \times Y$ has not finite collection covering $X$?   Is it because if you take a finite set $S\subset U_n$ then it's impossible to have $X\subset \bigcup S$ since X is infinite?  Counterexample:  Let $Y$ consist of two points; give $Y$ the topology consisting of $Y$ and the empty set. Then the space $X = \mathbb{Z}_{+} \times Y$ is limit point compact, for every nonempty subset of $X$ has a limit point. It is not compact, for the covering of $X$ by the open set $U_n = \{n\} \times Y$ has not finite collection covering $X.$