I read a lot about mysql security, and php script security and was just wondering if this would suit to prevent from intrusions. I made script config.php, and register.php witch are stored in folder that is above root folder ( example ../project/script/ and ../project/www/)  register.php looks like this:  &lt;?php  require_once 'db_config.php'; $user=$_GET['username']; $pass=$_GET['password']; $db=$_GET['company'];  try {     $dbh = new PDO("mysql:host=$host", $username, $password);//connecting to        database     //check if database exists     $stmt = $dbh-&gt;query("SELECT COUNT(*) FROM INFORMATION_SCHEMA.SCHEMATA   WHERE SCHEMA_NAME = '$db'");     if($stmt-&gt;fetchColumn() == 1){     //some code     }else{         $dbh-&gt;exec("CREATE DATABASE `$db`;                     CREATE USER '$user'@'localhost' IDENTIFIED BY '$pass';                     GRANT SELECT, INSERT, UPDATE, DELETE, CREATE ON `$db`.* TO '$user'@'localhost';                     FLUSH PRIVILEGES;") or die(print_r($dbh-&gt;errorInfo(), true));         echo 'DB created';     }     }  catch (PDOException $e) {     die("DB ERROR: ". $e-&gt;getMessage()); } ?&gt;   and test.php looks like this:  &lt;?php include ('../scripts/db_connect.php'); include ('../scripts/register.php'); ?&gt;   My question would be is this good coding practice, will it be secure from someone messing up my database, and what in general do you have to point out to have better looking code in general?? Also any materials on how code should look so other can read it and PHP SQL safety would be appreciated.
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?
Call C++ library in C# I have a lot of libraries written in C++. I want to call these libraries from C#, however, I have met many problems. I want to know if there is a book or guideline to tell me how to do that. I have a WinXP installation that is used to only connect to another PC with RDP.   A dummy user account gets logged in automatically, then the user must click a link to start the RDP connection with predefined parameters.  Is there a way to run the RDP client without Windows Explorer being accessible? Repeat each line multiple times Would like to have each line in a file repeated a fixed number of times.  e.g. have each line repeated four times:  a b c   becomes:  a a a a b b b b c c c c   I've done some searching, and there are a lot of questions and answers along the lines of doing the reverse, e.g. merging duplicate lines into single lines, and maybe a few about doubling lines by printing them again.  It would be easy to do this in C, but I wish I knew more about the native commands so I wouldn't have to resort to these kinds of one-off throw-aways all the time. How to prove the following expression does not depend on x? I'm not sure how to approach this question, but I know it has something to do with taking the derivative of this. Can anyone please help me out?  Let x > 0. Prove that the value of the following expression does not depend on x: $$\int_{0}^{x}\frac{1}{1+t^4} dt + \frac{1}{3}\int_{0}^\frac{1}{x^3} \frac{1}{1+t^\frac{4}{3}} dt$$ Methane’s absorption bands are centered at 3.2 and 7.2 microns -- far off the peak of the Planck spectrum for a 290 K blackbody near 16 microns.  Moreover, its absorption bands overlap with the water absorption region.  So why is methane considered a stronger greenhouse gas than carbon dioxide, which has an absorption band at 15 microns? Find the product $\prod_{n=1}^{\infty} (1+x^{2n-1}) $ I have a VF page built on Lightning Design system (LDS) framework. When I add the renderAs="PDF" attribute, pdf does not show the content with LDS CSS/Style.  Reference Link:   Note1: apex:page tag has all the usual attributes which is required for pdf *     (showHeader="false" sidebar="false" standardStylesheets="false"   docType="html-5.0" applyHtmlTag="false" applyBodyTag="false")   Note2: Salesforce supports external stylesheet. That is, CSS file stored in Static resource. Link of example:   I also copied the whole css content from the LDS CSS file (Path: 'assets/styles/salesforce-lightning-design-system-vf.min.css') and applied as inline CSS in VF page. But still, there is no luck.  My styleSheet is referred in VF page as below  apex:stylesheet value="{!URLFOR($Resource.SLDS221,      'assets/styles/salesforce-lightning-design-system-vf.min.css')}"   Page works absolutely fine if it is not rendered as PDF.  Any suggestions? Coloring a black and white PDF graphic I have a graphic in PDF format (originally converted from an SVG) that is monochromatic (black on white). Is it possible using TikZ or PSTricks but not (Illustrator or Inkscape) to include this image in a different color?  Example:    While it lasts (there seems to be no long term way to host a pdf), you can .  Edit: Simple was perhaps a bit of a misnomer - the pdfs are cropped and monochromatic, but to intricate to redraw on my own. The above example is a character from a font (which I can recolor), but it gives a good example of what shapes I am talking about. There is a command l available on my machine which appears to do nothing.  which l also produces no output. Is this a real command, and does it actually do anything? In Dreamweaver typing &lt;/ will automatically close the last open tag, so you don't have to type it all out, and it helps if you aren't sure if you closed one or not. Is there a plugin that dose this for Notepad++?  This is not like text FX where typing the opening tag/bracket adds the close on the other side of the cursor. This behavior is an auto completion that happens when &lt;/ is typed, DW finds whatever the innermost open tag is, and closes it. I find that, when I have the option of using DW, I will use this feature far more often than anything else that DW provides. Thus I would love to know if there was a way to do it in NPP.  Here is DW preference in question:  Notice how there is a different option that does what text FX does, but I don't want that.  I am not opposed to unorthodox suggestions, some kind of macro, or hack of a plugging. Anything to emulate the functionality. If need be, I could write a plugin, I just have no idea how to go about it. Automating DB Restore from network share Convince grep to output all lines, not just those with matches Say I have the following file:  $ cat test  test line 1 test line 2 line without the search word another line without it test line 3 with two test words test line 4   By default, grep returns each line that contains the search term:  $ grep test test  test line 1 test line 2 test line 3 with two test words test line 4   Passing the --color parameter to grep will make it highlight the portion of the line that matches the search expression, but it still only returns lines that contain the expression. Is there a way to get grep to output every line in the source file, but highlight the matches?  My current terrible hack to accomplish this (at least on files that don't have 10000+ consecutive lines with no matches) is:  $ grep -B 9999 -A 9999 test test     If grep can't accomplish this, is there another command-line tool that offers the same functionality? I've fiddled with , but it doesn't seem to have an option for it either. Don't replicators make the Ferengi rather pointless? Ferengis are all about acquisition and making a profit. But, in the age of replicators, where everything you want can be produced instantly, what would be the point of their lifestyle? Sorry for the bad English. I'm trying to use the tikz-cd package to make commutative diagrams. My code  \documentclass{article} \usepackage[brazil]{babel} \usepackage{tikz-cd} \begin{document} \begin{tikzcd} A \ar[r, "x"] &amp; B \end{tikzcd} \end{document}    The problem occurs when putting a name under the arrow, the syntax "x" is incompatible with the brazil option of the babel package. When exchanging brazil for english it works normally. I already tried using  \usepackage[main=brazil, english]{babel}, \usepackage[brazil, english]{babel} e  \usepackage[brazil, main=english]{babel}   But it did not work. I also tried to use  \usepackage[english, brazil]{babel} \usepackage{polyglossia} \setmainlanguage{brazil} \setotherlanguages{english}   And finally  \selectlanguage{english}   However, it only works if I remove the option brazil Let $A \in \mathbb{R}^{p \times p}$ and $B \in \mathbb{R}^{q \times q}$ be nonsymmetric positive definite matrices in the sense that $v^T A v &gt; 0, \forall v \in \mathbb{R}^p$ and $v^T B v &gt; 0, \forall v \in \mathbb{R}^q$.  I know that $A \oplus B$, i.e. a matrix with a block structure \begin{align} \pmatrix{A &amp; 0 \\          0 &amp; B} \end{align} is positive definite and I also know that if $p=q$, then $A+B$ is positive definite as well.  Can I say that as well if the blocks overlap partially? When?   For instance a matrix as follows: \begin{align} \pmatrix{a_{11} &amp; a_{12} &amp; a_{13} &amp; a_{14} &amp; 0&amp; 0\\          a_{21} &amp; a_{22} &amp; a_{23} &amp; a_{24}&amp; 0&amp; 0\\          a_{31} &amp; a_{32} &amp; a_{33} + b_{11} &amp; a_{34} + b_{12} &amp;b_{13}&amp;b_{14}\\          a_{41} &amp; a_{42} &amp; a_{43} + b_{21} &amp; a_{44} + b_{22} &amp;b_{23}&amp;b_{24}\\          0 &amp; 0 &amp; b_{31} &amp; b_{32} &amp;b_{33}&amp;b_{34} \\          0 &amp; 0 &amp; b_{41} &amp; b_{42} &amp;b_{43}&amp;b_{44}} \end{align} Determining a tricky limit What is the limit of   $$\lim_{n \to \infty} \frac{\log n}{n^\delta}$$  where $\delta &gt; 0$? How to restore Windows 7 MBR without a CD I have been playing with Ubuntu for a few weeks now, and I'd like to revert my computer back to it's original - factory - defaults.   On the computer I have a recovery partition (it's a netbook). I went through the process of recovery and everything seemed fine. However, when I restart the computer I'm presented with   grub rescue &gt;   Now, my understanding is that when I installed Ubuntu "side by side" it replaced the MBR or something like it, with GRUB.   I've read on a slew of forums, that I need to use a Windows Recovery Disk.   Here are my issues:   a) I don't have a recovery disk, I have a recovery partition - it's a netbook. b) I don't have an external cd drive.   What I do have is a USB key that has about 1gb of space on it.   Thanks in advance. delayed addclass/remove class function not working PC won't boot (Asus P5K pro mainboard) No beeps, no screen output I am currently writing my thesis and need to include a bunch of email conversions. I am using classicthesis. I wonder, how you would format stacked conversions. Moreover, how would you deal with the email header, signatures and line breaks: why do I need to add \\ all the time? This is the configuration I am currently experimenting with:  \documentclass[ oneside, openright, titlepage, dottedtoc, numbers=noenddot, headinclude, footinclude=true, cleardoublepage=empty, abstractoff, BCOR=5mm, paper=a4, fontsize=11pt, ngerman, american ] {scrreprt}  \PassOptionsToPackage{utf8}{inputenc} \usepackage{inputenc} \usepackage{blindtext}  \usepackage{framed}  % Vertical line that highlights quotations in an email. % Use \begin{leftbar} and \end{leftbar} environment. % Width of the line = 0.4pt % Space between the line and the text = 10pt % Requires \usepackage{framed} \renewenvironment{leftbar}{%   \def\FrameCommand{\vrule width 0.4pt \hspace{10pt}}%   \MakeFramed {\advance\hsize-\width \FrameRestore}}% {\endMakeFramed}  \usepackage{nicefrac} \usepackage[english]{babel} \usepackage[pdfspacing]{classicthesis}  \begin{document} \selectlanguage{ngerman} % american ngerman % Disable paragraph indentation. \setlength{\parindent}{0pt}     \begin{verbatim} From: john.doe@yahoo.com Subject: Your inquiry from 20042012 Date: Thu, 3 May 2012 11:34:54 +0200 To: Jane Doe &lt;jane.doe@hotmail.com&gt; \end{verbatim}  Jane Doe wrote: \begin{leftbar} \begin{leftbar} \begin{leftbar} \begin{leftbar} There are a couple of questions I like to ask. Please forward them if you cannot do so. \end{leftbar} I hope I can answer them after holidays. \end{leftbar} I am back from holidays now and will look through your questionaire the next days. \end{leftbar} Thank you, Mr. Doe - I am awaiting your answers. \end{leftbar}  Dear Mrs. Doe,\\ \ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut molestie placerat pharetra. In quam leo, tincidunt ut consequat eget, malesuada sit amet urna. Morbi et interdum arcu. Nullam nisi nunc, ullamcorper vitae pulvinar eu, suscipit ut augue.\\ \ Donec risus mi, accumsan ac interdum id, molestie sed mauris. Suspendisse porttitor luctus justo in ullamcorper. Proin in neque magna. Mauris quis arcu eget enim mattis pharetra vitae a dolor. Nam aliquam consectetur mollis. Ut at sem quis dolor faucibus fringilla. Quisque cursus vehicula odio, vitae placerat ipsum dapibus id.\\ \ Best regards\\ John Doe\\ \ (See attached file: Questions\_Doe.doc)  \begin{verbatim} _______________________________________________________ Administration New York John Doe Mainstr. 3 11111 New York  T:        (011) 212-4301 F:            (011) 212-954301 M:         john.doe@yahoo.com \end{verbatim}  \begin{leftbar} My question I looking forward to reading the answers to my questions:\\ \ 1. Is the world analog or digital? \end{leftbar} digital  \begin{leftbar} 2. How long does the world exist?  \end{leftbar} analog since 1984, digital since 1999  \end{document}     This is what the above latex example looks like.    I also saw  but I do not want to use &gt; or colors. My settings are inspired by this  and this .