Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



How to Encrypt Database in PHP?

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 05-03-2010
Member
 
Join Date: May 2009
Posts: 245
How to Encrypt Database in PHP?
  

Hi friends,
I have completed the basic things of coding in PHP programming language. Now I have turned towards creating the database. I have somehow created it but I don't know anything about an encryption that takes place in PHP. So thought that you guys can help me on this topic. Please explain me how to Encrypt Database in PHP? Detailed information is very appreciable.

Reply With Quote
  #2  
Old 05-03-2010
Member
 
Join Date: Jul 2006
Posts: 442
Re: How to Encrypt Database in PHP?

The SSL / SSH protects data traveling between server and client, but SSL / SSH does not protect data once in the database. SSL is a protocol in line. It is recommended to establish connections to the server with SSL to encrypt client / server exchanges, to improve security. You can also use an SSH client to encrypt the connection between client and server databases. If any of these protections is in place, it will be difficult to monitor your traffic and understand the information exchanged. Even if web-server and DBMS are on the same physical machine one can separate networks by setting database in virtual server inside the main system.
__________________
"When they give you ruled paper, write the other way..." J.R.J.
Reply With Quote
  #3  
Old 05-03-2010
Member
 
Join Date: Jul 2006
Posts: 286
Re: Creating a Database in PHP?

I would like to tell you some basic things about creating the database, since I think that you don't have much knowledge about it. After creating the Database, only the owner and the superuser can do anything with the tables of the database and requires that it gives rights to all stakeholders who will work on this basis. Applications should never connect to the server database under the name of the owner or administrator, as these users have very important rights, and can run any application. You can create different user databases for each aspect of your application with very limited rights to planned actions. It must then ensure that the same user has the rights to several use cases.
__________________
IF you hate me, please don't mention it. I know who hates me and who doesn't. You really do not have to make fun of people....
Reply With Quote
  #4  
Old 05-03-2010
Member
 
Join Date: Jul 2006
Posts: 289
Re: How to Encrypt Database in PHP?

Encrypting data is a good solution to reduce this threat, but very few databases offer this type of encryption. The easiest way to circumvent this problem is to create your own encryption software, and use in your PHP scripts. PHP can assist you in this task thanks to the many extensions available to it as Mcrypt and Mhash, who know a wide range of encryption methods. The PHP script will encrypt the data to be stored and read when they are replayed.
__________________
Signatures reduce available bandwidth
Reply With Quote
  #5  
Old 05-03-2010
Member
 
Join Date: Apr 2008
Posts: 1,947
Re: How to Encrypt Database in PHP?

In the case of very sensitive data if the original representation is not necessary using a hash is a good solution. The classic example is the storage of passwords in the database, after having passed the MD5. The following is an example that explains the same :
PHP Code:
<?php

$query  
sprintf("INSERT INTO users(name,pwd) VALUES('%s','%s');",
            
pg_escape_string($username), md5($password));
$result pg_query($connection$query);

$query sprintf("SELECT 1 FROM users WHERE name='%s' AND pwd='%s';",
            
pg_escape_string($username), md5($password));
$result pg_query($connection$query);
 
if (
pg_num_rows($result) > 0) {
    echo 
'Welcome, $username!';
} else {
    echo 
'Authentication failed for $username.';
}
 
?>
Reply With Quote
  #6  
Old 05-03-2010
Member
 
Join Date: May 2008
Posts: 2,382
Re: How to Encrypt Database in PHP?

You can claim that the attacker must first obtain information on the scheme of the database, in most cases injections. True, but you never know how or when this information has filtered, and If this happens, your database will be in great danger. If you are using an open source, or a base that is public domain, or a pattern that belongs to a content management or forum, the hacker can easily obtain a copy of the code that you use. This may be a risk if it is a poorly conceived.
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to Encrypt Database in PHP?"
Thread Thread Starter Forum Replies Last Post
How to Encrypt /boot dogaman Operating Systems 4 13-01-2011 03:32 AM
How to Encrypt Oracle Database File GracieSingh Software Development 5 27-02-2010 02:45 AM
How to Encrypt PHP Code ? Abbudin Software Development 4 22-04-2009 04:01 AM
Encrypt your personal SMS FaMe FacToR Portable Devices 3 06-04-2009 11:41 PM
How to encrypt Emails? Navman Tips & Tweaks 0 10-11-2008 01:45 PM


All times are GMT +5.5. The time now is 10:00 AM.