• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

NathanGibbs3 / BASE / 624

pending completion
624

push

travis-ci-com

NathanGibbs3
Merge branch 'devel'

562 of 562 new or added lines in 28 files covered. (100.0%)

3145 of 17504 relevant lines covered (17.97%)

23.22 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/setup/setup2.php
1
<?php
2
/*******************************************************************************
3
** Basic Analysis and Security Engine (BASE)
4
** Copyright (C) 2004 BASE Project Team
5
** Copyright (C) 2000 Carnegie Mellon University
6
**
7
** (see the file 'base_main.php' for license details)
8
**
9
** Project Leads: Kevin Johnson <kjohnson@secureideas.net>
10
**                Sean Muller <samwise_diver@users.sourceforge.net>
11
** Built upon work by Roman Danyliw <rdd@cert.org>, <roman@danyliw.com>
12
**
13
** Purpose: This file is the second step in the setup program
14
********************************************************************************
15
** Authors:
16
********************************************************************************
17
** Kevin Johnson <kjohnson@secureideas.net
18
**
19
********************************************************************************
20
*/
21
if ( session_id() != '' ){
×
22
        session_start();
×
23
}
24

25
define( "_BASE_INC", 1 );
×
26
include_once("../base_common.inc.php");
×
27
include("../includes/base_setup.inc.php");
×
28

29
if( !is_key('adodbpath', $_SESSION) ){
×
30
  $errorMsg = "ERROR: The php session does not contain the array key \"adodbpath\". This is typically caused by not having allowed cookies. Exiting.";
×
31
  print $errorMsg;
×
32
  exit();
×
33
}
34
$ado_inc_php = $_SESSION['adodbpath'] . "/adodb.inc.php";
×
35
if ($ado_inc_php == "")
×
36
{
37
  print __FILE__ . ":" . __LINE__ . ": ERROR: The variable \$ado_inc_php is empty. Exiting.";
×
38
  exit();
×
39
}
40
else if (!file_exists($ado_inc_php))
×
41
{
42
  print "ERROR: The file \"" . $ado_inc_php . "\" does not exist. Exiting.";
×
43
  exit();
×
44
}
45
else if (!is_readable($ado_inc_php))
×
46
{
47
  print "ERROR: " . $ado_inc_php . " does exist, but is not readable. Typically a permission problem. Exiting.";
×
48
  exit();
×
49
}
50
include($ado_inc_php);
×
51
include_once("../includes/base_state_common.inc.php");
×
52
include_once("../includes/base_constants.inc.php");
×
53

54
if (file_exists('../base_conf.php'))
×
55
        die ("If you wish to re-run the setup routine, please either move OR delete your previous base_conf file first.");
×
56

57
$errorMsg = '';
×
58

59
if (@$_GET['action'] == "check")
×
60
{
61
   // form was submitted do the checks!
62
   $dbtype = ImportHTTPVar("dbtype", VAR_ALPHA);
×
63
   $dbport = ImportHTTPVar("dbport", VAR_DIGIT);
×
64
   $dbhost = ImportHTTPVar("dbhost", VAR_ALPHA | VAR_PERIOD | VAR_SCORE);
×
65
   $dbusername = ImportHTTPVar("dbusername");
×
66
   $dbpasswd = ImportHTTPVar("dbpasswd");
×
67
   $dbname = ImportHTTPVar("dbname", VAR_ALPHA | VAR_SCORE | VAR_USCORE);
×
68
   $arcdbport = ImportHTTPVar("arcdbport", VAR_DIGIT);
×
69
   $arcdbhost = ImportHTTPVar("arcdbhost", VAR_ALPHA | VAR_PERIOD | VAR_SCORE);
×
70
   $arcdbusername = ImportHTTPVar("arcdbusername");
×
71
   $arcdbpasswd = ImportHTTPVar("arcdbpasswd");
×
72
   $arcdbname = ImportHTTPVar("arcdbname", VAR_ALPHA | VAR_SCORE | VAR_USCORE);
×
73

74
   $db = NewADOConnection($dbtype);
×
75
   $dbconnect = $db->Connect( ( ( $dbport == "") ? $dbhost : ($dbhost.":".$dbport) ),
×
76
                              $dbusername, $dbpasswd, $dbname);
77
   if ( !$dbconnect )
×
78
   {
79
      $errorMsg = $errorMsg . "Database connection failed!<br>Please try again!";
×
80
      $error = 1;
×
81
   }
82
   $_SESSION['dbtype'] = $dbtype;
×
83
   $_SESSION['dbhost'] = $dbhost;
×
84
   $_SESSION['dbport'] = $dbport;
×
85
   $_SESSION['dbname'] = $dbname;
×
86
   $_SESSION['dbusername'] = $dbusername;
×
87
   $_SESSION['dbpasswd'] = $dbpasswd;
×
88

89
   $_SESSION['usearchive'] = 0;
×
90
   if (@$_POST['usearchive'] == "on")
×
91
   {
92
       $_SESSION['usearchive'] = 1;
×
93
      $dbconnect = $db->Connect( ( ($arcdbport == "") ? $arcdbhost : ($arcdbhost.":".$arcdbport) ), 
×
94
                                 $arcdbusername, $arcdbpasswd, $arcdbname);
95
      if ( !$dbconnect )
×
96
      {
97
         $errorMsg = $errorMsg . "Archive Database connection failed!<br>Please try again!";
×
98
         $error = 1;
×
99
      }
100
      $_SESSION['arcdbexists'] = 1;
×
101
      $_SESSION['arcdbhost'] = $arcdbhost;
×
102
      $_SESSION['arcdbport'] = $arcdbport;
×
103
      $_SESSION['arcdbname'] = $arcdbname;
×
104
      $_SESSION['arcdbusername'] = $arcdbusername;
×
105
      $_SESSION['arcdbpasswd'] = $arcdbpasswd;
×
106
   }
107
   if ($error != 1)
×
108
   {
109
      header("Location: setup3.php");
×
110
      exit();
×
111
   } else {
×
112
      echo $errorMsg;
×
113
   }
114
}
115

