root/dev/install/install_step3.php @ 88

Revision 88, 2.5 KB (checked in by exi, 14 years ago)

Added the new installer and modified readme.txt for this.
The needed SQl data will be supplied later.

Line 
1<?php
2$stoppage = true;
3if ($_REQUEST['submit'])
4{
5    $_SESSION['sql'] = array();
6    $_SESSION['sql']['host'] = $_REQUEST['host'];
7    $_SESSION['sql']['user'] = $_REQUEST['user'];
8    $_SESSION['sql']['pass'] = $_REQUEST['dbpass'];
9    $_SESSION['sql']['db'] = $_REQUEST['db'];
10}
11
12if (!$host = $_SESSION['sql']['host'])
13{
14    $host = 'localhost';
15}
16?>
17<form id="options" name="options" method="post" action="?step=3">
18<input type="hidden" name="step" value="3">
19<div class="block-header2">MySQL Database</div>
20<table class="kb-subtable">
21<tr><td width="120"><b>MySQL Host:</b></td><td><input type=text name=host id=host size=20 maxlength=80 value="<?php echo $host; ?>"></td></tr>
22<tr><td width="120"><b>User:</b></td><td><input type=text name=user id=user size=20 maxlength=80 value="<?php echo $_SESSION['sql']['user']; ?>"></td></tr>
23<tr><td width="120"><b>Password:</b></td><td><input type=text name=dbpass id=pass size=20 maxlength=80 value="<?php echo $_SESSION['sql']['pass']; ?>"></td></tr>
24<tr><td width="120"><b>Database:</b></td><td><input type=text name=db id=db size=20 maxlength=80 value="<?php echo $_SESSION['sql']['db']; ?>"></td></tr>
25<tr><td width="120"></td><td><input type=submit name=submit value="Test"></td></tr>
26</table>
27
28<?php
29if ($_SESSION['sql']['db'])
30{
31    echo '<div class="block-header2">Testing Settings</div>';
32    echo 'Got the data you supplied, trying to connect to that sql server now...<br/>';
33    $db = mysql_pconnect($_SESSION['sql']['host'], $_SESSION['sql']['user'], $_SESSION['sql']['pass']);
34    if (is_resource($db))
35    {
36        echo 'Connected to MySQl';
37        $result = mysql_query('SELECT VERSION() AS version');
38        $result = mysql_fetch_assoc($result);
39        if (!$result)
40        {
41            echo '<br/>Something went wrong:<br/>';
42            echo mysql_error();
43        }
44        else
45        {
46            echo ' running Version '.$result['version'].'.<br/>';
47            if (mysql_select_db($_SESSION['sql']['db']))
48            {
49                echo 'Successfully selected database "'.$_SESSION['sql']['db'].'", everything is fine to continue.<br/>';
50                $stoppage = false;
51            }
52            else
53            {
54                echo 'Could not select the database, please check your settings.<br/>';
55            }
56        }
57    }
58    else
59    {
60        echo 'Could not connect to the server, please check your settings.<br/>';
61    }
62}
63?>
64
65<?php if ($stoppage)
66{
67    return;
68}?>
69<p><a href="?step=<?php echo ($_SESSION['state']+1); ?>">Next Step</a></p>
Note: See TracBrowser for help on using the browser.