Hi Leute,
bin ein echter Anfänger in PHP hab vorher HTML gemacht.
Bei mir ist immer ein Fehler:Parse error: syntax error, unexpected ')', expecting T_STRING or T_VARIABLE or '$' in E:\XAMMP\xampp\htdocs\Mitglieder.php on line 38
Mein Script sieht so aus:
<html>
<head>
<title>Hallo</title>
</head>
<body>
<?php
if($set=="writedata"){
$username = strip_tags($_POST["username"]);
$password1 = strip_tags($_POST["password1"]);
$password2 = strip_tags($_POST["password2"]);
if (!isset($secure_dir)) {
$securedir = strip_tags($_POST["securedir"]);
$choose_dir = "yes";
} else {
$securedir = $secure_dir;
}
if (!isset($auth_name)) {
$authname = strip_tags($_POST["authname"]);
} else {
$authname = $auth_name;
}
if (!empty($securedir)) {
@$htpw = join('', file("$DOCUMENT_ROOT"."$securedir/.htpasswd"));
if (preg_match("=$username\:.*=siU", $htpw)) {
$userhtpw = "set";
}
}
$mts = join('', file("./files/tmpl/new_user_form.htm"));
if (isset()) {
$mts = preg_replace("=\<\!\-\-.CHOOSE_DIR_START.\-\-\>.*\<\!\-\-.CHOOSE_DIR_STOP.\-\-\>=siU", "", $mts);
}
if (isset()) {
$mts = preg_replace("=\<\!\-\-.CHOOSE_TITLE_START.\-\-\>.*\<\!\-\-.CHOOSE_TITLE_STOP.\-\-\>=siU", "", $mts);
}
if ($choose_dir=="yes") {
$mts = preg_replace("=\<\!\-\-.DEL_USER_START.\-\-\>.*\<\!\-\-.DEL_USER_STOP.\-\-\>=siU", "", $mts);
}
preg_match_all("=\<\!\-\-.(.*):.*\-\-\>=",$mts,$validates);
$valcount = count($validates[1]);
for ($i=0;$i<=$valcount;$i++) {
$check_type = explode("&",$validates[1][$i]);
// Namen überprüfen
if ($check_type[0]=="name") {
if (empty($$check_type[1])) {
$mts = preg_replace("=\<\!\-\-.name&$check_type[1]:.(.*)\|\|.*\|\|.*\-\-\>=","\\1",$mts);
$valform = "error";
}
elseif(strlen($$check_type[1]) < $min_user) {
$mts = preg_replace("=\<\!\-\-.name&$check_type[1]:.*\|\|(.*)\|\|.*\-\-\>=","\\1",$mts);
$mts = preg_replace("=\[min_user\]=","$min_user",$mts);
$valform = "error";
}
elseif($userhtpw=="set") {
$mts = preg_replace("=\<\!\-\-.name&$check_type[1]:.*\|\|.*\|\|(.*)\-\-\>=","\\1",$mts);
$valform = "error";
}
}
if ($check_type[0]=="pw1") {
if (empty($$check_type[1])) {
$mts = preg_replace("=\<\!\-\-.pw1&$check_type[1]:.(.*)\|\|.*\-\-\>=","\\1",$mts);
$valform = "error";
}
elseif(strlen($$check_type[1]) < $min_pw) {
$mts = preg_replace("=\<\!\-\-.pw1&$check_type[1]:.*\|\|(.*)\-\-\>=","\\1",$mts);
$mts = preg_replace("=\[min_pw\]=","$min_pw",$mts);
$valform = "error";
}
}
if ($check_type[0]=="pw2") {
if (empty($$check_type[1])) {
$mts = preg_replace("=\<\!\-\-.pw2&$check_type[1]:.(.*)\|\|.*\-\-\>=","\\1",$mts);
$valform = "error";
$thiserror = "yes";
}
elseif($$check_type[1] !== $password1) {
$mts = preg_replace("=\<\!\-\-.pw2&$check_type[1]:.*\|\|(.*)\-\-\>=","\\1",$mts);
$valform = "error";
$thiserror = "yes";
}
}
if ($check_type[0]=="dir") {
if (empty($$check_type[1])) {
$mts = preg_replace("=\<\!\-\-.dir&$check_type[1]:.(.*)\|\|.*\|\|.*\-\-\>=","\\1",$mts);
$valform = "error";
}
elseif(!preg_match("=^\/.*=", $$check_type[1])) {
$mts = preg_replace("=\<\!\-\-.dir&$check_type[1]:.*\|\|(.*)\|\|.*\-\-\>=","\\1",$mts);
$valform = "error";
}
elseif(!is_dir("$DOCUMENT_ROOT"."$securedir")) {
$mts = preg_replace("=\<\!\-\-.dir&$check_type[1]:.*\|\|.*\|\|(.*)\-\-\>=","\\1",$mts);
$valform = "error";
}
}
}
?>
</body>
</html>
Kann mir jemand helfen
Tommy
Danke jetzt schon für eure Antworten
bin ein echter Anfänger in PHP hab vorher HTML gemacht.
Bei mir ist immer ein Fehler:Parse error: syntax error, unexpected ')', expecting T_STRING or T_VARIABLE or '$' in E:\XAMMP\xampp\htdocs\Mitglieder.php on line 38
Mein Script sieht so aus:
<html>
<head>
<title>Hallo</title>
</head>
<body>
<?php
if($set=="writedata"){
$username = strip_tags($_POST["username"]);
$password1 = strip_tags($_POST["password1"]);
$password2 = strip_tags($_POST["password2"]);
if (!isset($secure_dir)) {
$securedir = strip_tags($_POST["securedir"]);
$choose_dir = "yes";
} else {
$securedir = $secure_dir;
}
if (!isset($auth_name)) {
$authname = strip_tags($_POST["authname"]);
} else {
$authname = $auth_name;
}
if (!empty($securedir)) {
@$htpw = join('', file("$DOCUMENT_ROOT"."$securedir/.htpasswd"));
if (preg_match("=$username\:.*=siU", $htpw)) {
$userhtpw = "set";
}
}
$mts = join('', file("./files/tmpl/new_user_form.htm"));
if (isset()) {
$mts = preg_replace("=\<\!\-\-.CHOOSE_DIR_START.\-\-\>.*\<\!\-\-.CHOOSE_DIR_STOP.\-\-\>=siU", "", $mts);
}
if (isset()) {
$mts = preg_replace("=\<\!\-\-.CHOOSE_TITLE_START.\-\-\>.*\<\!\-\-.CHOOSE_TITLE_STOP.\-\-\>=siU", "", $mts);
}
if ($choose_dir=="yes") {
$mts = preg_replace("=\<\!\-\-.DEL_USER_START.\-\-\>.*\<\!\-\-.DEL_USER_STOP.\-\-\>=siU", "", $mts);
}
preg_match_all("=\<\!\-\-.(.*):.*\-\-\>=",$mts,$validates);
$valcount = count($validates[1]);
for ($i=0;$i<=$valcount;$i++) {
$check_type = explode("&",$validates[1][$i]);
// Namen überprüfen
if ($check_type[0]=="name") {
if (empty($$check_type[1])) {
$mts = preg_replace("=\<\!\-\-.name&$check_type[1]:.(.*)\|\|.*\|\|.*\-\-\>=","\\1",$mts);
$valform = "error";
}
elseif(strlen($$check_type[1]) < $min_user) {
$mts = preg_replace("=\<\!\-\-.name&$check_type[1]:.*\|\|(.*)\|\|.*\-\-\>=","\\1",$mts);
$mts = preg_replace("=\[min_user\]=","$min_user",$mts);
$valform = "error";
}
elseif($userhtpw=="set") {
$mts = preg_replace("=\<\!\-\-.name&$check_type[1]:.*\|\|.*\|\|(.*)\-\-\>=","\\1",$mts);
$valform = "error";
}
}
if ($check_type[0]=="pw1") {
if (empty($$check_type[1])) {
$mts = preg_replace("=\<\!\-\-.pw1&$check_type[1]:.(.*)\|\|.*\-\-\>=","\\1",$mts);
$valform = "error";
}
elseif(strlen($$check_type[1]) < $min_pw) {
$mts = preg_replace("=\<\!\-\-.pw1&$check_type[1]:.*\|\|(.*)\-\-\>=","\\1",$mts);
$mts = preg_replace("=\[min_pw\]=","$min_pw",$mts);
$valform = "error";
}
}
if ($check_type[0]=="pw2") {
if (empty($$check_type[1])) {
$mts = preg_replace("=\<\!\-\-.pw2&$check_type[1]:.(.*)\|\|.*\-\-\>=","\\1",$mts);
$valform = "error";
$thiserror = "yes";
}
elseif($$check_type[1] !== $password1) {
$mts = preg_replace("=\<\!\-\-.pw2&$check_type[1]:.*\|\|(.*)\-\-\>=","\\1",$mts);
$valform = "error";
$thiserror = "yes";
}
}
if ($check_type[0]=="dir") {
if (empty($$check_type[1])) {
$mts = preg_replace("=\<\!\-\-.dir&$check_type[1]:.(.*)\|\|.*\|\|.*\-\-\>=","\\1",$mts);
$valform = "error";
}
elseif(!preg_match("=^\/.*=", $$check_type[1])) {
$mts = preg_replace("=\<\!\-\-.dir&$check_type[1]:.*\|\|(.*)\|\|.*\-\-\>=","\\1",$mts);
$valform = "error";
}
elseif(!is_dir("$DOCUMENT_ROOT"."$securedir")) {
$mts = preg_replace("=\<\!\-\-.dir&$check_type[1]:.*\|\|.*\|\|(.*)\-\-\>=","\\1",$mts);
$valform = "error";
}
}
}
?>
</body>
</html>
Kann mir jemand helfen
Tommy
Danke jetzt schon für eure Antworten
Kommentar