116
?>
117
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
118
<!-- Basic Analysis and Security Engine (BASE) -->
119
<HTML>
120

121
<HEAD>
122
  <META HTTP-EQUIV="pragma" CONTENT="no-cache">
123
  <TITLE>Basic Analysis and Security Engine (BASE)</TITLE>
124
  <LINK rel="stylesheet" type="text/css" HREF="../styles/base_style.css">
125
</HEAD>
126
<BODY>
127
<TABLE WIDTH="100%" BORDER=0 CELLSPACING=0 CELLPADDING=5>
128
    <TR>
129
      <TD class="mainheader"> &nbsp </TD>
130
      <TD class="mainheadertitle">
131
         Basic Analysis and Security Engine (BASE) Setup Program
132
      </TD>
133
    </TR>
134
</TABLE>
135
<br>
136
<P>
137
<?php echo("<div class='errorMsg' align='center'>".$errorMsg."</div>"); ?>
138
<form action=setup2.php?action=check method="POST">
139
<center><table width="50%" border=1 class ="query">
140
<tr><td colspan=2 align="center" class="setupTitle">Step 2 of 5</td><tr>
141
<tr><td class="setupKey" width="50%">Pick a Database type:</td><td class="setupValue"><select name="dbtype">
142
<option value="mysql" <?php if ($_SESSION['dbtype'] == 'mysql') echo "selected";?>>MySQL
143
<option value="postgres" <?php if ($_SESSION['dbtype'] == 'postgres') echo "selected";?>>PostgreSQL
144
<option value="mssql" <?php if ($_SESSION['dbtype'] == 'mssql') echo "selected";?>>Microsoft SQL Server
145
<option value="oci8" <?php if ($_SESSION['dbtype'] == 'oci8') echo "selected";?>>Oracle
146
</select>[<a href="../help/base_setup_help.php#dbtype" onClick="javascript:window.open('../help/base_setup_help.php#dbtype','helpscreen','width=300,height=300');">?</a>]</td</tr>
147
<tr><td colspan=2 align="center">&nbsp;</td></tr>
148
<tr><td class="setupKey">Database Name:</td><td class="setupValue"><input type="text" name="dbname" value="<?php echo $_SESSION['dbname'];?>"></td></tr>
149
<tr><td class="setupKey">Database Host:</td><td class="setupValue"><input type="text" name="dbhost" value="<?php echo $_SESSION['dbhost'];?>"></td></tr>
150
<tr><td class="setupKey">Database Port:<br>Leave blank for default!</td><td class="setupValue"><input type="text" name="dbport" value="<?php echo $_SESSION['dbport'];?>"></td></tr>
151
<tr><td class="setupKey">Database User Name:</td><td class="setupValue"><input type="text" name="dbusername" value="<?php echo $_SESSION['dbusername'];?>"></td></tr>
152
<tr><td class="setupKey">Database Password:</td><td class="setupValue"><input type="password" name="dbpasswd" value="<?php echo $_SESSION['dbpasswd'];?>"></td></tr>
153
<tr><td colspan=2 align="center">&nbsp;</td></tr>
154
<tr><td colspan=2 align="center"><input type="checkbox" name="usearchive" <?php if ($_SESSION['usearchive'] == 1 ) echo "checked";?>>Use Archive Database[<a href="../help/base_setup_help.php#usearchive" onClick="javascript:window.open('../help/base_setup_help.php#usearchive','helpscreen','width=300,height=300');">?</a>]</td></tr>
155
<tr><td class="setupKey">Archive Database Name:</td><td class="setupValue"><input type="text" name="arcdbname" value="<?php echo $_SESSION['arcdbname'];?>"></td></tr>
156
<tr><td class="setupKey">Archive Database Host:</td><td class="setupValue"><input type="text" name="arcdbhost" value="<?php echo $_SESSION['arcdbhost'];?>"></td></tr>
157
<tr><td class="setupKey">Archive Database Port:<br>Leave blank for default!</td><td class="setupValue"><input type="text" name="arcdbport" value="<?php echo $_SESSION['arcdbport'];?>"></td></tr>
158
<tr><td class="setupKey">Archive Database User Name:</td><td class="setupValue"><input type="text" name="arcdbusername" value="<?php echo $_SESSION['arcdbusername'];?>"></td></tr>
159
<tr><td class="setupKey">Archive Database Password:</td><td class="setupValue"><input type="password" name="arcdbpasswd" value="<?php echo $_SESSION['arcdbpasswd'];?>"></td></tr>
160
<tr><td colspan=2 align="center"><input type="submit" value="Continue"></td></tr>
161
</table></center></form>
162
</BODY>
163
</HTML>
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc