Checkbox zur Bestätigung, Lizenzbestimmung gelesen zu haben

matze93

Gesperrt
Hey Leute,
ich habe ja schon mal ein Tut zu einem Installationsscript geschrieben. Nun möchte ich eine komplett neue und noch einfachere Art eines PHP-Mysql-Installationsscript veröffentlichen.
PHP:
<!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>MatzeCMS Install</title>

<style type="text/css">
<!--
#main {
	margin-right: auto;
	margin-left: auto;
	width: 950px;
}
body {
	margin: 0px;
	padding: 0px;
	background-color: #666;
	color: #eeeeee;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 14px;
	font-weight: bold;
}
input {
	background-color: #eeeeee;
	border: 1px solid #9FC54E;
	color: #666;
	font-size: 14px;
	padding:4px;
}
strong {
	color: #9FC54E;
	border-bottom-width: 1px;
	border-bottom-style: dotted;
	border-bottom-color: #9FC54E;
	display: block;
	margin-top: 10px;
	font-size: 18px;
	line-height: 30px;
}
.success {
	cursor:pointer;
	height: 50px;
	text-indent: 55px;
	margin: 5px;
	line-height: 50px;
	padding: 5px;
	background-position: 5px;
	font-size: 16px;
	width: 700px;
	border:1px solid #739F1D;
	background-color: #D4F684;
	background-image: url(admin/images/tick.png);
	background-repeat: no-repeat;
	display:block;
	color: #333;
}
.warning {
	height: auto;
	color:#333;
	text-indent: 55px;
	margin: 5px;
	line-height: 50px;
	padding: 5px;
	background-position: 5px;
	font-size: 16px;
	width: 700px;
	border:1px solid #F1AA2D;
	background-color: #FEFFC8;
	background-image: url(admin/images/alert.png);
	background-repeat: no-repeat;
	display:block;
	cursor:pointer;
}
-->
</style>
</head>

<body>
   
<div id='main'>
<?php

