Forum Moderators: coopster

Message Too Old, No Replies

Encrypting PHP Pages

         

RussellC

10:24 pm on Jan 19, 2005 (gmt 0)

10+ Year Member



I have a script that I made for my intranet that charges clients credit cards via authorize.net. In my script, I have to write the username and password in plain text. I do this with mysql connections in an external php file, but feel pretty uncomfortable doing this with the credit card processor just in case anyone gets a hold of the code. Is there a way to encrypt the password for the login without ever needing to display the plain text?

Thanks for the help.

henry0

10:51 pm on Jan 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Russel I am not sure that I am with you 100%
if you did write such a script I guess you could do the following, but sorry very possibly I did not get
what your quest is about!

Use an HTML form that feed a PHP script

FORM: // add the other form requirements
<form action ="update.php" method="post">
<input type="text"name="username" value="<?php echo $username;?>">
<input type="password"name="password" value="<?php echo $password;?>">

PHP:
// update.php
<?php

// WE PASS A FEW VAR TO POPULATE A TABLE
$username=$_POST['username'];
$password=$_POST['password'];

// check what's missing
if (isset($_POST['username']) &&!empty($_POST['username']) &&
isset($_POST['password']) &&!empty($_POST['password']) )

// if OK carry on
{
$username=$_POST['username'];
$password=$_POST['password'];

//SQL part
$query = "INSERT INTO **Your table name**(username, password) VALUES ('$username', password('$password'))";
$result= mysql_query ($query);

}
else
{
echo "Sorry, you are missing a Field, please click your back browser"; // or use "header"
}

jollymcfats

10:57 pm on Jan 19, 2005 (gmt 0)

10+ Year Member



I don't think you need to send the password when doing charges with Authorize.net. Or, I should say, I don't have to when integrating with AIM.

The password is needed for returns, and I take that from user-input in my admin interface rather than storing it on disk.

dmmh

6:48 am on Jan 20, 2005 (gmt 0)

10+ Year Member




I have a script that I made for my intranet that charges clients credit cards via authorize.net. In my script, I have to write the username and password in plain text. I do this with mysql connections in an external php file, but feel pretty uncomfortable doing this with the credit card processor just in case anyone gets a hold of the code. Is there a way to encrypt the password for the login without ever needing to display the plain text?

there would be no way someone could get to the code, normally. and if so, the mysql db connect password is trivial anyway, because you'd probably already be hacked if it did happen

personally, I wouldnt worry about it

RussellC

12:55 pm on Jan 20, 2005 (gmt 0)

10+ Year Member



Thanks for the help. Jollymcfats, you were right. I didnt need a password for auth.net. You can use a Transaction Key. Thanks for the help.