[PHP] Anti SQL Injection Script

Page 3 of 3 FirstFirst 123
Results 51 to 68 of 68
  1. #51
    Member bigbug2004 is offline
    MemberRank
    Apr 2005 Join Date
    IsraelLocation
    54Posts
    Hmm

    Where i need to put it?

    Thanks..

  2. #52
    Enthusiast HackingSkills is offline
    MemberRank
    Apr 2005 Join Date
    43Posts
    command for string to lower case

    http://us3.php.net/strtolower

    Example 1. strtolower() example
    <?php
    $str = "Mary Had A Little Lamb and She LOVED It So";
    $str = strtolower($str);
    echo $str; // Prints mary had a little lamb and she loved it so
    ?>

    Note: This function is binary-safe.

  3. #53
    Account Upgraded | Title Enabled! [N]asser is offline
    MemberRank
    Nov 2004 Join Date
    1,040Posts
    Quote Originally Posted by bigbug2004
    Hmm

    Where i need to put it?

    Thanks..
    Look at the first few posts..there is a guide there.

    [N]asser` ~ Out

  4. #54
    Account Upgraded | Title Enabled! themad is offline
    MemberRank
    Dec 2004 Join Date
    BulgariaLocation
    1,018Posts
    nice to see u all working to solve the SQL Injection problems but..
    i damn put all shits in all the files work with sql .. but lollllllllllll after all they hacked my again (PHP).
    Hmmmmmmmmmm........ 5 monts running with the same protection and no problems and now its fucked up.... today :
    1st drop table character .. lol
    2nd update character set ctlcode='1'
    okay ..normal injections...allthough i though the page is secured but here is what really bugged me ... the hacker turned off my sql server loL! hah thats smh new to me ..
    here is what security i am using..
    Code:
    $xa = getenv('REMOTE_ADDR');
    $badwords = array(";", "'", "\"", "*", "DROP", "SELECT", "UPDATE", "DELETE", "drop", "select", "update", "delete", "WHERE", "where", "-1", "-2", "-3" "-4", "-5", "-6", "-7", "-8", "-9","-","-0");
    foreach($_POST as $value) 
      foreach($badwords as $word) 
    	if(substr_count($value, $word) > 0) 
    	  die("Security Warning!<br />Forbidden simbols are included, please remove them and try again -> $xa");
    this is included in all files

    Code:
    <?php
    
    function check_inject() 
      { 
    	$badchars = array(";","'","*","/"," \ ","DROP", "SELECT", "UPDATE", "DELETE", "drop", "select", "update", "delete", "WHERE", "where", "-1", "-2", "-3","-4", "-5", "-6", "-7", "-8", "-9",); 
       
    	foreach($_POST as $value) 
    	{ 
    	$value = clean_variable($value);
    
    	if(in_array($value, $badchars)) 
    	  { 
    		die("SQL Injection Detected - Make sure only to use letters and numbers!\n<br />\nIP: ".$_SERVER['REMOTE_ADDR']); 
    	  ** 
    	  else 
    	  { 
    		$check = preg_split("//", $value, -1, PREG_SPLIT_OFFSET_CAPTURE); 
    		foreach($check as $char) 
    		{ 
    		  if(in_array($char, $badchars)) 
    		  { 
    		    die("SQL Injection Detected - Make sure only to use letters and numbers!\n<br />\nIP: ".$_SERVER['REMOTE_ADDR']); 
    		  ** 
    		** 
    	  ** 
    	** 
      ** 
    function clean_variable($var) 
    	{ 
    	$newvar = preg_replace('/[^a-zA-Z0-9\_\-]/', '', $var); 
    	return $newvar; 
    	**
    
    ?>
    all files including this too .. and using the function


    this is from fragfrogs web page
    Code:
    if ((eregi("[^a-zA-Z0-9_-]", $ps_loginname)) || (eregi("[^a-zA-Z0-9_-]", $ps_name)) ||
    (eregi("[^a-zA-Z0-9\.@_-]", $ps_email)) ||
    (eregi("[^a-zA-Z0-9_-]", $ps_person_id)) ||
    (eregi("[^a-zA-Z0-9_-]", $ps_password)) ||
    (eregi("[^a-zA-Z0-9_-]", $ps_repassword)) ||
    (eregi("[^a-zA-Z0-9_-]", $ps_recquest)) ||
    (eregi("[^a-zA-Z0-9_-]", $ps_recans)) ||
    (eregi("[^a-zA-Z0-9_-]", $extcode)) ||
    (eregi("[^a-zA-Z0-9_-]", $extcode1)) )
    	{
    	echo("Im terribly sorry but only letters (a-Z) and nums (0-9) are allowed");
    		exit();
    	**
    i have included this in every php which injects data in sql but still....... I am fucking screwed up again ;\

  5. #55
    Enthusiast alfino is offline
    MemberRank
    Aug 2004 Join Date
    SingaporeLocation
    46Posts
    Are you using the function to check all the data that's inserted to the MSSQL?

    If you ain't, then it's of no use. You include the functions, but didn't call it. What website kit are you using? Maybe i can help you edit. Or better, go get FragFrog [ don't mind if i get your name wrong ]'s FrogMU website kit. Can't find it? Use the holy grail. The search button.

  6. #56
    Account Upgraded | Title Enabled! themad is offline
    MemberRank
    Dec 2004 Join Date
    BulgariaLocation
    1,018Posts
    blah whatever.. the problem was not in $_POST but in $_REQUEST :D

    btw lol

    if ((eregi("[^a-zA-Z0-9_-]", $ps_loginname)) || (eregi("[^a-zA-Z0-9_-]", $ps_name)) ||
    (eregi("[^a-zA-Z0-9\.@_-]", $ps_email)) ||
    (eregi("[^a-zA-Z0-9_-]", $ps_person_id)) ||
    (eregi("[^a-zA-Z0-9_-]", $ps_password)) ||
    (eregi("[^a-zA-Z0-9_-]", $ps_repassword)) ||
    (eregi("[^a-zA-Z0-9_-]", $ps_recquest)) ||
    (eregi("[^a-zA-Z0-9_-]", $ps_recans)) ||
    (eregi("[^a-zA-Z0-9_-]", $extcode)) ||
    (eregi("[^a-zA-Z0-9_-]", $extcode1)) )
    {
    echo("Im terribly sorry but only letters (a-Z) and nums (0-9) are allowed");
    exit();
    **

    this is where there are any $_POTS actions lollolol.. even if i dont include the function lmao.. :D itz from JD
    Last edited by themad; 06-08-05 at 09:12 AM.

  7. #57
    Alpha Member john_d is offline
    MemberRank
    Feb 2004 Join Date
    PhilippinesLocation
    2,868Posts
    lolz.. u guys are still concernd about secutity with web pages?

  8. #58
    Account Upgraded | Title Enabled! themad is offline
    MemberRank
    Dec 2004 Join Date
    BulgariaLocation
    1,018Posts
    Quote Originally Posted by john_d
    lolz.. u guys are still concernd about secutity with web pages?
    i posted it 1 month ago :D

  9. #59
    Account Upgraded | Title Enabled! siliconshadow is offline
    MemberRank
    Feb 2005 Join Date
    UK, Midlands, LeicestershireLocation
    335Posts
    Incase you thin you might of missed soemthing make sure tyour server cant accept external forms check REMOTE_ADDR,HTTP_REFERER also it will bypass some of those scripts if they encode the data first.

    But i dont program php just asp so toodloo :P ide help ya furthe rif i culd

  10. #60
    Alpha Member john_d is offline
    MemberRank
    Feb 2004 Join Date
    PhilippinesLocation
    2,868Posts
    to summarise sql injection.

    HOW THEY CAN INJECT
    1. tru website forms
    possible solutions:
    - use a javascript validator for each for item
    - use a unique session id to be verified in the the forms action page
    - use simple form validation techinque like preg_match with preg_replace
    - use a image verify script
    - check refferal address, if address is not ur website, then stop

    2. Variables that are used in Sql Queries
    Possible solutions:
    - Use preg_replace to remove unwanted elements
    - use sql query syntax analyser

    - register_globals off

    that's it..
    btw: all bold letters solution is wat in used in mutoolz.. it doesnt need much protection

  11. #61
    Apprentice satafa32 is offline
    MemberRank
    Jul 2005 Join Date
    23Posts
    k i still dont got no idea how to do it.. i get the code.. save as functions.php.. but wut about the calling code? where do i put it?? i'm using mutoolz... where??? index.php? config.php? i'm getting sql injected all the time.. i ven had to close my registrations so no1 could get in after i ban him.. where do i put that calling code??? that my dout.. i dont get it.. i tryed to put on index.php.. and i get tons of errors... or do i need to add it in a expecific place??? plz HELP me!!!

  12. #62
    God AsterisKSM is offline
    MemberRank
    Jul 2005 Join Date
    United KingdomLocation
    443Posts
    Tank you Very Much man!!!!!!

  13. #63
    Account Upgraded | Title Enabled! thedark123 is offline
    MemberRank
    Jul 2004 Join Date
    3rd rock from the sunLocation
    452Posts
    anyone got a mutoolz version that is sql-injection protected?

  14. #64
    Alpha Member john_d is offline
    MemberRank
    Feb 2004 Join Date
    PhilippinesLocation
    2,868Posts
    Quote Originally Posted by thedark123
    anyone got a mutoolz version that is sql-injection protected?
    u crazy.. lolz.. mutoolz doesnt need sql injection protection.

  15. #65
    Account Upgraded | Title Enabled! z0lik is offline
    MemberRank
    Jun 2006 Join Date
    MoldovaLocation
    376Posts

    Re: [Release] [PHP] Anti SQL Injection Script

    tnx very good i'm try it ....

  16. #66
    Enthusiast johnson13619 is offline
    MemberRank
    May 2007 Join Date
    41Posts

    Re: [Release] [PHP] Anti SQL Injection Script

    Does this go in the loader? Email me at johnson13619@yahoo.com

  17. #67
    Real pro graywolf is offline
    MemberRank
    Mar 2004 Join Date
    Latvia // RigaLocation
    697Posts

    Re: [Release] [PHP] Anti SQL Injection Script

    add tolower() ^^ and don't bore with DROP & drop... etc... just
    The best anti-injection system for each web is different, for your's i can offer anti-injection with eregi();

  18. #68
    Proficient Member songeriux is offline
    MemberRank
    Mar 2011 Join Date
    LITHUANIALocation
    161Posts

    Re: [PHP] Anti SQL Injection Script

    doesnt work



Page 3 of 3 FirstFirst 123

Advertisement