Location: PHPKode > projects > phpMyPrepaid > phpmyprepaid/www/include/configuration/SaveMysqlConfiguration.php
<?php
if (isset($_GET['phpmyprepaid'])) {
	session_id($_GET['phpmyprepaid']);
	session_start();
}

  $conf_pra['host']=$_POST['Server'];
  $conf_pra['user']=$_POST['User'];
  $conf_pra['password']=$_POST['Pass'];
  $conf_pra['db']=$_POST['Base'];
  $conf_pra['dbtype']=$_POST['Type'];
  $conf_pra['sqlport']=$_POST['Port'];
  $connect=mysql_connect($conf_pra['host'], $conf_pra['user'], $conf_pra['password']);
  $db=mysql_select_db($conf_pra['db']);
  if ($db==1 and $connect!=NULL)
  {
  
  $myFile = "phpmyprepaid.conf.php";
  $fh = fopen($myFile, 'w');
  $stringData='<?php'."\n";
  fwrite($fh, $stringData);
 
  //GENERAL
  $stringData = '$conf_pra[\'host\']="'.$conf_pra['host'].'";'."\n";
  fwrite($fh, $stringData);
  $stringData = '$conf_pra[\'user\']="'.$conf_pra['user'].'";'."\n";
  fwrite($fh, $stringData);
  $stringData = '$conf_pra[\'password\']="'.$conf_pra['password'].'";'."\n";
  fwrite($fh, $stringData);
  $stringData = '$conf_pra[\'db\']="'.$conf_pra['db'].'";'."\n";
  fwrite($fh, $stringData);
  $stringData = '$conf_pra[\'dbtype\']="'.$conf_pra['dbtype'].'";'."\n";
  fwrite($fh, $stringData);
  $stringData = '$conf_pra[\'sqlport\']="'.$conf_pra['sqlport'].'";'."\n";
  fwrite($fh, $stringData);
  //END
  $stringData='$connect=mysql_connect($conf_pra[\'host\'], $conf_pra[\'user\'], $conf_pra[\'password\']);'."\n";
  fwrite($fh, $stringData);
  $stringData='$db=mysql_select_db($conf_pra[\'db\']);'."\n";
  fwrite($fh, $stringData);
  $stringData='if ($db=!1 or $connect==NULL) $buttonID="badconfigmysql";'."\n";
  fwrite($fh, $stringData);
  $stringData='?>';
  fwrite($fh, $stringData);
  fclose($fh);
  header("Location: ../../phpmyprepaid.php");
  }
  else
  {
   echo "Bad configuration for your mysql server";
   include('BadMysqlConfiguration.php');
  }
?>
Return current item: phpMyPrepaid