Location: PHPKode > projects > Quick Guestbook > quicktalk/install/qtg_setup_1_txt.php
<?php

// QuickTalk 2.5 build:20100731

session_start();
$strV = '2.5';

if ( !isset($_SESSION['qtg_setup_lang']) ) $_SESSION['qtg_setup_lang']='en';

include('qtg_lang_'.$_SESSION['qtg_setup_lang'].'.php');
include('../bin/config.php');

$strAppl = 'QuickTalk guestbook '.$strV;
$strPrevUrl = 'qtg_setup_1.php';
$strNextUrl = 'qtg_setup_2_txt.php';
$strPrevLabel= $L['Back'];
$strNextLabel= $L['Next'];
$error = '';

// --------
// HTML START
// --------

include('qtg_setup_hd.php');

echo '
<table cellspacing="0">
<tr valign="top">
<td width="475" style="padding:0px">';

// --------
// SUBMITTED
// --------

if ( isset($_POST['ok']) )
{
  include('../bin/qt_lib_txt.php');

  $qtg_dbsystem = $_SESSION['qtg_dbsystem'];
  $qtg_user = strip_tags(trim($_POST["qtg_user"]));
  $qtg_pwd = strip_tags(trim($_POST["qtg_pwd"]));
  $qtg_user_2 = strip_tags(trim($_POST["qtg_user_2"]));
  $qtg_pwd_2 = strip_tags(trim($_POST["qtg_pwd_2"]));

  if ( !QTislogin($qtg_user,2) ) { $qtg_user=QTconv($qtg_user,'U'); $error="Username [$qtg_user] will not be considered as a valid username."; }
  if ( !QTispassword($qtg_pwd,2) ) { $qtg_pwd=QTconv($qtg_pwd,'U'); $error="The password of [$qtg_user] will not be considered as a valid password."; }
  if ( $qtg_user_2!='' )
  {
    if ( !QTislogin($qtg_user_2,2) ) { $qtg_user_2=QTconv($qtg_user_2,'U'); $error="Username [$qtg_user_2] will not be considered as a valid username."; }
    if ( !QTispassword($qtg_pwd_2,2) ) { $qtg_pwd_2=QTconv($qtg_pwd_2,'U'); $error="The password of [$qtg_user_2] will not be considered as a valid password."; }
  }
  if ( !empty($error) ) echo '<div class="setup_err">',$error,'</div>';
  $error='';

  // Save file
  if ( empty($oDB->error) )
  { 

  $strFilename = '../bin/config.php';
  $strTxt = '<?php  
  $qtg_dbsystem = "'.$qtg_dbsystem.'";
  $qtg_host = "";
  $qtg_port = "";
  $qtg_dsn = "";
  $qtg_database = "";
  $qtg_prefix = "";
  $qtg_user = "'.$qtg_user.'";
  $qtg_pwd = "'.$qtg_pwd.'";
  $qtg_user_2 = "'.$qtg_user_2.'";
  $qtg_pwd_2 = "'.$qtg_pwd_2.'";
  $qtg_install = "'.date('Y-m-d').'";
  ?>';

  if ( !is_writable($strFilename) ) $error="Impossible to write into the file [$strFilename].";
  if ( empty($error) ) { if ( !$handle=fopen($strFilename, 'w') ) $error="Impossible to open the file [$strFilename]."; }
  if ( empty($error) ) { if ( fwrite($handle,$strTxt)===FALSE ) $error="Impossible to write into the file [$strFilename]."; fclose($handle); } 
  }
 
  // report

  if ( empty($error) )
  {
    echo '<div class="setup_ok">',$L['S_save'],'</div>';
  }
  else
  {
    echo '<div class="setup_err">',$error,$L['E_save'],'</div>';
  }
}

// --------
// END SUBMITTED
// --------

echo '<form method="post" name="install" action="qtg_setup_1_txt.php">
<table cellspacing="0" cellpadding="5">
<tr>
<td colspan="2"><h2>',$L['Administrator'],'</h2><br/></td>
</tr>
';
echo '<tr>
<td>',$L['Administrator'],' 1 (login/password)</td>
<td>
<input name="qtg_user" value="',$qtg_user,'" size="15" maxlength="100"/>
<input type="password" name="qtg_pwd" value="',$qtg_pwd,'" size="15" maxlength="100"/>
</td>
</tr>
<tr>
<td>',$L['Administrator'],' 2 (login/password)</td>
<td>
<input name="qtg_user_2" value="',$qtg_user_2,'" size="15" maxlength="100"/>
<input type="password" name="qtg_pwd_2" value="',$qtg_pwd_2,'" size="15" maxlength="100"/>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="2" style="text-align:center"><input type="submit" name="ok" value="',$L['Save'],'"/></td>
</tr>
</table>
</form>
';

echo '
</td>
<td class="hidden"><div class="setup_help">',$L['Help_1b'],'</div></td>
</tr>
</table>
';

// --------
// HTML END
// --------

include('qtg_setup_ft.php');

?>
Return current item: Quick Guestbook