MiX1.TK
Site menu
Login form
Section categories
Web Development [20]
Learn about PHP & Web Development
Education [4]
Learn for Free
Knowledge & Tricks [0]
General Knowledge,computer Knowledge & tricks
Writing World [2]
A MiX World of SmS on Various Topics
Search
Main » 2012 » November » 6 » Examples of Sql Injection
10:08 PM
Examples of Sql Injection
SQL injection is a technique often used to attack a web App . This is done by including portions of SQL statements in a uper Input areas . where a user can be disturb the sql statement and can be logged in or attempt to accomplish the tasks that ther user want to perform














                                                                                                                                                                                                                                       following are some examples which are very commonly used to inject SQL statement

in the username we can input the string like this

1) ' or '1'='1
 
2) ' or '1'='1' -- '
 
3) ' or '1'='1' ({ ' 
 
4) ' or '1'='1' /* ' 
5) 1;DROP TABLE users
 
but now these days most of the web applications are injection free. but we can try
may be any where a chance to logged in without knowing username and password
 
How to prevent the injection 
 
Ans : >> using mysql_real_escape_string($var_name); and you can replace every where the varriables which contains the string,
 having single or double quotes with space/null just like str_replace("'","");
after that you can use string normally 
 
 
 
$query = sprintf("SELECT * FROM `Users` WHERE UserName='%s' AND Password='%s'",
 mysql_real_escape_string($Username),
 mysql_real_escape_string($Password));
mysql_query($query); 
Category: Web Development | Views: 111 | Added by: admin-priyank | Rating: 5.0/1
Total comments: 0
Name *:
Email *:
Code *:
Calendar
«  November 2012  »
SuMoTuWeThFrSa
    123
45678910
11121314151617
18192021222324
252627282930
Entries archive
Our poll
Rate my site
Total of answers: 4
Site friends
  • Create a free website
  • Online Desktop
  • Free Online Games
  • Video Tutorials
  • All HTML Tags
  • Browser Kits
  • Statistics

    Total online: 1
    Guests: 1
    Users: 0
    Creative Commons License
    Free Downloads and Services by MiX1 is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License
    Copyright MyCorp © 2018