Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Web Development
You last visited: Today at 08:06

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Ask]is php pdo is protect from sql injection ?

Discussion on [Ask]is php pdo is protect from sql injection ? within the Web Development forum part of the Coders Den category.

Reply
 
Old   #1
 
banktakung's Avatar
 
elite*gold: 0
Join Date: Dec 2008
Posts: 306
Received Thanks: 59
[Ask]is php pdo is protect from sql injection ?

This is my code
PHP Code:
function clean($data) {
        if ( !isset(
$data) or empty($data) ) return '';
        if ( 
is_numeric($data) ) return $data;

        
$non_displayables = array(
            
'/%0[0-8bcef]/',            // url encoded 00-08, 11, 12, 14, 15
            
'/%1[0-9a-f]/',             // url encoded 16-31
            
'/[\x00-\x08]/',            // 00-08
            
'/\x0b/',                   // 11
            
'/\x0c/',                   // 12
            
'/[\x0e-\x1f]/'             // 14-31
        
);
        foreach ( 
$non_displayables as $regex )
            
$data preg_replace$regex''$data );
        
$data str_replace("'""''"$data );
        return 
$data;

PHP Code:
    $username clean($_POST['username']);
    
$password clean($_POST['password']);
    
$password2 clean($_POST['password2']);
    
$delpass clean($_POST['delpassword']);
    
$delpass2 clean($_POST['delpassword2']);
    
$email clean($_POST['email']); 
PHP Code:
// Query
        
$register $db->prepare("EXEC ACCOUNT_DBF.dbo.usp_CreateNewAccount :user, :pass, :delpass, :email");
        
$register->BindParam(':user',$username);
        
$register->BindParam(':pass',md5($sv_md5hash.($password2)));
        
$register->BindParam(':delpass',$delpass2);
        
$register->BindParam(':email',$email);
        
$register->execute(); 


i want to ask is this safe frome sql injection ??
banktakung is offline  
Old 06/07/2015, 15:37   #2


 
Reavern's Avatar
 
elite*gold: 15
Join Date: May 2010
Posts: 5,996
Received Thanks: 2,283
Arrow Flyff PServer - Discussions / Questions -> Web Development

#moved…
Reavern is offline  
Old 06/07/2015, 15:45   #3
 
PixelTree's Avatar
 
elite*gold: 13
Join Date: Feb 2010
Posts: 1,350
Received Thanks: 239
Yes, prepared statements are resilient against sql injection.
PixelTree is offline  
Reply


Similar Threads Similar Threads
[Guid] How To Protect Your Web Site Prevent Sql Injection [Guid]
08/07/2012 - SRO Private Server - 97 Replies
hello epvp members this tutorial original by me and im going to show you how to protect your site from sql injection let's start question:What is Sql Injection !? answer:A SQL injection attack attempts to compromise your database by creating SQL commands that are executed instead of, or in addition to, the commands that you have built into your application. What Can Be Done to Prevent an SQL Injection !!
Protect in ein Protect rein setzten ?
10/08/2011 - Minecraft - 3 Replies
Moin, Ich hab meine ganze Stadt protectet mit worldguard und möchte dort kleine protects rein machen damit dort USER bauen können. Geht das oder wie könnte ich das machen?
protect.dll
03/06/2008 - Kal Online - 2 Replies
:D hey nur ne frage ich hab mal die protect.dll vom xiu p-server mit tdump von delhi geöffet und das is dabei rausgekommen und könnte ma die dll nich so umschreiben sodass kal nich imma schließt wenn er ne hackengine oda ähnliches findet? answer fast pls ich hab auch nochma die engine.exe mit tdump geöffnet falls es euch hilft aba ich werd nich schlau daraus^^



All times are GMT +1. The time now is 08:07.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.