Location: PHPKode > projects > OpenGB Guestbook > gb/gb-install/install.php
<?php
/* -- IF YOU CAN SEE THIS IN YOUR BROWSER, PHP IS NOT AVAILABLE ON THIS SERVER AND OPENGB CANNOT INSTALL -- <!--*/
/* install.php
   Copyright (C) 2008  James Crickmere

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
   
 */
session_start();
include('../config.php');
if($gb_installed == true)
	die('OpenGB has already been installed. To re-install, set $gb_installed to false in config.php and return to this page.');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Install OpenGB</title>
<link href="../default_style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript"><!-- http://www.webmasterworld.com/forum91/441.htm -->
function hideDiv() {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById('loader').style.visibility = 'hidden';
}
else {
if (document.layers) { // Netscape 4
document.loader.visibility = 'hidden';
}
else { // IE 4
document.all.loader.style.visibility = 'hidden';
}
}
} 
function showDiv() {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById('loader').style.visibility = 'visible';
}
else {
if (document.layers) { // Netscape 4
document.loader.visibility = 'visible';
}
else { // IE 4
document.all.loader.style.visibility = 'visible';
}
}
}
</script> 
</head>
<body onload="hideDiv()">

<div id="gb_container">

<table border="0" width="100%">
<tr><td>
<img src="../images/logo.gif" width="253" height="53" alt="OpenGB Guestbook" />
</td><td align="right" valign="top">
<a href="../documentation.html" target="_blank">help</a><br />
<a href="../license.txt" target="_blank">license</a>
</td></tr>
</table>

<h1>Install OpenGB <? echo $gb_version; ?></h1>
<p>Welcome to the OpenGB installer! Thank you for choosing OpenGB as your website guestbook, we hope the installation process completes with the minimum of effort. If you have any problems, go to our <a href="http://opengb.googlecode.com/" target="_blank">support site</a>.</p>

<p><b>Please read <a href="../documentation.html">documentation.html</a> before preceeding.</b></p>

<p>Please fill out the form below:</p>


<?php
if($_SESSION['err']) {
	echo '<p><img src="../images/icons/warning_16.png" height="16" width="16" align="absmiddle" /><span style="color:red;">OpenGB could not install on this server, please fix the errors below and try again:</span></p>' . "\n";
	echo '<ul>';
	if($_SESSION['err_1'])
		echo '<li>No title was specified.</li>';
	if($_SESSION['err_2'])
		echo '<li>No database name was specified - you must specify the name of an existing database or a new one for OpenGB to create.</li>';
	if($_SESSION['err_3'])
		echo '<li>No MySQL username was specified. Please ask your server administrator for the correct MySQL username and password</li>';
	if($_SESSION['err_4'])
		echo '<li>No MySQL password was specified. Please ask your server administrator for the correct MySQL username and password</li>';
	if($_SESSION['err_5'])
		echo '<li>No new OpenGB password was specified. Please think up of a memorable password to use for administrating the OpenGB. The password cannot be blank</li>';
	if($_SESSION['err_6'])
		echo '<li>OpenGB could not connect to the mysql server. Please make sure your MySQL details are correct (host, username, password), and that MySQL is available on this server.</li>';
	if($_SESSION['err_7'])
		echo '<li>OpenGB could not find or create the database, but could connect to the MySQL server. If you are trying to create a new database, you may have to do so through your control panel or ask your server administrator to.</li>';
	unset($_SESSION['err']);
	unset($_SESSION['err_1']);
	unset($_SESSION['err_2']);
	unset($_SESSION['err_3']);
	unset($_SESSION['err_4']);
	unset($_SESSION['err_5']);
	unset($_SESSION['err_6']);
	unset($_SESSION['err_7']);
	
	echo '</ul>';
}
?>
<form action="compile.php" method="post" onsubmit="showDiv()" name="gb_installer_form">
<div style="color:red; font-weight:bold; margin:20px;"><input type="checkbox" name="upgrade" value="yes" />
<label for="upgrade"> Check this box if you are upgrading from a previous installation of OpneGB</label>
</div>
<table border="0" cellpadding="10">
<tr><td align="right" valign="middle">Guestbook title:</td><td align="left" valign="top"><input type="text" name="title" tabindex="1" value="<?php if($_SESSION['title'] != null) echo $_SESSION['title']; ?>" /></td>
<td valign="middle"><span class="gb-notes">Only required if you are not upgrading</span></td>
</tr>
<tr><td align="right" valign="middle">&nbsp;</td><td align="left" valign="top">&nbsp;</td><td></td></tr>
<tr><td align="right" valign="middle">MySQL database name:</td><td align="left" valign="top"><input type="text" name="mysql_dbname" tabindex="2" value="<?php if($_SESSION['mysql_dbname'] != null) echo $_SESSION['mysql_dbname']; else echo 'opengb'; ?>" onchange="document.gb_installer_form.mysql_username.value = document.gb_installer_form.mysql_dbname.value" /></td><td valign="middle"><span class="gb-notes">Required (specify database to use - if database name specified does not exist, OpenGB will attempt to create it for you)</span></td></tr>
<tr><td align="right" valign="middle">Table prefix:</td><td align="left" valign="top"><input type="text" name="mysql_prefix" tabindex="3" value="<?php echo $_SESSION['mysql_prefix']; ?>" /></td><td valign="middle"><span class="gb-notes">(specify text to prefix mysql tables. Leave blank if no prefix required)</span></td></tr>
<tr><td align="right" valign="middle">MySQL hostname:</td><td align="left" valign="top"><input type="text" name="mysql_host" value="<?php if($_SESSION['mysql_host'] != null) echo $_SESSION['mysql_host']; else echo 'localhost'; ?>" tabindex="4" /></td><td valign="middle"><span class="gb-notes">Required (leave as 'localhost' if unsure)</span></td></tr>
<tr><td align="right" valign="middle">MySQL username:</td><td align="left" valign="top"><input type="text" name="mysql_username" tabindex="5" value="<?php echo $_SESSION['mysql_username']; ?>" /></td><td valign="middle"><span class="gb-notes">Required</span></td></tr>
<tr><td align="right" valign="middle">MySQL password:</td><td align="left" valign="top"><input type="password" name="mysql_password" tabindex="6" value="<?php echo $_SESSION['mysql_password']; ?>" /></td><td valign="middle"><span class="gb-notes">Required</span></td></tr>
<tr><td align="right" valign="middle">&nbsp;</td><td align="left" valign="top">&nbsp;</td><td></td></tr>
<tr><td align="right" valign="middle">New OpenGB password:</td><td align="left" valign="top"><input type="password" name="password" tabindex="7" value="<?php echo $_SESSION['password']; ?>" /></td>
<td valign="middle"><span class="gb-notes">Only required if you are not upgrading (Specify a password to use for administrating the guestbook)</span></td>
</tr>
<tr><td align="right" valign="middle">&nbsp;</td><td align="left" valign="top">&nbsp;</td></tr>
<tr><td align="right" valign="middle">&nbsp;</td><td align="right" valign="top"><input type="hidden" name="submitted" value="true" /><input type="image" src="../images/icons/arrow_right_green_48.png" tabindex="8" onclick="showDiv();" align="absmiddle" style="border:none;" /><br /><div id="loader"><img src="../ajax-loader.gif" alt="Loading..." /></div></td><td valign="middle"><span class="gb-notes">Please make sure all the required fields are filled in correctly</span></td></tr>
</table></form>

</div>

</body>
</html>
<?php
unset($_SESSION['title']);
unset($_SESSION['mysql_dbname']);
unset($_SESSION['mysql_prefix']);
unset($_SESSION['mysql_host']);
unset($_SESSION['mysql_username']);
unset($_SESSION['mysql_password']);
unset($_SESSION['password']);
?>
Return current item: OpenGB Guestbook