<br><div class="gmail_quote">2010/8/18 Νίκος <span dir="ltr"><<a href="mailto:nikos.the.gr33k@gmail.com">nikos.the.gr33k@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
a) I wanted to ask what is proper escaping mean and <br>
<br></blockquote><div><br>Proper escaping means that value is wrapped in
quotes properly, and quotes and backslashes (or any other special to
RDBMS symbol) are escaped with backslashes.<br><br><blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">why after variable
page syntax has a comma<br></blockquote><br>Comma just means its tuple.<br><br>(page) is equal to page, while (page,) is one-element tuple which contains page:<br><br>>>> ('123')<br>'123'<br>>>> ('123',)<br>
('123',)<br><br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
why don't my code as i have it now for string reproduction<br>
<br>
===============================<br>
<a href="http://webville.gr/index.html?page=" target="_blank">http://webville.gr/index.html?page=</a>"100 ; DELETE FROM visitors; SELECT<br>
* FROM visitors "<br>
===============================<br>
<br>
don't reproduce the problem of actual deleting my data. I don't care<br>
losing it!<br>
<br>
I just want to see that happening with my own eyes!<br>
<font color="#888888"><br></font></blockquote><div><br>Your script there just throws an exception for any page data, and most likely does not run any query at all:<br>
<blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote"> 28 # open current html template and get the page ID number<br>
29 # =================================================================================================================<br>
30 f = open( '/home/webville/public_html/' + page )<br>
31 <br>
32 # read first line of the file<br>
f undefined, builtin open = <type 'file'>, page = ['index.html', '100']<br>
TypeError: cannot concatenate 'str' and 'list' objects <br>
</blockquote>
<br>Besides, using user-provided data and just concatenating it to filename like that is definitely bad idea.<br>You should use os.path.join() at least.<br><br>
Regarding that kind of SQL injection, typically driver will stop it to
happen when you provide 2 queries at once delimited by ';', so drop
table would not work. However its possible to issue UNION's to retrieve
sensitive data from your database.<br>
<br>
</div></div>-- <br>With best regards,<br>Daniel Kluev<br><br>