if ($_POST)
{
$error = "";
$db_host = $_POST['host'];
$db_username = $_POST['username'];
$db_password = $_POST['password'];
$db_name = $_POST['db'];

$site_name = $_POST['name'];
$site_keywords = $_POST['keywords'];
$site_description = $_POST['description'];
$site_seo = $_POST['seo'];
$site_username = $_POST['site_username'];
$site_password = md5($_POST['site_password']);
$site_email = $_POST['site_email'];

$site_url = $_POST['site_url'];;


$config = fopen("config.php", 'a');
$contents = '<?php
$db[\'host\'] = \''. $db_host . '\';
$db[\'username\'] = \''. $db_username . '\';
$db[\'password\'] = \''. $db_password . '\';
$db[\'name\'] = \''. $db_name . '\';
?>';

$write = fwrite($config, $contents);
if ($write)
{
	fclose($config);
} else
{
	$error .= "<div class='warning'>Failed to write to config file.</div>";
}

$mysql_con = @mysql_connect($db_host,$db_username,$db_password);
if (!$mysql_con) {
	$error .= "<div class='warning'>Unable to connect to mysql.</div>";
}
$mysql_db = @mysql_select_db($db_name);
if (!$mysql_db) {
	$error .= "<div class='warning'>Unable to select database.</div>";
}
$sql[1] = "CREATE TABLE IF NOT EXISTS `pages` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `content` text NOT NULL,
  `title` varchar(455) NOT NULL,
  `menu_title` varchar(255) NOT NULL,
  `show_in_menu` int(10) NOT NULL,
  `keywords` varchar(455) NOT NULL,
  `description` varchar(455) NOT NULL,
  `date` datetime NOT NULL,
  `modified` varchar(100) NOT NULL,
  `active` int(10) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=28 ;";

$sql[2] = "CREATE TABLE IF NOT EXISTS `blocks` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `content` text NOT NULL,
  `description` varchar(455) NOT NULL,
  `name` varchar(50) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=28 ;";

$sql[3] = "
CREATE TABLE IF NOT EXISTS `settings` (
  `name` varchar(255) NOT NULL,
  `keywords` varchar(255) NOT NULL,
  `description` varchar(500) NOT NULL,
  `seo_url` int(3) NOT NULL,
  `template` varchar(50) NOT NULL,
  `site_url` varchar(255) NOT NULL,
  `filemanager_default_directory` varchar(455) NOT NULL,
  `language` varchar(50) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
";

$sql[4] = "CREATE TABLE IF NOT EXISTS `users` (
  `id` int(50) NOT NULL AUTO_INCREMENT,
  `username` varchar(50) NOT NULL,
  `password` varchar(50) NOT NULL,
  `email` varchar(50) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;";

$sql[5] = "CREATE TABLE IF NOT EXISTS `log` (
  `username` varchar(455) NOT NULL,
  `info` varchar(455) NOT NULL,
  `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1;";


$sql[6] = "INSERT INTO `settings` (`name`, `keywords`, `description`, `seo_url`, `template`, `site_url`, `filemanager_default_directory`) VALUES
('$site_name', '$site_keywords', '$site_description', $site_seo, 'templates/default', '$site_url', 'files/');";

$sql[7] = "INSERT INTO `pages` (`id`, `content`, `title`, `menu_title`, `show_in_menu`, `keywords`, `description`, `date`, `modified`, `active`) VALUES
(1, 'Please go to admin section to edit this page', 'Homepage', 'Home', 1, '', '', '2010-02-03 22:21:26', '', 0);
";
$sql[8] = "INSERT INTO `pages` (`id`, `content`, `title`, `menu_title`, `show_in_menu`, `keywords`, `description`, `date`, `modified`, `active`) VALUES
(2, 'Please go to admin section to edit this page', 'Demo Page', 'Demo Page', 1, '', '', '2010-02-03 22:21:26', '', 0);
";
$sql[9] = "INSERT INTO `users` (`username`, `password`, `email`) VALUES
('$site_username', '$site_password', '$site_email');";

$sql[10] = "INSERT INTO `blocks` (`id`, `content`, `description`, `name`) VALUES
('1', '
 <div id=\'block\'> 
  <div id=\'block_heading\'>This is a sample block</div>
You can Edit, Create and Delete blocks in the <a href=\'admin/?action=blocks\'>manage blocks</a>
section in the admin.
  </div>     

', 'Outputs a demo block', 'my first block');";



for ($i=1; $i<=10; $i++)
{
	$q = mysql_query($sql[$i]);
	if (!$q)
 	{
		$m_error = mysql_error();
  		$error .= "<div class='warning'>Error in mysql query $i.<br>$m_error</div>";
  	}
}

if (empty($error))
{ ?>

<div class="success">Success! - MatzeCMS has been successfully installed - visit the admin  <a href="admin/">Here</a>.</div>
    
<?php } else
{ ?>

<div class="warning"> Error has occured - Please check settings</div>
<?=$error?>
<?php }


} else
{
	
	?>
<form id="form1" name="form1" method="post" action="">
  <table width="953" border="0">
    <tr>
      <td width="240"><h3><strong>Mysql Database Settings</strong></h3></td>
      <td width="673">&nbsp;</td>
    </tr>
    <tr>
      <td>Host</td>
      <td><input name="host" type="text" value="localhost" /></td>
    </tr>
    <tr>
      <td>Username</td>
      <td><input type="text" name="username" id="username" /></td>
    </tr>
    <tr>
      <td>Password</td>
      <td><input name="password" type="text" /></td>
    </tr>
    <tr>
      <td>Database Name</td>
      <td><input name="db" type="text" id="db" /> </td>
    </tr>
        <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td><h3><strong>Website Settings</strong></h3></td>
      <td>&nbsp;</td>
    </tr>
        <tr>
      <td>Website URL</td><?php $full_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
	  $full_url = str_replace("install.php","", $full_url);?>
      <td><input name="site_url" type="text" id="site_url" value="<?=$full_url?>" size="50" /></td>
    </tr>
    <tr>
      <td>Admin Username</td>
      <td><input name="site_username" type="text" size="50" id="site_username" /></td>
    </tr>
    <tr>
      <td>Admin Password</td>
      <td><input name="site_password" type="text" size="50" id="site_password" /></td>
    </tr>
        <tr>
      <td>Admin Email</td>
      <td><input name="site_email" type="text" size="50" id="site_email" /></td>
    </tr>
    <tr>
      <td>Website Name</td>
      <td><input name="name" type="text" size="50" /></td>
    </tr>
    <tr>
      <td>Website Description</td>
      <td><input name="description" type="text" size="50" /></td>
    </tr>
        <tr>
      <td>Website Keywords</td>
      <td><input name="keywords" type="text" size="50" /></td>
    </tr>
    <tr>
      <td>Turn on SEO urls</td>
      <td><p>
        <label>
          <input type="radio" name="seo" value="1" id="RadioGroup1_0" />
          Yes</label><br />
        <label>
          <input type="radio" name="seo" value="0" id="RadioGroup1_1" />
          No</label><br />
      </p></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><label>
        <input type="submit" name="submit" id="submit" value="Install" onclick="confirm('Are you sure everything is right?')" />
      </label></td>
    </tr>
  </table>
</form>
<?php } ?>
</div>
</body>
</html>
Wie kann ich dort eine Checkbox einbauen, bei dem steht, "Did you read the License Agreement?". Wenn ja, dann sollte er den Script ausführen. Wenn nein, dann nicht. Per Pop-Up sollte die AGB dann geöffnet werden können.
Außerdem werde ich noch die Passwörter verschüsseln und den Tabellen-Präfix einbauen. Aber das lasst mal meine Sorgen sein.

Danke schon mal im Vorraus.
Matze
 
Du baust einfach eine Checkbox in dein Formular ein:

HTML:
<input type="checkbox" name="agbreaden" value="1"/>

Dann erweiterst du deine if-Kondition:

PHP:
if ($_POST && isset($_POST['agbreaden']) && $_POST['agbreaden'] == '1')
 
Moin.
Dein ehemaliger Themenbetreff: brauch kurz eure Hilfe
Das dürfte jedem soweit klar sein, dass du hier im Forum um Hilfe bittest ;)

Von daher ist diese Formulierung für einen aussagekräftigen Themenbetreff ungeeignet, denn wobei du Hilfe benötigst, geht bzw. ging daraus überhaupt nicht hervor.

Bitte fasse doch in deinen zukünftigen Themen im Betreff die Problem- oder Fragestellung in kurzen Worten zusammen, damit zum einen die User anhand dessen auch nachvollziehen können, womit sich der Thread konkret beschäftigt, und zum anderen die foreneigene Suchfunktion in der Zukunft eine Chance hat, dieses Thema über seinen Thementitel wiederzufinden.

Kein User wird sie mit deinem Wortlaut "brauch kurz eure Hilfe" füttern, um zu dieser Aufgabenstellung nach Lösungen zu suchen.

Vielen Dank! :)

mfg Maik
 
Danke,
bin jetzt fast fertig. Nur das mi der Checkbox habe ich nicht raus. Kann mir einer weiterhelfen?
PHP:
<!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>MatzeCMS Install</title>

<style type="text/css">
<!--
#main {
	margin-right: auto;
	margin-left: auto;
	width: 950px;
}
body {
	margin: 0px;
	padding: 0px;
	background-color: #666;
	color: #eeeeee;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 14px;
	font-weight: bold;
}
input {
	background-color: #eeeeee;
	border: 1px solid #9FC54E;
	color: #666;
	font-size: 14px;
	padding:4px;
}
strong {
	color: #9FC54E;
	border-bottom-width: 1px;
	border-bottom-style: dotted;
	border-bottom-color: #9FC54E;
	display: block;
	margin-top: 10px;
	font-size: 18px;
	line-height: 30px;
}
.success {
	cursor:pointer;
	height: 50px;
	text-indent: 55px;
	margin: 5px;
	line-height: 50px;
	padding: 5px;
	background-position: 5px;
	font-size: 16px;
	width: 700px;
	border:1px solid #739F1D;
	background-color: #D4F684;
	background-image: url(admin/images/tick.png);
	background-repeat: no-repeat;
	display:block;
	color: #333;
}
.warning {
	height: auto;
	color:#333;
	text-indent: 55px;
	margin: 5px;
	line-height: 50px;
	padding: 5px;
	background-position: 5px;
	font-size: 16px;
	width: 700px;
	border:1px solid #F1AA2D;
	background-color: #FEFFC8;
	background-image: url(admin/images/alert.png);
	background-repeat: no-repeat;
	display:block;
	cursor:pointer;
}
-->
</style>
</head>

<body>
   
<div id='main'>
<?php

if ($_POST)
{
$error = "";
$db_host = $_POST['host'];
$db_username = $_POST['username'];
$db_password = $_POST['password'];
$db_name = $_POST['db'];
$db_prefix = $_POST['prefix'];

$site_name = $_POST['name'];
$site_username = $_POST['site_username'];
$site_password = md5($_POST['site_password']);
$site_email = $_POST['site_email'];

$site_url = $_POST['site_url'];;


$config = fopen("config.php", 'a');
$contents = '<?php
$db[\'$server\'] = \''. $db_host . '\';
$db[\'$dbusername\'] = \''. $db_username . '\';
$db[\'$dbpassword\'] = \''. $db_password . '\';
$db[\'$dbname\'] = \''. $db_name . '\';
$db[\'$dbprefix\'] = \''. $db_prefix . '\';
define(\"MatzeCMS_INSTALLED\", true);
?>';

$write = fwrite($config, $contents);
if ($write)
{
	fclose($config);
} else
{
	$error .= "<div class='warning'>Failed to write to config file.</div>";
}

$mysql_con = @mysql_connect($db_host,$db_username,$db_password);
if (!$mysql_con) {
	$error .= "<div class='warning'>Unable to connect to mysql.</div>";
}
$mysql_db = @mysql_select_db($db_name);
if (!$mysql_db) {
	$error .= "<div class='warning'>Unable to select database.</div>";
}
$sql[1] = "CREATE TABLE IF NOT EXISTS `categories` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `title` varchar(255) collate latin1_general_ci NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1;";

$sql[2] = "CREATE TABLE IF NOT EXISTS `checksums` (
  `id` int(3) NOT NULL auto_increment,
  `file` varchar(50) collate latin1_general_ci NOT NULL,
  `checksum` varchar(32) collate latin1_general_ci NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1;";

$sql[3] = "CREATE TABLE IF NOT EXISTS config (
  `default_style` varchar(35) collate latin1_general_ci NOT NULL default '',
  `default_language` varchar(28) collate latin1_general_ci NOT NULL default '',
  `footer_title` varchar(255) collate latin1_general_ci NOT NULL default '',
  `path` varchar(55) collate latin1_general_ci NOT NULL default '',
  `domain_name` varchar(255) collate latin1_general_ci NOT NULL default '',
  `website_name` varchar(90) collate latin1_general_ci NOT NULL default '',
  `email` varchar(255) collate latin1_general_ci NOT NULL default '',
  `gb_entries_per_site` int(11) NOT NULL,
  `comments_per_site` int(11) NOT NULL,
  `frontpage` varchar(31) collate latin1_general_ci NOT NULL default '',
  `gb_wait` int(11) NOT NULL,
  `change_of_name` int(1) NOT NULL,
  `max_pms` int(11) NOT NULL,
  `disable` int(1) NOT NULL,
  `editor_on` int(1) NOT NULL,
  `website_title` varchar(255) collate latin1_general_ci NOT NULL,
  `comments` int(1) NOT NULL,
  `security_on` int(1) NOT NULL,
  `logs` int(1) NOT NULL,
  `email_notification` int(1) NOT NULL,
  `security_shutdown` int(1) NOT NULL,
  `login_lock` int(3) NOT NULL,
  `seo_on` int(1) NOT NULL,
  `secruity_password` varchar(255) collate latin1_general_ci NOT NULL,
  `secruity_code` varchar(255) collate latin1_general_ci NOT NULL,
  `secruity_admin_id` int(11) NOT NULL,
  `max_avatar_width` int(3) NOT NULL,
  `max_avatar_height` int(3) NOT NULL,
  `avatar_rights` int(1) NOT NULL,
  `enable_entries` int(1) NOT NULL,
  `website_disable_message` varchar(255) collate latin1_general_ci NOT NULL,
  `gb_unlock` int(1) NOT NULL,
  `comment_unlock` int(1) NOT NULL,
  `news_on_one_site` int(1) NOT NULL,
  `news_per_page` int(2) NOT NULL,
  `counter_on` int(1) NOT NULL,
  `smtp_server` varchar(50) collate latin1_general_ci NOT NULL,
  `smtp_port` int(5) NOT NULL,
  `smtp_username` varchar(50) collate latin1_general_ci NOT NULL,
  `smtp_password` varchar(70) collate latin1_general_ci NOT NULL,
  `send_via_smtp` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[4] = "CREATE TABLE IF NOT EXISTS `counter` (
  `id` bigint(20) NOT NULL auto_increment,
  `ip` varchar(15) NOT NULL default '',
  `timed` varchar(11) NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[5] = "CREATE TABLE IF NOT EXISTS `guestbook` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `title` varchar(70) collate latin1_general_ci NOT NULL,
  `name` varchar(20) collate latin1_general_ci NOT NULL,
  `email` varchar(30) collate latin1_general_ci NOT NULL,
  `website` varchar(30) collate latin1_general_ci NOT NULL,
  `text` text collate latin1_general_ci NOT NULL,
  `session_ip` varchar(20) collate latin1_general_ci NOT NULL,
  `session_time` varchar(20) collate latin1_general_ci NOT NULL,
  `date` varchar(20) collate latin1_general_ci NOT NULL,
  `show_email` int(1) NOT NULL,
  `locked` int(1) NOT NULL,
  `anonym` int(1) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[6] = "CREATE TABLE IF NOT EXISTS `menu` (
  `id` int(11) NOT NULL auto_increment,
  `menu_order` int(10) unsigned NOT NULL default '0',
  `site_id` int(10) unsigned NOT NULL default '0',
  `title` varchar(55) collate latin1_general_ci NOT NULL default '',
  `link` varchar(255) collate latin1_general_ci NOT NULL default '',
  `ext` int(1) NOT NULL default '0',
  `window` varchar(15) collate latin1_general_ci NOT NULL default '',
  `level` char(1) collate latin1_general_ci NOT NULL default '0',
  `isset` int(11) NOT NULL default '0',
  `menu` int(11) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[7] = "CREATE TABLE IF NOT EXISTS `menus` (
  `id` int(11) NOT NULL auto_increment,
  `title` varchar(255) collate latin1_general_ci NOT NULL,
  `order` int(11) unsigned NOT NULL,
  `isset` int(1) NOT NULL,
  `level` int(1) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[8] = "CREATE TABLE IF NOT EXISTS `messages` (
  `id` int(11) NOT NULL auto_increment,
  `to` varchar(15) collate latin1_general_ci NOT NULL,
  `from` varchar(15) collate latin1_general_ci NOT NULL,
  `subject` varchar(50) collate latin1_general_ci NOT NULL,
  `message` text collate latin1_general_ci NOT NULL,
  `date` varchar(18) collate latin1_general_ci NOT NULL,
  `read` int(1) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[9] = "CREATE TABLE IF NOT EXISTS `profile_fields` (
  `id` int(1) NOT NULL auto_increment,
  `order_nr` int(1) unsigned NOT NULL,
  `name` varchar(30) collate latin1_general_ci NOT NULL,
  `field_name` varchar(30) collate latin1_general_ci NOT NULL,
  `type` varchar(20) collate latin1_general_ci NOT NULL,
  `data` varchar(255) collate latin1_general_ci NOT NULL,
  `radio_options` text collate latin1_general_ci NOT NULL,
  `radio_options_2` varchar(255) collate latin1_general_ci NOT NULL,
  `select_options` varchar(255) collate latin1_general_ci NOT NULL,
  `select_options_2` varchar(255) collate latin1_general_ci NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[10] = "CREATE TABLE IF NOT EXISTS `rights` (
  `registration` int(1) NOT NULL,
  `guestbook` int(1) NOT NULL,
  `guestbook_write` int(1) NOT NULL,
  `who_is_online_list` int(1) NOT NULL,
  `contact_form` int(1) NOT NULL,
  `message_system` int(1) NOT NULL,
  `user_panel` int(1) NOT NULL,
  `view_profiles` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[11] = "CREATE TABLE IF NOT EXISTS `secruity` (
  `id` int(11) NOT NULL auto_increment,
  `username` varchar(255) collate latin1_general_ci NOT NULL,
  `ip` varchar(255) collate latin1_general_ci NOT NULL,
  `login` int(1) NOT NULL,
  `failed` int(11) NOT NULL,
  `hack` int(1) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[12] = "CREATE TABLE IF NOT EXISTS `sessions` (
  `id` int(11) NOT NULL auto_increment,
  `session_time` varchar(30) collate latin1_general_ci NOT NULL,
  `session_ip` varchar(30) collate latin1_general_ci NOT NULL,
  `time` varchar(30) collate latin1_general_ci NOT NULL,
  `name` varchar(14) collate latin1_general_ci NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[13] = "CREATE TABLE IF NOT EXISTS `sites` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `title` varchar(42) collate latin1_general_ci NOT NULL,
  `text` mediumtext collate latin1_general_ci NOT NULL,
  `date` varchar(255) collate latin1_general_ci NOT NULL default '',
  `set_date` int(1) NOT NULL default '0',
  `cat` varchar(255) collate latin1_general_ci NOT NULL default '',
  `level` int(11) NOT NULL default '0',
  `trash` int(1) NOT NULL,
  `trash_date` varchar(255) collate latin1_general_ci NOT NULL,
  `comments_on` int(11) NOT NULL default '0',
  `news` int(1) NOT NULL default '0',
  `newssite` int(11) NOT NULL default '0',
  `user_id` int(11) NOT NULL,
  `level2` int(1) NOT NULL,
  `level3` int(1) NOT NULL,
  `show_author` int(1) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[14] = "CREATE TABLE IF NOT EXISTS `site_comments` (
  `id` int(11) NOT NULL auto_increment,
  `site_id` int(11) NOT NULL,
  `subject` varchar(55) collate latin1_general_ci NOT NULL,
  `username` varchar(255) collate latin1_general_ci NOT NULL,
  `user_id` int(11) NOT NULL,
  `date` varchar(255) collate latin1_general_ci NOT NULL,
  `text` text collate latin1_general_ci NOT NULL,
  `anonym` int(1) NOT NULL,
  `locked` int(1) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[15] = "CREATE TABLE IF NOT EXISTS `site_news` (
  `id` int(11) NOT NULL auto_increment,
  `site_id` int(11) NOT NULL,
  `title` varchar(255) collate latin1_general_ci NOT NULL,
  `message` text collate latin1_general_ci NOT NULL,
  `date` varchar(255) collate latin1_general_ci NOT NULL,
  `user_id` int(11) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[16] = "CREATE TABLE IF NOT EXISTS `user` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(255) collate latin1_general_ci NOT NULL default '',
  `password` varchar(255) collate latin1_general_ci NOT NULL default '',
  `email` varchar(255) collate latin1_general_ci NOT NULL default '',
  `level` int(11) NOT NULL default '0',
  `autologin` int(1) NOT NULL default '0',
  `ban` int(1) NOT NULL default '0',
  `session_time` varchar(25) collate latin1_general_ci NOT NULL,
  `time` varchar(5) collate latin1_general_ci NOT NULL,
  `active` char(1) collate latin1_general_ci NOT NULL default '',
  `act_key` varchar(255) collate latin1_general_ci NOT NULL default '',
  `ice` int(1) NOT NULL,
  `email_pm` int(1) NOT NULL,
  `avatar` varchar(255) collate latin1_general_ci NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[17] = "INSERT INTO `config` VALUES ('standard', 'german', '', '', '', '$site_name', '', 5, 5, 'Startseite', 15, 0, 25, 0, 1, 'Dein Browser-Titel', 1, 1, 1, 1, 3, 3, 1, '', '', 2, 220, 220, 3, 1, '', 1, 1, 1, 20, 0, '', 25, '', '', 0);";
$sql[18] = "INSERT INTO `categories` VALUES (11, 'Kategorie 1');";
$sql[19] = "INSERT INTO `counter` VALUES (2, '127.0.0.1', '1230998140');";
$sql[20] = "INSERT INTO `menu` VALUES (1, 3, 1, 'Einloggen', 'login.php', 0, '_parent', '4', 1, 2);";
$sql[21] = "INSERT INTO `menu` VALUES (2, 4, 1, 'Ausloggen', 'login.php?mode=logout', 0, '_parent', '3', 1, 2);";
$sql[22] = "INSERT INTO `menu` VALUES (3, 1, 1, 'Benutzer-Profil', 'profile.php', 0, '_parent', '3', 1, 2);";
$sql[23] = "INSERT INTO `menu` VALUES (4, 2, 2, 'News', 'sites.php?id=46', 0, '_parent', '5', 1, 1);";
$sql[24] = "INSERT INTO `menu` VALUES (5, 3, 1, 'Kontakt', 'contact.php', 0, '_parent', '5', 1, 1);";
$sql[25] = "INSERT INTO `menu` VALUES (7, 2, 1, 'Gästebuch', 'guestbook.php', 0, '_parent', '5', 1, 1);";
$sql[26] = "INSERT INTO `menu` VALUES (8, 2, 1, 'Postfach', 'message.php', 0, '_parent', '3', 1, 2);";
$sql[27] = "INSERT INTO `menu` VALUES (9, 1, 1, 'Home', 'sites.php?id=41', 0, '_parent', '5', 1, 1);";
$sql[28] = "INSERT INTO `menus` VALUES (1, 'Allgemein', 1, 1, 5);";
$sql[29] = "INSERT INTO `menus` VALUES (2, 'Benutzer', 3, 1, 5);";
$sql[30] = "INSERT INTO `rights` VALUES (5, 5, 5, 5, 5, 5, 5, 5);";
$sql[31] = "INSERT INTO `sites` VALUES (1, 'Startseite', 'Thank you for Instaling MatzeCMS. Go in the Administrationzone and edit this page!', '14.01.09, 18:46', 0, 'Kategorie 1', 5, 0, '', 1, 0, 41, 1, 3, 5, 1);";
$sql[32] = "INSERT INTO `sites` VALUES (2, 'Neuigkeiten über MatzeCMS', '', '10.01.09, 19:07', 0, 'Kategorie 1', 5, 1, '14.01.09, 18:45', 0, 1, 45, 1, 3, 5, 0);";
$sql[33] = "INSERT INTO `site_comments` VALUES (52, 41, 'Beispielkommentar', 'Dörflinger', 1, '17.01.09, 12:38', 'Das hier ist ein Beispielkommentar, den du löschen und natürlich auch ändern kannst. In MatzeCMS gibt es BBCodes welche Text formatieren. \r\n\r\nDas hier ist z.B. klein geschrieben, unterstrichener und dunkelblauer Code.\r\n\r\n', 1, 0);";
$sql[34] = "INSERT INTO `site_news` VALUES (1, 2, 'Beispielnews', 'Das hier ist eine Beispielnews. Um einen Newsflash, also einen Auszug der neuesten News auf einer Textseite anzeigen zu lassen, musst du im Editor an einer beliebigen Stelle [_NEWSFLASH_] einfügen. Diese Variable zeigt dann die ersten 170 Zeichen der News.\r\n\r\nVon welcher Newsseite der Newsflash kommt, kannst du auf jeder Textseite einstellen.', '17.01.09, 12:36', 1);";
$sql[35] = "INSERT INTO `user` VALUES (1, 'admin', '23a0fdf9f361600aa64ce58fdd082331', 'matthiasdoerflinger@googlemail.com', 1, 0, 0, '', '', '1', '-1', 1232190385, 1, '');";
$sql[36] = "INSERT INTO `user` VALUES (2, '$site_username', '$site_password' , '$site_email', 1, 0, 0, '', '', '1', '-1', 1232190385, 1, '');";

for ($i=1; $i<=36; $i++)
{
	$q = mysql_query($sql[$i]);
	if (!$q)
 	{
		$m_error = mysql_error();
  		$error .= "<div class='warning'>Error in mysql query $i.<br>$m_error</div>";
  	}
}

if (empty($error))
{ ?>

<div class="success">Success! - MatzeCMS has been successfully installed - visit the admin  <a href="admin/">Here</a>.</div>
    
<?php } else
{ ?>

<div class="warning"> Error has occured - Please check settings</div>
<?=$error?>
<?php }


} else
{
	
	?>
<form id="form1" name="form1" method="post" action="">
  <table width="953" border="0">
    <tr>
      <td width="240"><h3><strong>Welcome to MatzeCMS</strong></h3></td>
      <td width="673">&nbsp;</td>
    </tr>  
	<tr>
	  <td>Informations</td>
      <td>Welcome to the automatically installationsscript of MatzeCMS. Please check before you install MatzeCMS that no other Version of MatzeCMS is installed. Good Luck wih my content management system. <br> Matthias Doerflinger</td>
    </tr>
    <tr>
      <td width="240"><h3><strong>Mysql Database Settings</strong></h3></td>
      <td width="673">&nbsp;</td>
    </tr>
    <tr>
      <td>Host</td>
      <td><input name="host" type="text" value="localhost" /></td>
    </tr>
    <tr>
      <td>Username</td>
      <td><input type="text" name="username" id="username" /></td>
    </tr>
    <tr>
      <td>Password</td>
      <td><input name="password" type="text" /></td>
    </tr>
    <tr>
      <td>Database Name</td>
      <td><input name="db" type="text" id="db" /> </td>
    </tr>
        <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td><h3><strong>Website Settings</strong></h3></td>
      <td>&nbsp;</td>
    </tr>
        <tr>
      <td>Website URL</td><?php $full_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
	  $full_url = str_replace("install.php","", $full_url);?>
      <td><input name="site_url" type="text" id="site_url" value="<?=$full_url?>" size="50" /></td>
    </tr>
    <tr>
      <td>Admin Username</td>
      <td><input name="site_username" type="text" size="50" id="site_username" /></td>
    </tr>
    <tr>
      <td>Admin Password</td>
      <td><input name="site_password" type="text" size="50" id="site_password" /></td>
    </tr>
        <tr>
      <td>Admin Email</td>
      <td><input name="site_email" type="text" size="50" id="site_email" /></td>
    </tr>
    <tr>
      <td>Website Name</td>
      <td><input name="name" type="text" size="50" /></td>
    </tr>
	<tr>
      <td width="240"><h3><strong>License</strong></h3></td>
      <td width="673">&nbsp;</td>
    </tr>  
	<tr>
      <td><input type="checkbox" align="right" name="license" value="1"/><br><br></td>
      <td>I have read the <a href='docs/license.htm' onclick='FensterOeffnen(this.href); return false'>License</a>and agree with it.<br><br></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><label>
        <input type="submit" name="submit" id="submit" value="Install" onclick="confirm('Are you sure everything is right?')" />
      </label></td>
    </tr>
  </table>
</form>
<?php } ?>
</div>
</body>
</html>
Die Box ist jetzt drin. Ich möchte, dass man nur auf Install klicken kann, wenn die Checkbox aktiviert ist. Ansonsten sollte man den Button am Besten gar nicht sehen.
Wenn keiner das hinkriegt oder es unmöglich ist, dann ganz normal mit Fehlermeldung und Back-Link.
@saftmeister: hat mir leider nicht weiergeholfen. Habs ein paar mal versucht.
 
Hi Matze
Ich habe sowas ähnliches bei mir so gelöst, vielleicht hilft es dir ja.
PHP:
<?php 
echo '<form method="post" action="index.php?ct=ct/anmelden.php&amp;id=$id">';
echo '<p>Ich habe die AGB&acute;s gelesen und bin damit einverstanden.<input type="checkbox" name="id" value="1" /></p>';
echo '<p>Ich habe die AGB&acute;s gelesen und bin damit <strong>nicht</strong> einverstanden.<input type="checkbox" name="id" value="2" /></p>';
echo '<p>Ich m&ouml;chte die AGB&acute;s lesen.<input type="checkbox" name="id" value="3" /></p>';
echo '<p><input class="formbut" type="submit" value="Weiter" /></p>';
echo '</form>';
if (isset($_POST['id']))
{
switch($_POST['id'])
{
case 1:
$url = "index.php?ct=ct/user.php&jump=write";
break;
case 2:
$url = "index.php?ct=ct/start.php";
break;
case 3:
include ("ct/agb.php");
break;
}
header("Location:$url");
}
?>
 
Das was du willst ist rein mit javascript lösbar und nicht mit php. Mit php solltest du es aber noch nachprüfen so wie bereits beschrieben.
Javascript/HTML sieht so aus
HTML:
	<tr>
      <td><input onclick="document.getElementById('submit').removeAttribute('disabled', 0);" type="checkbox" align="right" name="license" value="1"/><br><br></td>
      <td>I have read the <a href='docs/license.htm' onclick='FensterOeffnen(this.href); return false'>License</a>and agree with it.<br><br></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><label>
        <input type="submit" disabled="disabled" name="submit" id="submit" value="Install" onclick="confirm('Are you sure everything is right?')" />
      </label></td>
    </tr>
  </table>
 
Danke dir Da_Chris,
ich habe nun meinen Code mit dem Installscript fertig.

hier habt ihr mal einen Einblick:
PHP:
<!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>MatzeCMS Install</title>

<style type="text/css">
<!--
#main {
	color: #333;
	background-color: #eeeeee;
	width: 950px;
	margin-top: 50px;
	margin-right: auto;
	margin-left: auto;
	padding: 20px;
	border: 1px solid #666;
}
body {
	margin: 0px;
	padding: 0px;
	background-color: #333;
	color: #eeeeee;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 14px;
	font-weight: bold;
}
input {
	background-color: #eeeeee;
	border: 1px solid #9FC54E;
	color: #666;
	font-size: 14px;
	padding:4px;
}
strong {
	color: #9FC54E;
	border-bottom-width: 1px;
	border-bottom-style: dotted;
	border-bottom-color: #9FC54E;
	display: block;
	margin-top: 10px;
	font-size: 18px;
	line-height: 30px;
}
.success {
	cursor:pointer;
	height: 50px;
	text-indent: 55px;
	margin: 5px;
	line-height: 50px;
	padding: 5px;
	background-position: 5px;
	font-size: 16px;
	width: 700px;
	border:1px solid #739F1D;
	background-color: #D4F684;
	background-image: url(admin/images/tick.png);
	background-repeat: no-repeat;
	display:block;
	color: #333;
}
.warning {
	height: auto;
	color:#333;
	text-indent: 55px;
	margin: 5px;
	line-height: 50px;
	padding: 5px;
	background-position: 5px;
	font-size: 16px;
	width: 700px;
	border:1px solid #F1AA2D;
	background-color: #FEFFC8;
	background-image: url(admin/images/alert.png);
	background-repeat: no-repeat;
	display:block;
	cursor:pointer;
}
-->
</style>
</head>

<body>
   
<div id='main'>
<?php

if ($_POST)
{
$error = "";
$db_host = $_POST['host'];
$db_username = $_POST['username'];
$db_password = $_POST['password'];
$db_name = $_POST['db'];
$db_prefix = $_POST['prefix'];

$site_name = $_POST['name'];
$site_username = $_POST['site_username'];
$site_password = md5($_POST['site_password']);
$site_email = $_POST['site_email'];

$site_url = $_POST['site_url'];;


$config = fopen("../config.php", 'a');
$contents = '<?php
$db[\'$db_host\'] = \''. $db_host . '\';
$db[\'$db_name\'] = \''. $db_name . '\';
$db[\'$db_username\'] = \''. $db_username . '\';
$db[\'$db_password\'] = \''. $db_password . '\';

$link = mysql_connect($db_host, $db_username, $db_password) or die ("Keine Verbindung zu der Datenbank möglich.");
mysql_select_db($db_name, $link);

define("MatzeCMS_INSTALLED", true);
?>';

$write = fwrite($config, $contents);
if ($write)
{
	fclose($config);
} else
{
	$error .= "<div class='warning'>Failed to write to config file.</div>";
}

$mysql_con = @mysql_connect($db_host,$db_username,$db_password);
if (!$mysql_con) {
	$error .= "<div class='warning'>Unable to connect to mysql.</div>";
}
$mysql_db = @mysql_select_db($db_name);
if (!$mysql_db) {
	$error .= "<div class='warning'>Unable to select database.</div>";
}
$sql[1] = "CREATE TABLE IF NOT EXISTS `cms_articles` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `title` varchar(42) collate latin1_general_ci NOT NULL,
  `text` mediumtext collate latin1_general_ci NOT NULL,
  `cat` varchar(255) collate latin1_general_ci NOT NULL default '',
  `date` varchar(255) collate latin1_general_ci NOT NULL default '',
  `set_date` int(1) NOT NULL default '0',
  `level` int(11) NOT NULL default '0',
  `trash` int(1) NOT NULL,
  `trash_date` varchar(255) collate latin1_general_ci NOT NULL,
  `comments_on` int(11) NOT NULL default '0',
  `show_author` int(1) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[2] = "CREATE TABLE IF NOT EXISTS `cms_article_categories` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `title` varchar(255) collate latin1_general_ci NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1;";

$sql[3] = "CREATE TABLE IF NOT EXISTS `cms_article_comments` (
  `id` int(11) NOT NULL auto_increment,
  `article_id` int(11) NOT NULL,
  `subject` varchar(55) collate latin1_general_ci NOT NULL,
  `username` varchar(255) collate latin1_general_ci NOT NULL,
  `user_id` int(11) NOT NULL,
  `date` varchar(255) collate latin1_general_ci NOT NULL,
  `text` text collate latin1_general_ci NOT NULL,
  `anonym` int(1) NOT NULL,
  `locked` int(1) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[4] = "CREATE TABLE IF NOT EXISTS `cms_article_vote` (
  `article_id` bigint(20) NOT NULL auto_increment,
  `stars` varchar(15) NOT NULL default '',
  PRIMARY KEY  (`article_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[5] = "CREATE TABLE IF NOT EXISTS `cms_blog` (
  `id` int(11) NOT NULL auto_increment,
  `blog_id` int(11) NOT NULL,
  `title` varchar(255) collate latin1_general_ci NOT NULL,
  `message` text collate latin1_general_ci NOT NULL,
  `date` varchar(255) collate latin1_general_ci NOT NULL,
  `user_id` int(11) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[6] = "CREATE TABLE IF NOT EXISTS `cms_board` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(255) collate latin1_general_ci NOT NULL,
  `info` text collate latin1_general_ci NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[7] = "CREATE TABLE IF NOT EXISTS `cms_board_topics` (
  `id` int(11) NOT NULL auto_increment,
  `board_id` int(11) NOT NULL,
  `title` varchar(255) collate latin1_general_ci NOT NULL,
  `date` varchar(255) collate latin1_general_ci NOT NULL,
  `username` varchar(255) collate latin1_general_ci NOT NULL,  
  `user_id` int(11) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[8] = "CREATE TABLE IF NOT EXISTS `cms_board_posts` (
  `id` int(11) NOT NULL auto_increment,
  `board_id` int(11) NOT NULL,
  `topic_id` int(11) NOT NULL,
  `post_id` int(11) NOT NULL,
  `title` varchar(255) collate latin1_general_ci NOT NULL,
  `message` text collate latin1_general_ci NOT NULL,
  `date` varchar(255) collate latin1_general_ci NOT NULL,
  `username` varchar(255) collate latin1_general_ci NOT NULL, 
  `user_id` int(11) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[9] = "CREATE TABLE IF NOT EXISTS `cms_checksums` (
  `id` int(3) NOT NULL auto_increment,
  `file` varchar(50) collate latin1_general_ci NOT NULL,
  `checksum` varchar(32) collate latin1_general_ci NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1;";

$sql[10] = "CREATE TABLE IF NOT EXISTS `cms_config` (
  `default_style` varchar(35) collate latin1_general_ci NOT NULL default '',
  `default_language` varchar(28) collate latin1_general_ci NOT NULL default '',
  `website_name` varchar(90) collate latin1_general_ci NOT NULL default '', 
  `footer_title` varchar(255) collate latin1_general_ci NOT NULL default '',
  `path` varchar(55) collate latin1_general_ci NOT NULL default '',
  `domain_name` varchar(255) collate latin1_general_ci NOT NULL default '',
  `frontpage` varchar(31) collate latin1_general_ci NOT NULL default '', 
  `email` varchar(255) collate latin1_general_ci NOT NULL default '',
  `gb_entries_per_site` int(11) NOT NULL,
  `comments_per_site` int(11) NOT NULL,
  `gb_wait` int(11) NOT NULL,
  `change_of_name` int(1) NOT NULL,
  `max_pms` int(11) NOT NULL,
  `disable` int(1) NOT NULL,
  `editor_on` int(1) NOT NULL,
  `website_title` varchar(255) collate latin1_general_ci NOT NULL,
  `comments` int(1) NOT NULL,
  `security_on` int(1) NOT NULL,
  `logs` int(1) NOT NULL,
  `email_notification` int(1) NOT NULL,
  `security_shutdown` int(1) NOT NULL,
  `login_lock` int(3) NOT NULL,
  `seo_on` int(1) NOT NULL,
  `secruity_password` varchar(255) collate latin1_general_ci NOT NULL,
  `secruity_code` varchar(255) collate latin1_general_ci NOT NULL,
  `secruity_admin_id` int(11) NOT NULL,
  `max_avatar_width` int(3) NOT NULL,
  `max_avatar_height` int(3) NOT NULL,
  `avatar_rights` int(1) NOT NULL,
  `enable_entries` int(1) NOT NULL,
  `website_disable_message` varchar(255) collate latin1_general_ci NOT NULL,
  `gb_unlock` int(1) NOT NULL,
  `comment_unlock` int(1) NOT NULL,
  `news_on_one_site` int(1) NOT NULL,
  `news_per_page` int(2) NOT NULL,
  `counter_on` int(1) NOT NULL,
  `smtp_server` varchar(50) collate latin1_general_ci NOT NULL,
  `smtp_port` int(5) NOT NULL,
  `smtp_username` varchar(50) collate latin1_general_ci NOT NULL,
  `smtp_password` varchar(70) collate latin1_general_ci NOT NULL,
  `send_via_smtp` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[11] = "CREATE TABLE IF NOT EXISTS `cms_counter` (
  `id` bigint(20) NOT NULL auto_increment,
  `ip` varchar(15) NOT NULL default '',
  `time` varchar(11) NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[12] = "CREATE TABLE IF NOT EXISTS `cms_gallery` (
  `id` bigint(20) NOT NULL auto_increment,
  `name` varchar(15) NOT NULL default '',
  `time` varchar(11) NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[13] = "CREATE TABLE IF NOT EXISTS `cms_gallery_images` (
  `gallery_id` bigint(20) NOT NULL auto_increment,
  `image` varchar(15) NOT NULL default '',
  `info` text collate latin1_general_ci NOT NULL,
  `time` varchar(11) NOT NULL default '',
  PRIMARY KEY  (`gallery_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[14] = "CREATE TABLE IF NOT EXISTS `cms_gallery_images_comments` (
  `image_id` int(11) NOT NULL,
  `subject` varchar(55) collate latin1_general_ci NOT NULL,
  `username` varchar(255) collate latin1_general_ci NOT NULL,
  `user_id` int(11) NOT NULL,
  `date` varchar(255) collate latin1_general_ci NOT NULL,
  `text` text collate latin1_general_ci NOT NULL,
  `anonym` int(1) NOT NULL,
  `locked` int(1) NOT NULL,  
  PRIMARY KEY  (`image_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[15] = "CREATE TABLE IF NOT EXISTS `cms_gallery_images_vote` (
  `gallery_id` bigint(20) NOT NULL auto_increment,
  `image_id` bigint(20) NOT NULL,
  `stars` varchar(15) NOT NULL default '',
  PRIMARY KEY  (`gallery_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[16] = "CREATE TABLE IF NOT EXISTS `cms_groups` (
  `id` bigint(20) NOT NULL auto_increment,
  `name` varchar(15) NOT NULL default '',
  `info` text collate latin1_general_ci NOT NULL,
  `time` varchar(11) NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[17] = "CREATE TABLE IF NOT EXISTS `cms_guestbook` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `title` varchar(70) collate latin1_general_ci NOT NULL,
  `name` varchar(20) collate latin1_general_ci NOT NULL,
  `email` varchar(30) collate latin1_general_ci NOT NULL,
  `website` varchar(30) collate latin1_general_ci NOT NULL,
  `text` text collate latin1_general_ci NOT NULL,
  `session_ip` varchar(20) collate latin1_general_ci NOT NULL,
  `session_time` varchar(20) collate latin1_general_ci NOT NULL,
  `date` varchar(20) collate latin1_general_ci NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[18] = "CREATE TABLE IF NOT EXISTS `cms_menu` (
  `id` int(11) NOT NULL auto_increment,
  `menu_order` int(10) unsigned NOT NULL default '0',
  `site_id` int(10) unsigned NOT NULL default '0',
  `title` varchar(55) collate latin1_general_ci NOT NULL default '',
  `link` varchar(255) collate latin1_general_ci NOT NULL default '',
  `ext` int(1) NOT NULL default '0',
  `window` varchar(15) collate latin1_general_ci NOT NULL default '',
  `level` char(1) collate latin1_general_ci NOT NULL default '0',
  `isset` int(11) NOT NULL default '0',
  `menu` int(11) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[19] = "CREATE TABLE IF NOT EXISTS `cms_menus` (
  `id` int(11) NOT NULL auto_increment,
  `title` varchar(255) collate latin1_general_ci NOT NULL,
  `order` int(11) unsigned NOT NULL,
  `level` int(1) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[20] = "CREATE TABLE IF NOT EXISTS `cms_messages` (
  `id` int(11) NOT NULL auto_increment,
  `to` varchar(15) collate latin1_general_ci NOT NULL,
  `from` varchar(15) collate latin1_general_ci NOT NULL,
  `subject` varchar(50) collate latin1_general_ci NOT NULL,
  `message` text collate latin1_general_ci NOT NULL,
  `date` varchar(18) collate latin1_general_ci NOT NULL,
  `read` int(1) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[21] = "CREATE TABLE IF NOT EXISTS `cms_news` (
  `id` int(11) NOT NULL auto_increment,
  `site_id` int(11) NOT NULL,
  `title` varchar(255) collate latin1_general_ci NOT NULL,
  `message` text collate latin1_general_ci NOT NULL,
  `date` varchar(255) collate latin1_general_ci NOT NULL,
  `user_id` int(11) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[22] = "CREATE TABLE IF NOT EXISTS `cms_profile_fields` (
  `id` int(1) NOT NULL auto_increment,
  `order` int(1) unsigned NOT NULL,
  `name` varchar(30) collate latin1_general_ci NOT NULL,
  `field_name` varchar(30) collate latin1_general_ci NOT NULL,
  `type` varchar(20) collate latin1_general_ci NOT NULL,
  `data` varchar(255) collate latin1_general_ci NOT NULL,
  `radio_options` text collate latin1_general_ci NOT NULL,
  `radio_options_2` varchar(255) collate latin1_general_ci NOT NULL,
  `select_options` varchar(255) collate latin1_general_ci NOT NULL,
  `select_options_2` varchar(255) collate latin1_general_ci NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[23] = "CREATE TABLE IF NOT EXISTS `cms_rights` (
  `registration` int(1) NOT NULL,
  `guestbook` int(1) NOT NULL,
  `guestbook_write` int(1) NOT NULL,
  `who_is_online_list` int(1) NOT NULL,
  `contact_form` int(1) NOT NULL,
  `message_system` int(1) NOT NULL,
  `user_panel` int(1) NOT NULL,
  `view_profiles` int(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[24] = "CREATE TABLE IF NOT EXISTS `cms_secruity` (
  `id` int(11) NOT NULL auto_increment,
  `username` varchar(255) collate latin1_general_ci NOT NULL,
  `ip` varchar(255) collate latin1_general_ci NOT NULL,
  `login` int(1) NOT NULL,
  `failed` int(11) NOT NULL,
  `hack` int(1) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[25] = "CREATE TABLE IF NOT EXISTS `cms_sessions` (
  `id` int(11) NOT NULL auto_increment,
  `session_time` varchar(30) collate latin1_general_ci NOT NULL,
  `session_ip` varchar(30) collate latin1_general_ci NOT NULL,
  `time` varchar(30) collate latin1_general_ci NOT NULL,
  `name` varchar(14) collate latin1_general_ci NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[26] = "CREATE TABLE IF NOT EXISTS `cms_sites` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `title` varchar(42) collate latin1_general_ci NOT NULL,
  `text` mediumtext collate latin1_general_ci NOT NULL,
  `date` varchar(255) collate latin1_general_ci NOT NULL default '',
  `set_date` int(1) NOT NULL default '0',
  `cat` varchar(255) collate latin1_general_ci NOT NULL default '',
  `level` int(11) NOT NULL default '0',
  `trash` int(1) NOT NULL,
  `trash_date` varchar(255) collate latin1_general_ci NOT NULL,
  `comments_on` int(11) NOT NULL default '0',
  `news` int(1) NOT NULL default '0',
  `newssite` int(11) NOT NULL default '0',
  `user_id` int(11) NOT NULL,
  `level2` int(1) NOT NULL,
  `level3` int(1) NOT NULL,
  `show_author` int(1) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[27] = "CREATE TABLE IF NOT EXISTS `cms_site_categories` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `title` varchar(255) collate latin1_general_ci NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1;";

$sql[28] = "CREATE TABLE IF NOT EXISTS `cms_site_comments` (
  `id` int(11) NOT NULL auto_increment,
  `site_id` int(11) NOT NULL,
  `subject` varchar(55) collate latin1_general_ci NOT NULL,
  `username` varchar(255) collate latin1_general_ci NOT NULL,
  `user_id` int(11) NOT NULL,
  `date` varchar(255) collate latin1_general_ci NOT NULL,
  `text` text collate latin1_general_ci NOT NULL,
  `anonym` int(1) NOT NULL,
  `locked` int(1) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[29] = "CREATE TABLE IF NOT EXISTS `cms_user` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(255) collate latin1_general_ci NOT NULL default '',
  `password` varchar(255) collate latin1_general_ci NOT NULL default '',
  `email` varchar(255) collate latin1_general_ci NOT NULL default '',
  `level` int(11) NOT NULL default '0',
  `autologin` int(1) NOT NULL default '0',
  `ban` int(1) NOT NULL default '0',
  `session_time` varchar(25) collate latin1_general_ci NOT NULL,
  `time` varchar(5) collate latin1_general_ci NOT NULL,
  `active` char(1) collate latin1_general_ci NOT NULL default '',
  `act_key` varchar(255) collate latin1_general_ci NOT NULL default '',
  `ice` int(1) NOT NULL,
  `email_pm` int(1) NOT NULL,
  `avatar` varchar(255) collate latin1_general_ci NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[30] = "CREATE TABLE IF NOT EXISTS `cms_user_friends` (
  `name` varchar(255) collate latin1_general_ci NOT NULL default '',
  `friend` varchar(255) collate latin1_general_ci NOT NULL default '',
  PRIMARY KEY  (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[31] = "CREATE TABLE IF NOT EXISTS `cms_user_groups` (
  `name` varchar(255) collate latin1_general_ci NOT NULL default '',
  `group` varchar(255) collate latin1_general_ci NOT NULL default '',
  PRIMARY KEY  (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;";

$sql[32] = "INSERT INTO `cms_config` VALUES ('standard', 'german', '$site_name', '', '$path', '$site_url', 'Startseite', 1, 15, 25, 0, 1, 25, 0, 1, 'Dein Browser-Titel', 1, 1, 1, 1, '', '', 1, '', '', 2, 220, 220, 3, 1, '', 1, 1, 1, 20, 0, '', 25, '', '', 0);";
$sql[33] = "INSERT INTO `cms_site_categories` VALUES (1, 'Allgemein');";
$sql[34] = "INSERT INTO `cms_counter` VALUES (2, '127.0.0.1', '1230998140');";
$sql[35] = "INSERT INTO `cms_menu` VALUES (1, 3, 2, 'Einloggen', 'login.php', 0, '_parent', '4', 1, 2);";
$sql[36] = "INSERT INTO `cms_menu` VALUES (2, 3, 2, 'Registrieren', 'register.php', 0, '_parent', '4', 1, 2);";
$sql[37] = "INSERT INTO `cms_menu` VALUES (3, 1, 2, 'Benutzer-Profil', 'profile.php', 0, '_parent', '3', 1, 2);";
$sql[38] = "INSERT INTO `cms_menu` VALUES (4, 2, 2, 'Postfach', 'message.php', 0, '_parent', '3', 1, 2);";
$sql[39] = "INSERT INTO `cms_menu` VALUES (5, 4, 2, 'Ausloggen', 'login.php?mode=logout', 0, '_parent', '3', 1, 2);";
$sql[40] = "INSERT INTO `cms_menu` VALUES (6, 1, 1, 'Home', 'sites.php?id=41', 0, '_parent', '5', 1, 1);";
$sql[41] = "INSERT INTO `cms_menu` VALUES (7, 2, 1, 'News', 'sites.php?id=46', 0, '_parent', '5', 1, 1);";
$sql[42] = "INSERT INTO `cms_menu` VALUES (8, 2, 1, 'Gästebuch', 'guestbook.php', 0, '_parent', '5', 1, 1);";
$sql[43] = "INSERT INTO `cms_menus` VALUES (1, 'Allgemein', 1, 5);";
$sql[44] = "INSERT INTO `cms_menus` VALUES (2, 'Benutzer', 3, 5);";
$sql[45] = "INSERT INTO `cms_rights` VALUES (3, 5, 5, 5, 5, 5, 5, 5);";
$sql[46] = "INSERT INTO `cms_sites` VALUES (1, 'Startseite', 'Thank you for Instaling MatzeCMS. Go in the Administrationzone and edit this page!', '27.05.10, 18:46', 0, 'Allgemein', 5, 0, '', 1, 0, 41, 1, 3, 5, 1);";
$sql[47] = "INSERT INTO `cms_site_comments` VALUES (52, 41, 'Beispielkommentar', 'Dörflinger', 1, '17.01.09, 12:38', 'Das hier ist ein Beispielkommentar, den du löschen und natürlich auch ändern kannst. In MatzeCMS gibt es BBCodes welche Text formatieren. \r\n\r\nDas hier ist z.B. klein geschrieben, unterstrichener und dunkelblauer Code.\r\n\r\n', 1, 0);";
$sql[48] = "INSERT INTO `cms_news` VALUES (1, 2, 'Beispielnews', 'Das hier ist eine Beispielnews. Um einen Newsflash, also einen Auszug der neuesten News auf einer Textseite anzeigen zu lassen, musst du im Editor an einer beliebigen Stelle [_NEWSFLASH_] einfügen. Diese Variable zeigt dann die ersten 170 Zeichen der News.\r\n\r\nVon welcher Newsseite der Newsflash kommt, kannst du auf jeder Textseite einstellen.', '17.01.09, 12:36', 1);";
$sql[49] = "INSERT INTO `cms_user` VALUES (1, 'admin', '23a0fdf9f361600aa64ce58fdd082331', 'matthiasdoerflinger@googlemail.com', 1, 0, 0, '', '', '1', '-1', 1232190385, 1, '');";
$sql[50] = "INSERT INTO `cms_user` VALUES (2, '$site_username', '$site_password' , '$site_email', 1, 0, 0, '', '', '1', '-1', 1232190385, 1, '');";

for ($i=1; $i<=50; $i++)
{
	$q = mysql_query($sql[$i]);
	if (!$q)
 	{
		$m_error = mysql_error();
  		$error .= "<div class='warning'>Error in mysql query $i.<br>$m_error</div>";
  	}
}

if (empty($error))
{ ?>

<div class="success">Success! - MatzeCMS has been successfully installed - visit the admin  <a href="../admin/">Here</a>.</div>
    
<?php } else
{ 
?>

<div class="warning"> Error has occured - Please check settings</div>
<?=$error?>
<?php }


} else
{
?>
<form id="form1" name="form1" method="post" action="">
  <table width="953" border="0">
    <tr>
      <td width="240"><h3><strong>Welcome to MatzeCMS</strong></h3></td>
      <td width="673">&nbsp;</td>
    </tr>  
	<tr>
	  <td>Informations</td>
      <td>Welcome to the automatically installationsscript of MatzeCMS. Please check before you install MatzeCMS that no other Version of MatzeCMS is installed. Have Fun wih my content management system. <br> Matthias Doerflinger</td>
    </tr>
    <tr>
      <td width="240"><h3><strong>Mysql Database Settings</strong></h3></td>
      <td width="673">&nbsp;</td>
    </tr>
    <tr>
      <td>Host</td>
      <td><input name="host" type="text" value="localhost" /></td>
    </tr>
    <tr>
      <td>Username</td>
      <td><input type="text" name="username" id="username" /></td>
    </tr>
    <tr>
      <td>Password</td>
      <td><input name="password" type="text" /></td>
    </tr>
    <tr>
      <td>Database Name</td>
      <td><input name="db" type="text" id="db" /> </td>
    </tr>
        <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td><h3><strong>Website Settings</strong></h3></td>
      <td>&nbsp;</td>
    </tr>
        <tr>
      <td>Website URL</td><?php $full_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
	  $full_url = str_replace("install/","", $full_url);
	  $path = $full_url - 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];?>
	  
      <td><input name="site_url" type="text" id="site_url" value="<?=$full_url?>" size="50" /></td>
    </tr>
    <tr>
      <td>Admin Username</td>
      <td><input name="site_username" type="text" size="50" id="site_username" /></td>
    </tr>
    <tr>
      <td>Admin Password</td>
      <td><input name="site_password" type="text" size="50" id="site_password" /></td>
    </tr>
        <tr>
      <td>Admin Email</td>
      <td><input name="site_email" type="text" size="50" id="site_email" /></td>
    </tr>
    <tr>
      <td>Website Name</td>
      <td><input name="name" type="text" size="50" /></td>
    </tr>
	<tr>
      <td width="240"><h3><strong>License</strong></h3></td>
      <td width="673">&nbsp;</td>
    </tr>  
	<tr>
      <td><input onclick="document.getElementById('submit').removeAttribute('disabled', 0);" type="checkbox" align="right" name="license" value="1"/><br><br></td>
      <td>I have read the <a href='docs/license.htm' onclick='FensterOeffnen(this.href); return false'>License</a> and agree with it.<br><br></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><label>
        <input type="submit" disabled="disabled" name="submit" id="submit" value="Install" onclick="confirm('Are you sure everything is right?')" />
      </label></td>
    </tr>
  </table>
</form>
<?php } ?>
</div>
</body>
</html>
Dies ist meine install/index.php!
In meiner index.php habe ich eine Abfrage gemacht, dass wenn die Tabellen nicht angelegt sind, er zur install/index.php wechselt. Wenn die Tabellen angelegt und wenn der ordner install/ existiert soll er anzeigen, dass man den Ordner install löschen muss, ansonsten leitet er zur sites.php weiter. Die sites.php regelt so ziemlich alles bei meiner CMS.

Nochmals danke!
Matze
 
Zurück