Brauch bitte Hilfe da ich mich nicht mit PHP auskenne,
in Install.php ist ein Fehler drin und finde keine lösung,
Meldung über Localhost:
Parse error: syntax error, unexpected T_CASE in C:\xampp\htdocs\test\cant\cant\install.php on line 541
Die betreffende zeile sieht so aus:
und hier der ganze code:
Danke im Voraus.
in Install.php ist ein Fehler drin und finde keine lösung,

Meldung über Localhost:
Parse error: syntax error, unexpected T_CASE in C:\xampp\htdocs\test\cant\cant\install.php on line 541
Die betreffende zeile sieht so aus:
PHP-Code:
<?php
break;
case ("end"):
PHP-Code:
<?php
if (@file_exists("./config.inc.php") && @filesize("./config.inc.php") > 10) {
header("Location: index.php");
die();
}
function varfix($data){
if(is_array($data)) {
return array_map("varfix", $data);
} else {
return rawurldecode(htmlspecialchars(stripslashes(strip_tags("$data"))));
}}
function save_to_file($file, $text, $mode){
if(($handle = @fopen($file, $mode)) == false) return 0;
flock($handle, 2);
fputs($handle, $text);
flock($handle, 3);
fclose($handle);
return 1;
}
function get_lang() {
GLOBAL $cur_lang, $lang;
$files = array();
if($handle = @opendir("./lang")){
while (false !== ($file = readdir($handle))) {
if ($file{0} != "." && preg_match("/inc\.php$/", $file) && is_readable("./lang/".$file)) {
if(!preg_match("/^(?:[lang]{4})-([a-z]{2,20})/", $file, $langid)) continue;
if(isset($_POST['newlang']) && $_POST['newlang'] == trim($langid[1])) {
@setcookie("chant_local", $_POST['newlang'], time() + 259200);
$cur_lang = $langid[1];
} elseif(isset($_COOKIE['chant_local']) && $_COOKIE['chant_local'] == trim($langid[1])) $cur_lang = $langid[1];
$files[] = $langid[1];
}
}
closedir($handle);
} else {
$files[] = "Can't open ".$dir;
}
if(empty($cur_lang)) $cur_lang = $lang;
return $files;
}
function read_dir($dir){
if($handle = @opendir($dir)){
while (false !== ($file = readdir($handle))) {
if ($file{0} != ".") {
$files[] = "$file";
}
}
closedir($handle);
} else {
$files[] = "Can't open $dir";
}
return $files;
}
$_GLOBAL = array();
if(!empty($_POST)){
$_GLOBAL = array_map("varfix", $_POST);
} elseif(!empty($_GET)){
$_GLOBAL = array_map("varfix", $_GET);
}
$protocol = ($_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
$chaturl = $protocol.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']);
$chaturl = str_replace("\\", "/", $chaturl);
if (substr($chaturl, -1, 1) != "/") {
$chaturl = $chaturl."/";
}
$chatdir = str_replace("\\", "/", dirname(__FILE__));
if (substr($chatdir, -1, 1) != "/") {
$chatdir = $chatdir."/";
}
$def_mail = isset($_SERVER["SERVER_ADMIN"])?$_SERVER["SERVER_ADMIN"]:'admin@localhost';
$dir_array = array("cache", "database", "logs", "skins", "widgets");
function error($str){
?>
<div class="navbar">
<div id="topic">ERROR</div>
<div class="bar-up"></div><div class="bar-down"></div>
</div>
<div id="content" align="center">
<p>
<div style="padding:20px; width: 300px; border-right: #000 1px dotted; border-top: #000 1px dotted; border-left: #000 1px dotted; border-bottom: #000 1px dotted; color: #000000; background-color: #fefefe; text-align: center"><? echo $str; ?></div><br>
</div>
<div class="navbar">
<div id="footer">
<input class="buttons" type="button" onClick="history.back()" value="<< Back">
</div>
<div class="bar-up"></div>
<div class="bar-down"></div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
<?
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Chant - Installation</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="author" content="Alex Frost" />
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<style type="text/css">
<!--
body {
margin: 0;
padding: 0;
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, Sans-serif;
font-size: 12px;
line-height: 1.3em;
color: #525050;
background-color: #3a3a3a;
}
a:link {
color: #000;
text-decoration: none;
}
a:visited {
color: #000;
text-decoration: none;
}
a:hover {
color: #fff;
text-decoration: none;
}
input {
border-color: #f0f0f0;
text-indent: 2px;
}
input.button {
background-color: #EFEFEF;
color: #4171A2;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 8px;
}
input.buttons {
width: 200px;
border: #909090 1px solid;
background: transparent;
color: #ffffff;
font-size: 11px;
}
input.post, textarea.post, select {
background-color: #F6F6F6;
border-color: #f0f0f0;
border-style: solid;
border-width: 1px;
scrollbar-3dlight-color: #EEF4FA;
scrollbar-arrow-color: #4074A5;
scrollbar-darkshadow-color: #EDF3F9;
scrollbar-face-color: #E8F0F9;
scrollbar-highlight-color: #CCDFEC;
scrollbar-shadow-color: #8CA9CD;
scrollbar-track-color: #F0F5FB;
}
.inputbox {
width: 70%;
}
table.grid {
font-size: 100%;
direction: ltr;
margin: auto;
empty-cells: hide;
cellspacing: 0;
border:0;
font-family: Trebuchet MS;
}
table.grid td {
border: 1px solid black;
padding: 5px;
background: #FDFDFD;
text-align: center;
}
hr {
height: 3px;
border: 1px #000 solid;
width: 85%;
}
h1 {
font-size: 230%;
font-weight: normal;
margin: 0 0 15px 0;
padding: 0;
color: #fff;
}
#header h1 a {
color: #fff;
text-decoration: none;
}
#header h1 a:visited {
color: #fff;
text-decoration: none;
}
#header h1 a:hover {
color: #fff;
text-decoration: underline;
}
#header {
color: #9c9d9f;
padding: 50px 25px 20px 0;
background-color: #000;
text-align: right;
border-top: 2px solid #363636;
border-left: 2px solid #363636;
border-right: 2px solid #363636;
}
#footer {
float: left;
position: absolute;
padding: 4px 0 0 15px;
font-size: 11px;
color: #9c9d9f;
}
#topic {
float: left;
position: absolute;
padding: 4px 0 0 15px;
font-size: 12px;
color: #9c9d9f;
}
#content {
padding: 15px 30px 5px 30px;
margin: 0;
background-color: #F6F6F6;
}
.navbar {
border: 2px solid #000;
clear: both;
margin: 0;
padding: 0;
}
.bar-up {
border-top: 1px solid #464646;
border-left: 1px solid #464646;
border-right: 1px solid #464646;
height: 13px;
background-color: #303030;
font-size: 0;
}
.bar-down {
border-left: 1px solid #363636;
border-right: 1px solid #363636;
border-bottom: 1px solid #363636;
height: 12px;
background-color: #000;
font-size: 0;
}
#border1 {
padding: 0;
margin: 0 auto;
width: 610px;
border-left: 2px solid #353535;
border-right: 2px solid #353535;
border-bottom: 2px solid #353535;
}
#border2 {
padding: 0;
margin: 0 auto;
width: 606px;
border-left: 2px solid #2b2b2b;
border-right: 2px solid #2b2b2b;
border-bottom: 2px solid #2b2b2b;
}
#border3 {
padding: 0;
margin: 0 auto;
width: 602px;
border-left: 2px solid #232323;
border-right: 2px solid #232323;
border-bottom: 2px solid #232323;
}
-->
</style>
</head>
<body>
<br />
<div id="border1">
<div id="border2">
<div id="border3">
<div style="padding: 2px; border: 1px solid #fff;">
<div id="header">
</div>
<?
switch ("$_GLOBAL[level]") {
default:
?>
<div class="navbar">
<div id="topic">Welcome</div>
<div class="bar-up"></div><div class="bar-down"></div>
</div>
<div id="content">
<table class="grid">
<tr>
<td width="100%" style="text-align: left;padding-left: 10px">PHP version > 4.1</td>
<td><?php echo phpversion() > "4.1" ? "<img border=\"0\" src=\"http://www.php.de/images/ok.gif\" width=\"22\" height=\"22\">" : "<img border=\"0\" src=\"http://www.php.de/images/no.gif\" width=\"22\" height=\"22\">"; ?></td>
</tr>
<tr>
<td style="text-align: left;padding-left: 10px">ZLIB compression</td>
<td><?php echo extension_loaded("zlib") ? "<img border=\"0\" src=\"http://www.php.de/images/ok.gif\" width=\"22\" height=\"22\">" : "<img border=\"0\" src=\"http://www.php.de/images/no.gif\" width=\"22\" height=\"22\">"; ?></td>
</tr>
<tr>
<td style="text-align: left;padding-left: 10px">MCRYPT extension</td>
<td><?php echo extension_loaded("mcrypt") ? "<img border=\"0\" src=\"http://www.php.de/images/ok.gif\" width=\"22\" height=\"22\">" : "<img border=\"0\" src=\"http://www.php.de/images/no.gif\" width=\"22\" height=\"22\">"; ?></td>
</tr>
<tr>
<td style="text-align: left;padding-left: 10px">GD 2 extension</td>
<td><?php echo extension_loaded("gd") ? "<img border=\"0\" src=\"http://www.php.de/images/ok.gif\" width=\"22\" height=\"22\">" : "<img border=\"0\" src=\"http://www.php.de/images/no.gif\" width=\"22\" height=\"22\">"; ?></td>
</tr>
<tr>
<td style="text-align: left;padding-left: 10px">mail()</td>
<td><?php echo function_exists('mail') ? "<img border=\"0\" src=\"http://www.php.de/images/ok.gif\" width=\"22\" height=\"22\">" : "<img border=\"0\" src=\"http://www.php.de/images/no.gif\" width=\"22\" height=\"22\">"; ?></td>
</tr>
</table>
<hr>
<table class="grid">
<tr>
<td width="100%" style="text-align: left;padding-left: 10px">Writable directories</td>
<td><?php echo "<img border=\"0\" src=\"http://www.php.de/images/ok.gif\" width=\"22\" height=\"22\">"; ?></td>
</tr>
<?
foreach ($dir_array as $val) {
?>
<tr>
<td width="100%" style="text-align: left;padding-left: 150px"><?=$val?>/</td>
<td><?php echo is_writable($val) ? "<img border=\"0\" src=\"http://www.php.de/images/ok.gif\" width=\"22\" height=\"22\">" : "<img border=\"0\" src=\"http://www.php.de/images/no.gif\" width=\"22\" height=\"22\">"; ?></td>
</tr>
<?
}
?>
</table>
<p>
</div>
<div class="navbar">
<div id="footer">
<form action='<? echo $_SERVER['PHP_SELF']; ?>' method="post">
<input type="hidden" name="level" value="perm">
<input class="buttons" type="submit" value="Continue >>">
</form>
</div>
<div class="bar-up"></div>
<div class="bar-down"></div>
</div>
<?
break;
case("perm"):
?>
<div class="navbar">
<div id="topic">GNU/GPL License</div>
<div class="bar-up"></div><div class="bar-down"></div>
</div>
<div id="content">
<div align="center"><textarea rows="20" style="width: 80%; font: 11px verdana, arial, helvetica, sans-serif;"><? if(@readfile("./docs/LICENSE") == false) echo "Can't find license.txt"; ?></textarea><p></div>
</div>
<div class="navbar">
<div id="footer">
<form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="hidden" name="level" value="setup">
<input class="buttons" type="submit" value="I agree >>">
</form>
</div>
<div class="bar-up"></div>
<div class="bar-down"></div>
</div>
<?
break;
case("setup"):
$tzones = array("-12"=>"GMT - 12 Hours", "-11"=>"GMT - 11 Hours", "-10"=>"GMT - 10 Hours", "-09"=>"GMT - 9 Hours", "-08"=>"GMT - 8 Hours", "-07"=>"GMT - 7 Hours", "-06"=>"GMT - 6 Hours", "-05"=>"GMT - 5 Hours", "-04"=>"GMT - 4 Hours", "-03"=>"GMT - 3 Hours", "-02"=>"GMT - 2 Hours", "-01"=>"GMT - 1 Hours", "0"=>"GMT", "+01"=>"GMT + 1 Hours", "+02"=>"GMT + 2 Hours", "+03"=>"GMT + 3 Hours", "+04"=>"GMT + 4 Hours", "+05"=>"GMT + 5 Hours", "+06"=>"GMT + 6 Hours", "+07"=>"GMT + 7 Hours", "+08"=>"GMT + 8 Hours", "+09"=>"GMT + 9 Hours", "+10"=>"GMT + 10 Hours", "+11"=>"GMT + 11 Hours", "+12"=>"GMT + 12 Hours", "+13"=>"GMT + 13 Hours");
?>
<div class="navbar">
<div id="topic">General configuration</div>
<div class="bar-up"></div><div class="bar-down"></div>
</div>
<div id="content">
<form action='<? echo $_SERVER['PHP_SELF']; ?>' method="post">
<table class="grid" width="80%">
<tr>
<td width="40%" style="text-align: left;padding-left: 10px">Your Real Name</td>
<td width="60%"><input name="name" type="text" class="inputbox" size="15" maxlength="25" /></td>
</tr>
<tr>
<td style="text-align: left;padding-left: 10px">Your e-mail</td>
<td><input name="email" type="text" class="inputbox" size="15" maxlength="25" value="<? echo $def_mail; ?>" /></td>
</tr>
<tr>
<td style="text-align: left;padding-left: 10px">Chat Virtual Path</td>
<td><input name="chaturl" type="text" class="inputbox" size="15" value="<? echo $chaturl; ?>" /></td>
</tr>
<tr>
<td style="text-align: left;padding-left: 10px">Chat Physical Path</td>
<td><input name="chatdir" type="text" class="inputbox" size="15" value="<? echo $chatdir; ?>" /></td>
</tr>
<tr>
<td></td><td></td>
</tr>
<tr>
<td style="text-align: left;padding-left: 10px">Chat Name</td>
<td><input type="text" class="inputbox" size="15" name="chatname" value="<? echo $chatname; ?>" /></td>
</tr>
<tr>
<td style="text-align: left;padding-left: 10px">Default Style</td>
<td><select name="skin" class="inputbox">
<?
$array = read_dir("./skins");
foreach($array as $val){
$selected = ("BlueSteel" == trim($val))?" selected":"";
echo "<option value=\"$val\"$selected>$val</option>";
}
?>
</select>
</td>
</tr>
<tr>
<td style="text-align: left;padding-left: 10px">Default Language</td>
<td><select name="lang" class="inputbox">
<?
$array = get_lang();
foreach($array as $val){
$selected = (strstr($val, "english"))?" selected":"";
echo "<option value=\"".$val."\"$selected>".ucfirst($val)."</option>";
}
?>
</select>
</td>
</tr>
<tr>
<td style="text-align: left;padding-left: 10px">TimeZone</td>
<td><select name="timezone" class="inputbox">
<?
foreach($tzones as $key=>$val) {
$selected = (substr(@date('O'), 0, 3) == $key)?" selected":"";
echo "<option value=\"".$key."\"$selected>".$val."</option>";
}
?>
</select>
</td>
</tr>
<tr>
<td style="text-align: left;padding-left: 10px">Compress Output</td>
<td>Enable <input type="radio" name="gzip" value="enable" checked /> Disable <input type="radio" name="gzip" value="disable" /></td>
</tr>
<tr>
<td style="text-align: left;padding-left: 10px">DES Encryption</td>
<td>Enable <input type="radio" name="des" value="enable" checked /> Disable <input type="radio" name="des" value="disable" /></td>
</tr>
<tr>
<td style="text-align: left;padding-left: 10px">Security Code</td>
<td>Enable <input type="radio" name="captcha" value="enable" /> Disable <input type="radio" name="captcha" value="disable" checked /></td>
</tr>
<tr>
<td style="text-align: left;padding-left: 10px">RSS Feed</td>
<td>Enable <input type="radio" name="rss" value="enable" checked /> Disable <input type="radio" name="rss" value="disable" /></td>
</tr>
<tr>
<td></td><td></td>
</tr>
<tr>
<td style="text-align: left;padding-left: 10px">Admin Username</td>
<td><input name="uname" type="text" class="inputbox" size="15" maxlength="25" /></td>
</tr>
<tr>
<td style="text-align: left;padding-left: 10px">Password</td>
<td><input name="pass" type="password" class="inputbox" value="" maxlength="25" /></td>
</tr>
<tr>
<td style="text-align: left;padding-left: 10px">Re-type</td>
<td><input name="pass2" type="password" class="inputbox" value="" maxlength="25" /></td>
</tr>
</table>
<p>
</div>
<div class="navbar">
<div id="footer">
<input type="hidden" name="level" value="end">
<input class="buttons" type="submit" value="Continue >>">
</form>
</div>
<div class="bar-up"></div>
<div class="bar-down"></div>
</div>
<?php
break;
case ("end"):
// Verify variables
if(preg_match("/^[\w\s\.\-]{1,25}$/", $_GLOBAL["name"]) == false) die(error("Please enter correct name"));
elseif(preg_match("/^[\w\.\-\_]+@+[\w\.\-\_]/", $_GLOBAL["email"]) == false) die(error("Please enter correct e-mail"));
elseif(preg_match("/^[\w\.\-]{1,25}$/", $_GLOBAL["uname"]) == false) die(error("Please enter correct username"));
elseif(preg_match("/^[\w\.\-]{4,25}$/", $_GLOBAL["pass"]) == false || preg_match("/^[\w\.\-]{4,25}$/", $_GLOBAL["pass2"]) == false || $_GLOBAL["pass"] != $_GLOBAL["pass2"]) die(error("Please enter correct password (min. 4 char)"));
elseif(preg_match("/^[\w\.\-\s]{1,25}$/", $_GLOBAL["chatname"]) == false) die(error("Please enter correct chat name"));
elseif(preg_match("/^[0-9\+\-]{1,5}$/", $_GLOBAL["timezone"]) == false) die(error("Please enter correct TimeZone"));
$supass_hash = md5($_GLOBAL['pass']);
$text = "<? //Auto generated configuration file. To change anything use admin cp\n\$chaturl = \"$_GLOBAL[chaturl]\";\n\$chatdir = \"$_GLOBAL[chatdir]\";\n\$suser = \"$_GLOBAL[uname]\";\n\$supass = \"$supass_hash\";\n\$realname = \"$_GLOBAL[name]\";\n\$email = \"$_GLOBAL[email]\";\n\$chatname = \"$_GLOBAL[chatname]\";\n\$skin = \"$_GLOBAL[skin]\";\n\$lang = \"$_GLOBAL[lang]\";\n\$restore = \"enable\";\n\$select_lang = \"enable\";\n\$archive = \"enable\";\n\$error_log = \"enable\";\n\$des = \"$_GLOBAL[des]\";\n\$gzip = \"$_GLOBAL[gzip]\";\n\$captcha = \"$_GLOBAL[captcha]\";\n\$cache = \"disable\";\n\$irc = \"enable\";\n\$rss = \"$_GLOBAL[rss]\";\n\$rss_format = \"RSS2.0\";\n\$disclaimer = \"disable\";\n\$timezone = \"$_GLOBAL[timezone]\";\n\$datadelay = \"5\";\n\$userdelay = \"30\";\n?>";
if(save_to_file("config.inc.php", $text, "w+") == false) die(error("Can't create config.ini.php, check permissions..."));
?>
<div class="navbar">
<div id="topic">Installation complete !!!</div>
<div class="bar-up"></div><div class="bar-down"></div>
</div>
<div id="content">
Congratulations! Your Chant installation is complete.<br />
Do not forget your informations to access to the administration panel:
<p><b>Administrator Login Details</b></p>
<p>Username : <? echo $_GLOBAL["uname"]; ?></p>
<p>Password : <? echo $_GLOBAL["pass"]; ?></p>
<p>
</div>
<div class="navbar">
<div id="footer">
<input class="buttons" type="button" onClick="window.location.href='index.php'" value="Finish" />
</div>
<div class="bar-up"></div>
<div class="bar-down"></div>
</div>
<?
break;
}
?>
</div>
</div>
</div>
</div>
</body>
</html>
Kommentar