Secure Password Handling, Server Side

Secure Password Handling, Server Side

marinamarina Posts: 19Questions: 0Answers: 0
edited June 2012 in General
Hello,

I am having trouble securely passing my database credentials to the serverside_processing.php script.

I tried to place the below into a file on my server outside the document and included it in my serverside_processing.php script:

$gaSql['user'] = "username";
$gaSql['password'] = "mypassword";
$gaSql['db'] = "db_name";
$gaSql['server'] = "server_name";*/

However I cannot get my tables to load.

I noticed this line in Alan's original script: and was wondering what mysql.php should look like. Any help would be appreciated.

/* REMOVE THIS LINE (it just includes my SQL connection user/pass) */
include( $_SERVER['DOCUMENT_ROOT']."/datatables/mysql.php" );

thanks,
Marina

Replies

  • snarf2larfsnarf2larf Posts: 64Questions: 0Answers: 0
    Including it before should work (although require might be better) if the file you are using is connecting to the database like this:

    if ( ! $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) )

    What is the error you are receiving?
  • marinamarina Posts: 19Questions: 0Answers: 0
    I connect with the following (generic) code:

    $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
    die( 'Could not open connection to server' );

    mysql_select_db( $gaSql['db'], $gaSql['link'] ) or
    die( 'Could not select database '. $gaSql['db'] );


    The error I get is the typical JSON error from the interface.

    Should I be connecting like you posted? What does $gaSql['link'] mean?

    thanks lots !
  • snarf2larfsnarf2larf Posts: 64Questions: 0Answers: 0
    $gaSql['link'] just contains the database connection. If you load the php file directly without having datatables call it, is the output json or a database error?
  • marinamarina Posts: 19Questions: 0Answers: 0
    I get a 500 internal server error but its because I have all other pages blocked off.
  • marinamarina Posts: 19Questions: 0Answers: 0
    Thanks for your time I really appreciate it. I will debug further on my own on my local machines instead of the server and post something again i have a good question or figure it out.
  • snarf2larfsnarf2larf Posts: 64Questions: 0Answers: 0
    You should be able to use firebug or something similar to see the response you are getting from datatables. If it is error 500 as well you'll need to check your logs for additional info.
  • marinamarina Posts: 19Questions: 0Answers: 0
    figured it out. file path issue (of course). resulting from interface control not having permission to directory where I stored my .file_with_credentials.php. Thanks for the hand up snarf :)
This discussion has been closed.