i have that simple PHP codes is it secure enough or needs some other workflow ? and to manage my web app (i use Reactjs) the update and delete and select of different rows of my database , dose its better to separate this statements codes in different PHP files or using an if() in one PHP file to check which operation to execute is a better idea ?  select :  &lt;?php header('Access-Control-Allow-Origin: *'); header('Content-type: application/json'); $serverName = "localhost"; $userName = "root"; $userPassword = ""; $dataBase = "todosdbs"; $con = new mysqli($serverName,$userName,$userPassword,$dataBase); $stmt = $con-&gt;prepare("SELECT * FROM todostable"); $stmt-&gt;execute(); $result = $stmt-&gt;get_result(); $todosArray = $result-&gt;fetch_all(MYSQLI_ASSOC); $todosArrayJSON = json_encode($todosArray); echo $todosArrayJSON;     $stmt-&gt;close(); $con-&gt;close(); ?&gt;   insert :  &lt;?php header("Access-Control-Allow-Headers: *"); /*header('Content-type: application/json'); header('Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE  ');*/ $data = json_decode(file_get_contents('php://input'),false); $serverName = "localhost"; $userName = "root"; $userPassword = ""; $dataBase = "todosdbs"; $con = new mysqli($serverName,$userName,$userPassword,$dataBase); $stmt = $con-&gt;prepare("INSERT INTO todostable (text,isDoneChecked,isEDitable,isRemoved) VALUES(?,?,?,?)"); $stmt-&gt;bind_param("siii",$data-&gt;text,intval($data-&gt;isEditable),intval($data-&gt;isDoneChecked),intval($data-&gt;isRemoved)); $stmt-&gt;execute(); $stmt-&gt;close(); $con-&gt;close(); ?&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?
How do I determine whether a drive is an HDD or SSD in Windows 8? I've recently received an assembled PC. I don't know if the disk is an SSD or old HDD (whether SATA or other technologies).  I can't find a way to tell if the disk is SSD or not, apart from the size of the disk. However, now that the sizes of SSDs are getting close to that of HDDs, checking the size is not a good and robust way to distinguish drive type. Is there some other way to determine if the disk is an SSD? Is it correct to use that/which in the relative clause when it is referring to the place as an object pronoun? I was teaching an ESL class and came across this sentence which confused me a lot:  &quot;The Queen Alice is the place that I go to the most&quot; &quot;Isn't that the place which kids under 12 can't enter?&quot;  Are these 2 sentences correct? Shouldn't &quot;where&quot; be used for both sentences when it's referring to the place and replacing the object? Mental estimate for tangent of an angle (from $0$ to $90$ degrees) Does anyone know of a way to estimate the tangent of an angle in their head? Accuracy is not critically important, but within $5%$ percent would probably be good, 10% may be acceptable.  I can estimate sines and cosines quite well, but I consider division of/by arbitrary values to be too complex for this task. Multiplication of a few values is generally acceptable, and addition and subtraction are fine.  My angles are in degrees, and I prefer not have to mentally convert to radians, though I can if necessary. Also, all angles I'm concerned with are in the range of [0, 90 degrees].  I am also interested in estimating arc tangent under the same conditions, to within about 5-degrees would be good.  Backstory  I'm working on estimating the path of the sun across the sky. I can estimate the declination pretty easily, but now I want to estimate the amount of daylight on any given day and latitude. I've got it down to the arc cosine of the product of two tangents, but resolving the two tangents is now my sticking point. I also want to calculate the altitude of the sun for any time of day, day of the year, and latitude, which I have down to just an arc tangent. Dataset collapsing/reducing I checked my  to see whether I can find something similar to the main-site flag-history for chat-flags, but didn't find anything. I recently had the (dis)pleasure of regularly having to deal with a user, that has been deleted multiple times. Whenever they show up (with the same nick-name) again I have to flag them again. I'd like to get an overview of how often I had to do that, and whether my flags were helpful for the moderators. As such I propose the implementation of a flag-history as it is already in place for the main-site for chat-flags, that request moderator intervention. To be completely clear I am not talking about the 10k user flags, which are acted on in a matter of sometimes seconds with instantly visible results, but about moderator attention flags from this menu: Can I change the color of the last selected face? If $a_{ij}=\max(i,j)$, calculate the determinant of $A$ How are ssl certificates verified? What is the series of steps needed to securely verify a ssl certificate?  My (very limited) understanding is that when you visit an https site, the server sends a certificate to the client (the browser) and the browser gets the certificate's issuer information from that certificate, then uses that to contact the issuerer, and somehow compares certificates for validity.     How exactly is this done?  What about the process makes it immune to man-in-the-middle attacks? What prevents some random person from setting up their own verification service to use in man-in-the-middle attacks, so everything "looks" secure? 2 separate lights on two separate switches on one line - issue Passing arguments forward to another javascript function How does equality $\mathfrak{m}^\mathfrak{m} = 2^\mathfrak{m}$ in $\sf{ZF}$ relate to the axiom of choice? Usually, the equality $\mathfrak{m}^\mathfrak{m} = 2^\mathfrak{m}$ for infinite cardinal $\mathfrak{m}$ is proved like that: $$ 2^\mathfrak{m} \leqslant \mathfrak{m}^\mathfrak{m} \leqslant (2^\mathfrak{m})^\mathfrak{m} = 2^{\mathfrak{m} \cdot \mathfrak{m}} = 2^\mathfrak{m} $$ The last step relies much on the axiom of choice, because the fact $\mathfrak{m}\cdot\mathfrak{m} = \mathfrak{m}$ does. Moreover,  states that in $\sf{ZF}$ this fact is equivalent to $\sf{AC}$.  Note, by a cardinal I mean an equipollence class of an arbitrary set, not necessarily admitting a well-ordering.  That has motivated my question: what can we say about relationship of the initial equality and the axiom of choice in pure $\sf{ZF}$?    To avoid question about definition of cardinals without $\sf{AC}$, we may consider the following statement instead:     For any infinite set $X$ exists a bijection $\; F \, \colon X^X \rightarrow 2^X$   where $X^X$ is the set of all functions from $X$ to $X$, $\; 2^X = \mathcal P(X)$ is the power set, and an infinite set is such that cannot be bijectively mapped onto a finite ordinal. What is the best solution for database connection pooling in python? I have developed some custom DAO-like classes to meet some very specialized requirements for my project that is a server-side process that does not run inside any kind of framework.    The solution works great except that every time a new request is made, I open a new connection via MySQLdb.connect.    What is the best "drop in" solution to switch this over to using connection pooling in python?  I am imagining something like the commons DBCP solution for Java.    The process is long running and has many threads that need to make requests, but not all at the same time... specifically they do quite a lot of work before brief bursts of writing out a chunk of their results.  Edited to add: After some more searching I found  which looks decent, but as I'm relatively new to python I guess I just want to make sure I'm not missing a more obvious/more idiomatic/better solution. How can I wake-up a PC using a command? (i.e. equivalent to moving a mouse, etc) It doesn't seem like this would be very difficult, but how can I wake-up a PC by doing the equivalent of moving a mouse or pressing keys on a keyboard?  My PC is running Windows 10 and I only have the monitors enter sleep mode after 15 minutes.  The rest of the PC is still awake and doesn't use hibernate, etc.  I'm trying to use EventGhost to receive a TCP/IP command that tells the PC to wake up the displays but it's proving quite difficult. command to zip multiple directories into individual zip files I have a single directory that contains dozens of directories inside of it.  I'm new to command line and I'm struggling to come up with a command that will zip each sub-directory into a unique sub-directory.zip file.  So in the end my primary directory will be filled with all of my original sub-directories, plus the corresponding .zip files that contain the zipped up content of each sub-directory.  Is something like this possible? If so, please show me how it's done. net use command works in command prompt, but not in bat file Book where human thoughts are affecting the universe Basically our thoughts are ruining everything. Like when humans are taught stars are giant balls of gas. To the rest of the universe they aren't but humans think it and destroy alien planets. I think they come to seal us off from the rest of the universe. How to recursively download a folder via FTP on Linux I'm trying to ftp a folder using the command line ftp client, but so far I've only been able to use 'get' to get individual files. I just finished backing up my system and when I try to upgrade to Utopic Unicorn, I get the error "Cannot Calculate the upgrades." I ran the upgrade by sudo apt-get dist-upgrade, sudo do-release-upgrade after the GUI method failed, they all gave the same error.  The feedback gives some recommendations:  This can be caused by:  * Upgrading to a pre-release version of Ubuntu  * Running the current pre-release version of Ubuntu  * Unofficial software packages not provided by Ubuntu    I am not upgrading to a pre-release version nor coming from one, I'm going from Ubuntu 14.04 LTS to 14.10. I have no broken packages and I have unchecked all my non-official software sources in the 'Software &amp; Updates' manager.  My guess left is the Unofficial software packages not provided by Ubuntu. If anyone could give any help as to how to check for unofficial packages using Synaptic or another, my appreciation.  Are there any other factors that may be causing this error and how would I go about checking/fixing those?  Thanks.  Edit: I have no broken or held packages. Everything is up-to-date, and restarting everything or anything has no effect. Where can I find a repository for older unsupported releases? Tsunami dampening mechanisms