I want to insert a record into the data-base, I don't know where's the probolem  this is my code !    &lt;?php  if ($_SERVER['REQUEST_METHOD'] === 'POST') {     $status = "";     $name = $_POST['name'];     $username = $_POST['username'];     $email = $_POST['email'];     $password = $_POST[$password];      $query = "INSERT INTO admins (name, email, username, password) ";      $query .= "VALUES ('{$name}','{$email}','{$username}','{$password}')";      $result = mysqli_query($connect , $query);      if (isset($result)){         $status = "Admin has been added";     }else {         $status = "Admin hasn't been added ";     } } ?&gt;  &lt;form action="add_user.php" method="post"&gt;     &lt;h3&gt;Name&lt;/h3&gt;     &lt;input name="name" placeholder="Name"&gt;     &lt;h3&gt;Username&lt;/h3&gt;     &lt;input name="username" placeholder="Username"&gt;     &lt;h3&gt;E-mail&lt;/h3&gt;     &lt;input name="email" placeholder="E-mail"&gt;     &lt;h3&gt;Password&lt;/h3&gt;     &lt;input name="password" placeholder="Password" id="password" type="password"&gt;     &lt;h3&gt;Confirm Password&lt;/h3&gt;     &lt;input name="confirm_pass" placeholder="Confirm Password" id="confirm_password" type="password" onkeydown="ValidatePass()"&gt;     &lt;p id="pass_state"&gt;&lt;/p&gt;     &lt;div id="btn"&gt;         &lt;input type="submit" value="Create User dis" disabled&gt;     &lt;/div&gt;     &lt;h4 style="color: orangered"&gt;&lt;?php ?&gt;&lt;/h4&gt; &lt;/form&gt;     I know that there night be sqlInjections !  don't worry about that that's only for local development and learning purposes:D    please Help !
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?
Should we MAC-then-encrypt or encrypt-then-MAC? Most of the time, when some data must be encrypted, it must also be protected with a , because encryption protects only against passive attackers. There are some nifty encryption modes which include a MAC (, ...) but let's assume that we are doing old-style crypto, so we have a standalone encryption method (e.g. AES with CBC chaining and PKCS#5 padding) and a standalone MAC (e.g.  with SHA-256). How should we assemble the encryption and the MAC?   MAC-then-Encrypt: Compute the MAC on the cleartext, append it to the data, and then encrypt the whole? (That's what  does) Encrypt-and-MAC: Compute the MAC on the cleartext, encrypt the cleartext, and then append the MAC at the end of the ciphertext? (That's what SSH does) Encrypt-then-MAC: Encrypt the cleartext, then compute the MAC on the ciphertext, and append it to the ciphertext? (In that case, we do not forget to include the initialization vector (IV) and the encryption method identifier into the MACed data.)   The first two options are often called "MAC-then-encrypt" while the third is "encrypt-then-MAC". What are the arguments for or against either? Calculating values of field based on two others using Field Calculator in ArcGIS Desktop? I need to combine two fields in an attribute table.  I want to do this using the field calculator.  What is the proper script to write to combine a field called "name" and "type", so that it produces one field with "name type"?  I'm using ArcGIS Desktop 10.0. Show that Statistic is complete What is the meaning of the density of a distribution at a point? I know how to use PDFs to calculate probabilities, but I don't think I understand them. For example, at $X=0$ the PDF of the standard normal distribution is $\approx 0.4$. Does this have any useful meaning? In the sentence: "I didn't know she had a son,"   Can I say "I didn't know she has a son" instead, because he is a teenager now?  Or are both correct? When to delete your 0 vote answers? I've been in the SO community a little over a month now - and having a great time!  As I grow into a contributing citizen of stackoverflow, i'd like to ensure that i'm being responsible with my answers.   I've answered a few questions, some without upvotes, some voted on and some accepted.  I feel that after a certain period of time, 0 vote answers are probably providing more clutter than value.  Apparently, nobody has found them useful, so they probably aren't (or are poorly written). Tonight I went through and deleted my answers with 0 upvotes where some answer was accepted.  That was an easy decision.   I left my 0 vote answers where nothing was accepted yet, well, because I think they could provide the information that the OP requested.  But at some point, I think my answers might just be cluttering the issue.  So my question to you is: How do you know when it's time to delete your 0 vote answers?  Or even 1 vote answers for that matter? Laptop randomly waking up = Hibernate / Low Battery? I have always argued adamantly, as long as the issue has been around, that gift should never be used as a verb. However, someone whose English knowledge I quite respect disagrees.  I’ve done some searching and I haven’t found a consensus; should gifting be shunned? Am I using beta or stable? I have been doing so many sudo apt-get update/(dist-)upgrade since yesterday and  something happend - so that I am confused now whether I am using still beta or the stable version.   How do I figure that out? How to execute several commands after each other with one request to the terminal (without using a file)? A student prepares for an exam by studying a list of 12 problems. She can solve 9 of them. For the exam, the instructor selects 7 problems at random from the 12 on the list given to the students. What is the probability that the student can solve 5 of the 7 problems on the exam?  I am really confused by this problem. My first initial thought was to do:  (5 chose 7)(7 chose 0)/ (12 chose 7)  I am not 100% sure about this though. Proof that all abelian simple groups are cyclic groups of prime order Prove $|\arctan x - \arctan y|\leq |x-y|$ I am trying to show that $a^{12} \equiv 1 \mod 32760$ for each $a \in \mathbb{Z}$ coprime to $32760$. I have found the prime decomposition $32760 = 2^3 \cdot 3^3 \cdot 5 \cdot 7 \cdot 13$ and determined $\phi(32760)$, where $\phi$ is the Euler's totient function. This gives me that $\phi (32760) = 8640$.   Using Euler's congruence, this gives that $a^{8640} \equiv 1 \mod 32760$, but this is still far from the result I want to show... I also know a consequence of Eulers congruence, which states that $e \equiv e' \mod \phi (n)$ implies that $a^e \equiv a^{e'} \mod n$, but I do not see how to use this...  Any hints would be appreciated.  $\textbf{EDIT:}$ I made a mistake in my primefactorization, it is edited now. How do I find the package that provides a file? Why does work depend on distance? Can Rails Routing Helpers (i.e. mymodel_path(model)) be Used in Models? Say I have a Rails Model called Thing. Thing has a url attribute that can optionally be set to a URL somewhere on the Internet. In view code, I need logic that does the following:  &lt;% if thing.url.blank? %&gt; &lt;%= link_to('Text', thing_path(thing)) %&gt; &lt;% else %&gt; &lt;%= link_to('Text', thing.url) %&gt; &lt;% end %&gt;   This conditional logic in the view is ugly. Of course, I could build a helper function, which would change the view to this:  &lt;%= thing_link('Text', thing) %&gt;   That solves the verbosity problem, but I would really prefer having the functionality in the model itself. In which case, the view code would be:  &lt;%= link_to('Text', thing.link) %&gt;   This, obviously, would require a link method on the model. Here's what it would need to contain:  def link   (self.url.blank?) ? thing_path(self) : self.url end   To the point of the question, thing_path() is an undefined method inside Model code. I'm assuming it's possible to "pull in" some helper methods into the model, but how? And is there a real reason that routing only operates at the controller and view layers of the app? I can think of lots of cases where model code may need to deal with URLs (integrating with external systems, etc). Which fruits and vegetables should be kept in a fridge, and which outside? What blocks can Endermen pick up and what blocks they can't? None of the physics sensors in my game work, I'm trying to create an AI man that chases after a player, but for whatever reason, he just won't sense the player, I've tried copying and pasting the property name just to be sure, but that's not it.