So this is the first project that Ive worked with were I am NOT working with a pre built CMS and i'm trying to make sure that the data that is submitted is secure.   My question is in two parts: a) Is the way that I am checking $_POST values secure enough? here it is:   function validateInput($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data;    }  $id = validateInput($_POST['id']); $name = validateInput($_POST['name']); $address = validateInput($_POST['address']);   b) if not, how can I make it more secure and less likely to be SQL injected?  I would really appreciate some help on this. Thanks guys
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?
How to find a good topic for a PhD research proposal? In many countries an application for a PhD position includes a written research proposal, so my questions is what are some advises/strategies to come up with a good topic/idea for a PhD research proposal and how can one assess the quality/fruitfulness of an idea? As an undergraduate student one just doesn't have the experience to foresee which ideas might have promising research results and which probably won't have. (And I doubt that potential supervisors have the time to comment on every idea of every potential applicant in cases where it is possible to establish some kind of contact before the actual application.) How to change the shadow color in Blender Cycles? Does it mean neither a muslim nor a pakistani anymore? Or it means muslim and ex pakistani. I will be very thankfull if you people kindly elaborate this for me. Why are there unwanted white lines appearing in a PDF print proof? I designed a christmas card and I normally print it on vista print.  When I ask for a print proof the outlines show. They don’t show when I print it at home.  Why are there unwanted white lines appearing in this PDF print proof and how can I solve this problem? What's the difference between the list methods append() and extend()? Will reseting my device to factory setting unroot and remove superuser? What's the opposite word for "sin"? I would like to know if there is an opposite word for sin in English.  I mean, how could I say the opposite of     I committed a sin   other than using a negation? In System Info in 11.10, the graphics driver wasn't detected. I use ACER Aspire 4750 with Intel Core i3-2340M and Intel HD Graphics 3000 graphic card  How to install the driver for my Ubuntu? Are recommendation questions an acceptable kind of list-type question or should they be closed? Recommendations are a recurring topic on multiple Stack Exchange (SE) sites. Some sites allow recommendations (ex: ), some do not (ex: ). There are many reasons for that and I can still remember animated discussions on this subject on the Gaming meta. Then there is that existential problem with Sci-Fi SE, &quot;What problems does answering a question on this site solve?&quot;  The only common problem I can think of is What to read/watch next?, which obviously led to a big number of recommendation questions, later slightly disguised as list question. And the main trouble with these questions isn't objectivity at all, some of them aren't even subjective. It's the fact that they don't have an answer - they are open ended. -  Those questions are monstrously popular because:  There's an actual problem to be solved,  or  This problem is quite common.  In view of the  blog post, a recommendation question fails the &quot;real questions have answers, not items or ideas or opinions.&quot; criteria. But it's still a &quot;practical, answerable questions based on actual problems that you face. &quot; and it requires expertise to answer. The problem is that there are multiple acceptable answers, and the asker is not the best person to evaluate the best answer because he doesn't know which one is the best compared to the others, and he cannot test it in short term. Even the need to accept an answer is questionable. So, is a recommendation question an acceptable kind of list-type question or should it be closed just like any other list-type questions? If perimeter of a triangle is $2d$, what is the length of sides so the triangle has maximal area?    I found some solution using circle and angles, but I think I have to use derivatives.    I need help. Under what conditions will healers switch targets? I've been using healers lately, which I haven't really utilized much before. I've noticed that they will sometimes switch targets, even when their original target still lives.   What conditions are needed for healers to switch targets? Total number paths between two nodes in a complete graph $\lim_{n\to \infty}f(nx)=0$ implies $\lim_{x\to \infty}f(x)=0$ Can anyone help me with this problem?     Let $f:[0,\infty)\longrightarrow \mathbb R$ be a continuous function such that for each $x&gt;0$, we have $\lim_{n\to \infty}f(nx)=0$. Then prove that $\lim_{x\to \infty}f(x)=0$.   Our teacher told first to prove Baire's theorem, and then show that this is a consequence of that theorem. I proved Baire's theorem, and I spend a few hours thinking on how Baire's theorem is related to this problem, but I couldn't find anything. I'd really appreciate your help. Software for text search in files I am looking for a software that will search text in files from a folder similar to .  Is there something similar? Google Analytics: How can I track between http:// and https:// profiles for a domain? Generate uniformly distributed weights that sum to unity? It is common to use weights in applications like mixture modeling and to linearly combine basis functions. Weights $w_i$ must often obey $w_i ≥$ 0 and $\sum_{i} w_i=1$. I'd like to randomly choose a weight vector $\mathbf{w} = (w_1, w_2, …)$ from a uniform distribution of such vectors.  It may be tempting to use $w_i = \frac{\omega_i}{\sum_{j} \omega_j}$ where $\omega_i \sim$ U(0, 1), however as discussed in the comments below, the distribution of $\mathbf{w}$ is not uniform.  However, given the constraint $\sum_{i} w_i=1$, it seems that the underlying dimensionality of the problem is $n-1$, and that it should be possible to choose a $\mathbf{w}$ by choosing $n-1$ parameters according to some distribution and then computing the corresponding $\mathbf{w}$ from those parameters (because once $n-1$ of the weights are specified, the remaining weight is fully determined).  The problem appears to be similar to the  (but, rather than picking 3-vectors whose $ℓ_2$ norm is unity, I want to pick $n$-vectors whose $ℓ_1$ norm is unity).  Thanks! I ajaxly call a route and pass data to it, In my controller, I want to get $_POST['var'] , $_POST['var2'], it seems because of using HttpFoundation in drupal 8, $_POST and $_GET are not exists in old method, How I can access $_POST parameters in custom Controller? Simple & easy way to jail users I need a simple and easy way to jail users in their home directories in Oneiric. Do you have a simple configuration for jailing users, with full help, or some good web links?  I would be offering an online free public server with 10 to 20 GB free space. I don't know how many users. I want to give them SSH and SFTP so that they can connect through FileZilla. Why is "what can I ask about here" not the first entry in the help center? On a lot of sites, the first section of the Help Center looks like this:    When I go to a site's help center it's almost always to find out what's on-topic there, because I'm considering asking or migrating a question.  Leading with what not to ask seems odd to me, and I suspect that to someone not already familiar with SE it could be a little off-putting.  It's not always like this, though; here on MSE we get this, which I've seen on some other sites too:    That ordering makes a lot more sense to me.  It's also consistent with the tour.  (Maybe "how do I ask a good question?" should also be "above the fold", in the top five somewhere.)  Why the difference?  Can we either make the order consistent across the network and more logical, or give users or moderators the ability to change the order on their sites? $A$ abelian variety. Is the multiplication by $n_A$ surjective?