I want to register script with sql injection protection

Results 1 to 3 of 3
  1. #1
    Enthusiast Tum Noi is offline
    MemberRank
    Nov 2012 Join Date
    Chiang Mai, THALocation
    25Posts

    sad I want to register script with sql injection protection

    I want to register script with sql injection protection.


  2. #2
    Member magicsux is offline
    MemberRank
    Jul 2013 Join Date
    56Posts

    Re: I want to register script with sql injection protection

    PHP Code:
    <?php
    $username 
    trim($_POST['username']);
    $password trim($_POST['password']);

    $link mysql_connect('localhost''mysql_user''mysql_password');
    if (!
    $link) {    
    die(
    'Could not connect: ' mysql_error());
    }
    echo 
    'Connected successfully';

    $db_selected mysql_select_db('foo'$link);

    if (!
    $db_selected) {    
    die (
    'Can\'t use foo : ' mysql_error());
    }

    $sql sprintf(    "INSERT INTO users(username,password) VALUES('%s','%s')",     mysql_real_escape_string($username),    mysql_real_escape_string(md5($password)));

    $res mysql_query($sql$link);

    mysql_close($link);

  3. #3
    Owner raventh1984 is offline
    MemberRank
    May 2011 Join Date
    NetherlandsLocation
    1,499Posts

    Re: I want to register script with sql injection protection

    Hmm i think he ment one that is for MSSQL and not for MySql and even that Mysql is old use MySql(I)



Advertisement