Parse error: syntax error, unexpected T_CASE in /usr/export/www//_____/admin

wod2008

Erfahrenes Mitglied
Hi
ich habe mir das Tutorial http://tut.php-quake.net/ durchgelesen und kam jetzt zu den Teil
http://tut.php-quake.net/login-admin.html habe dort alles gemacht und bekomme diese fehlermeldung:
Parse error: syntax error, unexpected T_CASE in /usr/export/www/?/?/admin_user.php on line 20

der code von admin_user.php

PHP:
<?php
$rights = getRights();
if(!in_array("Admin", $rights)) {        no_rights();    } //line 3
else {
    switch(@$_GET['action']) {
        case "add":
        break;
        case "edit":
        break;
        case "del":
        break;            default:
         echo "<p>\n";
         echo "    Bitte benutzen sie nur einen Link aus dem Adminmenu.\n";
         echo "    <a href=\"index3.php?section=admin&amp;".SID."\">\n";
         echo "        Zurück zum Adminbereich\n";
         echo "    </a>\n";
         echo "</p>\n";
           break;
            }
          case "add":
          if(isset($_POST['submit'])) {  //line 20
          if(!preg_match('/^\w+$/', trim($_POST['name']))) {
          echo "<p>\n";
          echo "    Bitte geben sie einen Name aus alphanumerischen Zeichen ein.\n";
          echo "</p>\n";
          echo "<p>\n";
          echo "    <a href=\"index3.php?section=admin&amp;site=user&amp;action=add&amp;".SID."\">\n";
          echo "        Zurück zum Formular\n";
          echo "    </a>\n";
          echo "</p>\n";                    }
          elseif(trim($_POST['email']) == "") {
          echo "<p>\n";
          echo "    Bitte geben sie eine Emailadresse an.\n";
          echo "</p>\n";
          echo "<p>\n";
          echo "    <a href=\"index3.php?section=admin&amp;site=user&amp;action=add&amp;".SID."\">\n";
          echo "        Zurück zum Formular\n";
          echo "    </a>\n";
          echo "</p>\n";                    }
          else {
          $password = substr(md5(microtime()),0,8); // zufallspassword erstellen
          $sql = "INSERT INTO
          users(Name, Email, Password)
          VALUES
          ('".trim($_POST['name'])."',
          '".addslashes(trim($_POST['email']))."',
          MD5('".$password."'));";
          $result = mysql_query($sql) OR die(mysql_error());
          if(isset($_POST['send'])) {// Login-Daten per Email schicken
          $mailbody  = "Zugangsdaten zur Homepage:\n";
          $mailbody .= "Name: ".trim($_POST['name'])."\n";
          $mailbody .= "Password: ".$password."\n";
          $mailbody .= "Bitte loggen sie sich ein und ändern sie das Password.\n";
          if(mail(trim($_POST['email']), "Zugangsdaten", $mailbody)) {
          echo "<p>\n";
          echo "    Account wurde hinzugefügt und die Zugangsdaten wurden zum\n";
          echo "    Benutzer geschickt.\n";
          echo "</p>\n";
          echo "<p>\n";
          echo "    <a href=\"index.ph3p?section=admin&amp;".SID."\">\n";
          echo "        Zurück zum Adminbereich\n";
          echo "    </a>\n";
          echo "</p>\n";                            }
          else {
          echo "<p>\n";
          echo "    Account wurde hinzugefügt, doch es konnte keine Email\n";
          echo "    verschickt werden.\n";
          echo "</p>\n";
          echo "<p>\n";
          echo "    Logindaten <br />\n";
          echo "    Name: ".trim($_POST['name'])."<br />\n";
          echo "    Password: ".$password."<br />\n";
          echo "</p>\n";
          echo "<p>\n";
          echo "    <a href=\"index3.php?section=admin&amp;".SID."\">\n";
          echo "        Zurück zum Adminbereich\n";
          echo "    </a>\n";
          echo "</p>\n";                            }                        }
          else {
          echo "<p>\n";
          echo "    Account wurde hinzugefügt.\n";
          echo "</p>\n";
          echo "<p>\n";
          echo "    Logindaten <br />\n";
          echo "    Name: ".trim($_POST['name'])."<br />\n";
          echo "    Password: ".$password."<br />\n";
          echo "</p>\n";
          echo "<p>\n";
          echo "    <a href=\"index3.php?section=admin&amp;".SID."\">\n";
          echo "        Zurück zum Adminbereich\n";
          echo "    </a>\n";
          echo "</p>\n";
          }
          }
          }
          else {
          echo "<form ".
          "action=\"index3.php?section=admin&amp;site=user&amp;action=add\" ".
          "method=\"post\" ".                         "class=\"formular\">\n";
          echo "    <p>\n";
          echo "        Neuen Benutzer hinzufügen\n";
          echo "    </p>\n";
          echo "    <ol>\n";
          echo "        <li>\n";
          echo "            <label for=\"name\">Name</label>\n";
          echo "            <input type=\"text\" name=\"name\" id=\"name\" />\n";
          echo "        </li>\n";
          echo "        <li>\n";
          echo "            <label for=\"email\">Emailadresse</label>\n";
          echo "            <input type=\"text\" name=\"email\" id=\"email\" />\n";
          echo "        </li>\n";
          echo "        <li>\n";
          echo "            <label for=\"send\">\n";
          echo "                Zugangsdaten per Email zuschicken lassen\n";
          echo "            </label>\n";
          echo "            <input type=\"checkbox\" name=\"send\" id=\"send\" />\n";
          echo "        </li>\n";
          echo "        <li>\n";
          echo "            <input type=\"submit\" name=\"submit\" value=\"Benutzer hinzufügen\" />\n";
          echo "            <input type=\"reset\" name=\"submit\" value=\"Zurücksetzen\" />\n";
          echo "            <input type=\"hidden\" name=\"".session_name()."\" ".
          "value=\"".session_id()."\" />\n";
          echo "        </li>\n";
          echo "    <ol>\n";
          echo "</form>\n";
          echo "<p>\n";
          echo "    <a href=\"index3.php?section=admin&amp;".SID."\">\n";
          echo "        Zurück zum Adminbereich\n";
          echo "    </a>\n";
          echo "</p>\n";                }
          break;
          case 'del':
          if(isset($_POST['submit'])) {
          if(!$_POST['uid']) { // gucken ob == 0 ist
          echo "<p class=\"error\">\n";
          echo "    Bitte wählen sie einen Benutzer aus<br />\n";
          echo "    <a href=\"index3.php?section=admin&amp;site=user&amp;action=del\">\n";
          echo "        Zurück zum Formular\n";
          echo "    </a>\n";
          echo "</p>\n";            }
          else {
          $sql = "DELETE FROM
          user_rights
          WHERE
          UserID = '".$_POST['uid']."';";
          mysql_query($sql) OR die(mysql_error());
          $sql = "DELETE FROM
          users
          WHERE
          ID = '".$_POST['uid']."';";
          mysql_query($sql) OR die(mysql_error());
          echo "<p>\n";
          echo "    Der User wurde gelöscht.\n";
          echo "</p>\n";
          echo "<p>\n";
          echo "    <a href=\"index3.php?section=admin&amp;".SID."\">\n";
          echo "        Zurück zum Adminbereich\n";
          echo "    </a>\n";
          echo "</p>\n";            }        }
          else {
          echo "<form ".                 "action=\"index3.php?section=admin&amp;site=user&amp;action=del\" ".
          "method=\"post\" ".                 "class=\"formular\">\n";
          echo "    <p>\n";
          echo "        Benutzer löschen\n";
          echo "    </p>\n";
          echo "    <ol>\n";
          echo "        <li>\n";
          echo "            <label for=\"name\">Benutzer</label>\n";
          $sql = "SELECT
          Name, ID
          FROM
          users
          ORDER BY
          Name ASC;";
          $result = mysql_query($sql) OR die(mysql_error());
          echo "                <select id=\"name\" name=\"uid\">\n";
          echo "                    <option value=\"0\" selected=\"selected\">Bitte einen User wählen</option>\n";
          while($row = mysql_fetch_assoc($result)) {
          echo "<option value=\"".$row['ID']."\">".$row['Name']."</option>\n";            }
          echo "                </select>\n";
          echo "        </li>\n";
          echo "        <li>\n";
          echo "            <input type=\"submit\" name=\"submit\" value=\"Benutzer löschen\" />\n";
          echo "            <input type=\"reset\" name=\"submit\" value=\"Zurücksetzen\" />\n";
          echo "            <input type=\"hidden\" name=\"".session_name()."\" ".
          "value=\"".session_id()."\" />\n";
          echo "        </li>\n";
           echo "    <ol>\n";
           echo "</form>\n";
           echo "<p>\n";
           echo "    <a href=\"index3.php?section=admin&amp;".SID."\">\n";
           echo "        Zurück zum Adminbereich\n";
           echo "    </a>\n";
           echo "</p>\n";        }
           break;
           case 'edit':
           if(isset($_POST['submit']) AND "Benutzer auswählen" == $_POST['submit']) {
           if(!$_POST['uid']) {
           echo "<p class=\"error\">\n";
           echo "    Bitte wählen sie einen Benutzer aus<br />\n";
           echo "    <a href=\"index3.php?section=admin&amp;site=user&amp;action=del\">\n";
           echo "        Zurück zum Formular\n";
           echo "    </a>\n";
           echo "</p>\n";            }
           else {                $_SESSION['uid'] = $_POST['uid']; // Die UserID in der Session speichern.
           $rights = getRights($_SESSION['uid']); // Die Rechte vom User holen
           $sql = "SELECT
           Name
           FROM
           users
           WHERE
           ID = '".$_SESSION['uid']."';";
           $result = mysql_query($sql) OR die(mysql_error());
           $Name = mysql_result($result, 0);
           echo "<form ".                     "action=\"index3.php?section=admin&amp;site=user&amp;action=edit\" ".
           "method=\"post\" ".                     "class=\"formular\">\n";
           echo "    <p>\n";
           echo "        Benutzer ".$Name." bearbeiten\n";
           echo "    </p>\n";
           echo "    <ol>\n";
           echo "        <li>\n";
           echo "            Rechte:\n";
           $allRights = array();
           $allRights[] = "Admin";
           $allRights[] = "News";                // .. und weitere
           sort($allRights);                echo "            <ul>\n";
           foreach($allRights as $value) {
           echo "<li>\n";
           echo "    <input id=\"".$value."\" type=\"checkbox\" name=\"rights[]\"";
           if(in_array($value, $rights)) {
           echo " checked=\"checked\"";                    }
           echo " value=\"".$value."\" />\n";
           echo "    <label for=\"".$value."\">".$value."</label><br />\n";                }
           echo "            </ul>\n";
           echo "        </li>\n";
           echo "        <li>\n";
           echo "            <input type=\"submit\" name=\"submit\" value=\"Rechte speichern\" />\n";
           echo "            <input type=\"reset\" name=\"submit\" value=\"Zurücksetzen\" />\n";
           echo "            <input type=\"hidden\" name=\"".session_name()."\" ".
           "value=\"".session_id()."\" />\n";
           echo "    </ol>\n";
           echo "</form>\n";
           echo "<p>\n";
           echo "    <a href=\"index3.php?section=admin&amp;".SID."\">\n";
           echo "        Zurück zum Adminbereich\n";
            echo "    </a>\n";
            echo "</p>\n";            }        }
            elseif(isset($_POST['submit']) AND "Rechte speichern" == $_POST['submit']) {
            if(!isset($_POST['rights'])) {
            echo "<p class=\"error\">\n";
            echo "    Sie müssen mindestens ein Recht angeben.\n";
            echo "</p>\n";            }
            else {
            $sql = "DELETE FROM
            user_rights
            WHERE
            UserID = '".$_SESSION['uid']."';";
            mysql_query($sql) OR die(mysql_error());                // alle Vorhandenen Rechte löschen
            // und nun die angewählten hinzufügen
            foreach($_POST['rights'] as $right) {
            $sql = "INSERT INTO
            user_rights(userID, Recht)
            VALUES
            ('".$_SESSION['uid']."',
            '".$right."');";
            mysql_query($sql) OR die(mysql_error());                }
            echo "<p>\n";
            echo "    Die Rechte wurden gespeichert.\n";
            echo "</p>\n";
            echo "<p>\n";
            echo "    <a href=\"index3.php?section=admin&amp;".SID."\">\n";
            echo "        Zurück zum Adminbereich\n";
            echo "    </a>\n";
            echo "</p>\n";            }        }
            else {
            echo "<form ".
            "action=\"index3.php?section=admin&amp;site=user&amp;action=edit\" ".
            "method=\"post\" ".                 "class=\"formular\">\n";
            echo "    <p>\n";
            echo "        Benutzer bearbeiten\n";
            echo "    </p>\n";
            echo "    <ol>\n";
            echo "        <li>\n";
            echo "            <label for=\"name\">Benutzer</label>\n";
            $sql = "SELECT
            Name, ID
            FROM
            users
            ORDER BY
            Name ASC;";
            $result = mysql_query($sql) OR die(mysql_error());
            echo "                <select id=\"name\" name=\"uid\">\n";
            echo "                    <option value=\"0\" selected=\"selected\">Bitte einen User wählen</option>\n";
            while($row = mysql_fetch_assoc($result)) {
            echo "<option value=\"".$row['ID']."\">".$row['Name']."</option>\n";            }
            echo "                </select>\n";
            echo "        </li>\n";
            echo "        <li>\n";
            echo "            <input type=\"submit\" name=\"submit\" value=\"Benutzer auswählen\" />\n";
            echo "            <input type=\"reset\" name=\"submit\" value=\"Zurücksetzen\" />\n";
            echo "            <input type=\"hidden\" name=\"".session_name()."\" ".
            "value=\"".session_id()."\" />\n";
            echo "        </li>\n";
            echo "    <ol>\n";
            echo "</form>\n";
            echo "<p>\n";
            echo "    <a href=\"index.php3?section=admin&amp;".SID."\">\n";
            echo "        Zurück zum Adminbereich\n";
            echo "    </a>\n";
            echo "</p>\n";        }
            break;
               }
            ?>
weißt jmd wo der fehler liegt?

hier noch die datei function.php und variablen.php
PHP:
<?php
    function login_right($id, $pass)
    {
        $sql = "SELECT
                    COUNT(*) as Anzahl
                FROM
                    users
                WHERE
                    ID = '".$id."' AND
                    Password = MD5('".$pass."');";
        $result = mysql_query($sql) OR die(mysql_error());
        $row = mysql_fetch_assoc($result);
        mysql_free_result($result);
        return $row['Anzahl'];
    }
    function array_stripslashes ($arr)
{
    if (!is_array($arr)) return $arr;

    foreach ($arr AS $k => $v)
    {
        $arr[$k] = stripslashes($v);
    }

}
    function no_rights()    {
        echo "<p class=\"error\">\n";
        echo "    Sie haben keine Berechtigung, diesen Bereich\n";
        echo "    zu betreten. Bitte wählen sie einen anderen\n";
        echo "    Bereich aus\n";
        echo "</p>\n";
        echo "<p>\n";
        echo "    <a href=\"index.php?section=admin&amp;".SID."\">\n";
        echo "        Zurück zum Adminbereich\n";
        echo "    </a>\n";
        echo "</p>\n";    }
        function getRights($UID = null)    {
            if(isset($UID)) {
                $sql = "SELECT
                Recht
                FROM
                user_rights
                WHERE
                UserID = '".$UID."';";        }
                else {
                    $sql = "SELECT
                    Recht
                    FROM
                    user_rights
                    WHERE
                    UserID = '".$_SESSION['ID']."';";        }
                    $result = mysql_query($sql) OR die(mysql_error());
                    $rights = array();
                    while($row = mysql_fetch_assoc($result)) {
                        $rights[] = $row['Recht'];        }
                        return $rights;
                        }



                     ?>

PHP:
<?php
 // variablen.php
 $dateien = array();
 $dateien['news'] = "news.php";
 $admin_site = array();
 $admin_site['self'] = "admin_self.php";
 $admin_site['user'] = "admin_user.php";
 $rights = array();
 $allRights = array();
?>

danke
 
Zuletzt bearbeitet:
in der admin_user.php ist ein Fehler:

PHP:
//ORGINAL
           }
          case "add":
          if(isset($_POST['submit'])) {  //line 20
          if(!preg_match('/^\w+$/', trim($_POST['name']))) {
          echo "<p>\n";
          echo "    Bitte geben sie einen Name ";

//RICHTIG

   }
          if(isset($_POST['submit'])) {  //line 20
          if(!preg_match('/^\w+$/', trim($_POST['name']))) {
          echo "<p>\n";
          echo "    Bitte geben sie einen Name ";

Der case Block ist dort zu viel!!
 
Abgesehn davon dass da einiges doppelt vorkommt, du öffnest einen switch(){...}
und in Zeile 19 ist er dann wieder vorbei "}", danach gehts grade mit case "bla": weiter, kann ja nicht so ganz gehn ;)
Und was macht das @ für einen Sinn? switch(@$_GET['action']) {...
 
Abgesehn davon dass da einiges doppelt vorkommt, du öffnest einen switch(){...}
und in Zeile 19 ist er dann wieder vorbei "}", danach gehts grade mit case "bla": weiter, kann ja nicht so ganz gehn
Und was macht das @ für einen Sinn? switch(@$_GET['action']) {...

geht alles

in den php tut das ich gerade sagte steht über das :

Das @ hab ich da hingeschrieben, damit er nicht meckert, wenn es $_GET['action'] nicht gibt. Dies 'darf' ich machen, weil ich selber diese Situation mit der default-Angabe abfange. Besser ist aber folgender Code.
 
in Zeile 19 hast du ne geschweifte Klammer zu "}"
und für Zeile 20 meckert er
Parse error: syntax error, unexpected T_CASE in /usr/export/www/?/?/admin_user.php on line 20
--> unerwartetes "case", logischerweise weil case zu switch(){} gehört, aber mit der "}"
deine switch-Anweisung beendet wird!
und das @: ob mit oder ohne - kein Unterschied

Klappt jetzt alles oder wo hängts noch ?
 
Parse error: syntax error, unexpected T_CASE in /usr/export/www/vhosts/funnetwork/hos

hallo habe ein fast gleiches problem...kann mir jemand helfen
hier die fehlermeldung.
Parse error: syntax error, unexpected T_CASE in /usr/export/www/vhosts/funnetwork/hosting/notanmann/pkinc/public/userprofile.php on line 611


und hier mal das php
PHP:
<?php


if(!defined('pkFRONTEND') || pkFRONTEND!='public')
die('Direct access to this location is not permitted.');


if(!pkGetUservalue('id'))
{
pkEvent('access_refused');
return;
}


$modehash=array('avatar','delete','edit','friends','options');
$mode=(isset($_REQUEST['mode']) && in_array($_REQUEST['mode'],$modehash)) ? $_REQUEST['mode'] : NULL;


switch($mode)
{
case 'avatar' :
pkLoadFunc('user');
$user_navigation=pkUserNavigation();


$ACTION=(isset($_POST['action'])) ? $_POST['action'] : 'view';

if(($_REQUEST['upload']==1 && $config['avatar_eod']==1) || ($config['avatar_eod']!=1 && $config['avatar_eod']!=2))
{
pkHeaderLocation('','','event=function_disabled');
}


if($ACTION==$_POST['cancel'])
{
pkHeaderLocation('userprofile','avatar');
}

if(isset($_REQUEST['upload']))
{
if($ACTION==$_POST['upload_action'] && is_uploaded_file($_FILES['upload_pic']['tmp_name']))
{
move_uploaded_file($_FILES['upload_pic']['tmp_name'],pkDIRTEMP.strrchr($_FILES['upload_pic']['tmp_name'],'/'));
$_FILES['upload_pic']['tmp_name']=pkDIRTEMP.strrchr($_FILES['upload_pic']['tmp_name'],'/');

if($avatar_size=getimagesize($_FILES['upload_pic']['tmp_name']))
{
if($avatar_size[2]==1)
$ext='.gif';
elseif($avatar_size[2]==2)
$ext='.jpg';
elseif($avatar_size[2]==3)
$ext='.png';
else
unset($ext);
}
else
{
unset($avatar_size);
}

if(isset($ext) && isset($avatar_size))
{
$filesize=$_FILES['upload_pic']['size'];
$filename='avauser_'.pkGetUservalue('id').$ext;

if(($config['avatar_height']<$avatar_size[1]) || ($config['avatar_width']<$avatar_size[0]))
$error=1;
elseif($filesize<($config['avatar_size']*1024) && $filesize!=0)
{
$UPLOAD=new UPLOAD();
$uploadreturned=$UPLOAD->images($_FILES['upload_pic'],$config['avatar_path'],$filename);

if($uploadreturned[0]==TRUE)
{
unlink($_FILES['upload_pic']['tmp_name']);

pkHeaderLocation('userprofile','options','setavatar='.urlencode(basename($filename)));
}
else
{
$error=4;
}
}
else
{
$error=2;
}
}
else
{
$error=3;
}

pkHeaderLocation('userprofile','avatar','upload&error='.$error);
}
else
{
$error=(isset($_REQUEST['error']) && intval($_REQUEST['error'])>0 && intval($_REQUEST['error'])<5) ? intval($_REQUEST['error']) : 0;


if($error==1)
eval("\$avatar_message=\"".pkTpl("getavatar_upload_error1")."\";");
elseif($error==2)
eval("\$avatar_message= \"".pkTpl("getavatar_upload_error2")."\";");
elseif($error==3)
eval("\$avatar_message= \"".pkTpl("getavatar_upload_error3")."\";");
else
eval("\$avatar_message= \"".pkTpl("getavatar_upload_message")."\";");

eval("\$site_body.= \"".pkTpl("getavatar_upload")."\";");
}
}
else
{
$dir=$config['avatar_path'];
$width=1;
$row='odd';

$a=opendir($dir);
while($datei=readdir($a))
{
if(strstr($datei,"avatar") || (pkGetUservalue('status')=='member' && strstr($datei,"avamember")) || (pkGetUservalue('status')=='mod' && (strstr($datei,"avamod") || strstr($datei,"avamember"))) || (pkGetUservalue('status')=='admin' && (strstr($datei,"avaadmin") || strstr($datei,"avamod") || strstr($datei,"avamember"))))
{
if($width==4)
{
eval("\$avatar_list.= \"".pkTpl("getavatar_rowbreak")."\";");
$width=1;
$row=rowcolor($row);
}

if(!$avatar_dimension=@getimagesize($dir."/".$datei))
unset($avatar_dimension);

eval("\$avatar_list.= \"".pkTpl("getavatar_list")."\";");
$width++;
}
}
closedir($a);

$cs=4-$width;
if($cs>0)
eval("\$avatar_list.= \"".pkTpl("getavatar_lastrow")."\";");

if($config['avatar_eod']==2)
eval("\$avatar_uploadlink= \"".pkTpl("getavatar_uploadlink")."\";");

eval("\$site_body.= \"".pkTpl("getavatar")."\";");
}
break;
#END case avatar
case 'delete' :
if(pkGetUservalue('id')==1)
{
pkEvent('mainadmin_account_delete');
return;
}

if(!pkGetUservalue('id')>1)
{
pkEvent('access_refused');
return;
}

if($config['user_delete']!=2 && $config['user_delete']!=1)
{
pkEvent('function_disabled');
}

if(isset($_POST['action']))
{
if($_POST['action']==$_POST['delete'] && $_POST['delete_confirm']=='confirmed')
{
if($config['user_delete']==2)
{
pkLoadFunc('user');
pkUserDelete(intval(pkGetUservalue('id')));
}
elseif($config['user_delete']==1)
{
$DB->query("UPDATE ".$db_tab['user']." SET user_activate='2' WHERE user_id='".$SQL->i(pkGetUservalue('id'))."'");
}

pkHeaderLocation('','','event=account_deleted&logout=1');
}

pkHeaderLocation('userprofile');
}

if($config['user_delete']==1)
eval("\$delete_msg= \"".pkTpl("extdelete_msg1")."\";");
elseif($config['user_delete']==2)
eval("\$delete_msg= \"".pkTpl("extdelete_msg2")."\";");

eval("\$site_body.= \"".pkTpl("extdelete")."\";");
break;
#END case delete
case 'edit' :
$S=&$SQL;

pkLoadFunc('user');

$info=array('user_id'=>0);
$bd_option_year=$uderror=$editprofile_userfield=
$user_email_option_1=$user_email_option_0=$event=
$user_sex_option_1=$user_sex_option_2=$user_sex_option_0=NULL;

if(pkGetUservalue('id'))
{
$info=$S->fetch_assoc($S->query("SELECT
user_id,
user_name,
user_pw,
user_profillock,
user_status,
user_nick,
user_pw,
user_email,
user_sex,
user_hpage,
user_aimid,
user_yim,
user_icqid,
user_emailshow,
user_country,
user_bd_day,
user_bd_month,
user_bd_year,
signin,
user_qou,
user_sig,
user_hobby
FROM ".pkSQLTAB_USER."
WHERE user_name='".$SQL->f(pkGetUservalue('name'))."' AND
user_pw='".$SQL->f(pkGetUservalue('pass'))."' AND
user_id='".$SQL->f(pkGetUservalue('id'))."'
LIMIT 1"));
}

if(!pkGetUservalue('id') || $info['user_id']!=pkGetUservalue('id'))
return pkEvent('access_refused');

if($info['user_profillock']==1)
return pkEvent('eventtitle_profile_update_disabled');


$ACTION=isset($_POST['action']) ? $_POST['action'] : false;

if(isset($_POST['save']) && $ACTION==$_POST['save'])
{
$uderror=NULL;
$_POST['user_bd_month']=trim($_POST['user_bd_month']);
$_POST['user_bd_day']=trim($_POST['user_bd_day']);
$_POST['user_bd_year']=trim($_POST['user_bd_year']);
$_POST['ud_country']=trim($_POST['ud_country']);
$_POST['ud_sex']=trim($_POST['ud_sex']);
if(is_array($_POST['profilefields']))
foreach($_POST['profilefields'] as $id => $value){
$felder=$SQL->fetch_array($SQL->query("SELECT * FROM `".pkSQLTAB_USER_PROFILEFIELDS."` WHERE `profilefields_id`='".intval($id)."' LIMIT 1"));
if($felder['profilefields_pflicht']==1){
if($value=="") $uderror='profilfelder_nicht_ausgefuellt';}
if($felder['profilefields_area']==2){
if(preg_match('/[^-.0-9]/', $value)) $uderror='nummerisch';}}
if($_POST['ud_country']=='def') $uderror='kein_bundesland_gewaehlt';
elseif ($_POST['ud_country']=='00') $uderror='kein_bundesland_gewaehlt';
elseif ($_POST['ud_country']=='') $uderror='kein_bundesland_gewaehlt';
if($_POST['user_bd_month']=='0' or $_POST['user_bd_day']=='0' or $_POST['user_bd_year']=='0') $uderror='kein_datum_angegeben';
if ($_POST['ud_sex']=='d') $uderror='kein_geschlecht_gewaehlt';
$ud_nick=(isset($_POST['ud_nick']) && !empty($_POST['ud_nick'])) ? trim($_POST['ud_nick']) : '';
$ud_newpw1=(isset($_POST['ud_newpw1']) && !empty($_POST['ud_newpw1'])) ? trim($_POST['ud_newpw1']) : '';
$ud_newpw2=(isset($_POST['ud_newpw2']) && !empty($_POST['ud_newpw2'])) ? trim($_POST['ud_newpw2']) : '';
$ud_email=(isset($_POST['ud_email']) && !empty($_POST['ud_email'])) ? trim($_POST['ud_email']) : '';
$cur_password=(isset($_POST['cur_password']) && !empty($_POST['cur_password'])) ? md5(trim($_POST['cur_password'])) : '';


#verify password change
if(!empty($ud_newpw1) && !empty($ud_newpw2))
{
if($cur_password!=pkGetUservalue('pass'))
$uderror='wrong_password';
elseif($_POST['ud_newpw1']!=$_POST['ud_newpw2'])
$uderror='passwords_unequal';
elseif($ud_newpw1===$ud_newpw2)
$ud_userpw=md5($ud_newpw1);
}

#verify email address change
if(!empty($ud_email) && $ud_email!=pkGetUservalue('email'))
{
if(!emailcheck($ud_email,1))
{
$uderror='email_invalid';
$ud_email='';
}
else
{
list($check)=$SQL->fetch_row($SQL->query("SELECT COUNT(*) FROM ".pkSQLTAB_USER."
WHERE user_email='".$SQL->f($ud_email)."' AND user_id<>".pkGetUservalue('id')."
LIMIT 1"));

if($check)
{
$uderror='email_in_use';
$ud_email='';
}
}

if(!empty($ud_email) && $cur_password!=pkGetUservalue('pass'))
$uderror='wrong_password';
}


#verify usernick change
if(!empty($ud_nick) && $ud_nick!=pkGetUservalue('nick'))
{
if($cur_password!=pkGetUservalue('pass'))
$uderror='wrong_password';
elseif(checkusername($ud_nick))
{
list($check)=$S->fetch_row($S->query("SELECT COUNT(user_id) FROM ".pkSQLTAB_USER."
WHERE user_nick='".$S->f($ud_nick)."' AND user_id<>'".$S->f(pkGetUservalue('id'))."'
LIMIT 1"));

if($check)
{
$uderror='nickname_in_use';
$ud_nick='';
}
}
else
$uderror='nickname_invalid';
}


if($uderror)
pkHeaderLocation('userprofile','edit','uderror='.$uderror);

$vars=array(
'ud_nick'=>'ud_nick',
'ud_hpage'=>'ud_hpage',
'ud_aimid'=>'ud_aimid',
'ud_yim'=>'ud_yim',
'ud_icqid'=>'ud_icqid',
'ud_usersig'=>'ud_usersig',
'ud_userqou'=>'ud_userqou',
'ud_userhobby'=>'ud_userhobby',
'ud_sex'=>'ud_sex',
'ud_emailshow'=>'ud_emailshow',
'ud_country'=>'ud_country',
'user_bd_day'=>'user_bd_day',
'user_bd_month'=>'user_bd_month',
'user_bd_year'=>'user_bd_year'
);

foreach($vars as $k=>$v)
$$k=$ENV->_post($v);

$ud_hpage=pkUrlCheck($ud_hpage) ? $ud_hpage : '';

if($user_bd_year > (date('Y',pkTIME)-5) || $user_bd_year<=1900 || !checkdate($user_bd_month,$user_bd_day,$user_bd_year))
$user_bd_day=$user_bd_month=$user_bd_year=0;

$S->query("UPDATE ".pkSQLTAB_USER." SET
uid='".pkRand()."',".
(empty($ud_nick) ? '' : "user_nick='".$S->F($ud_nick)."',").
(empty($ud_userpw) ? '' : "user_pw='".$S->F($ud_userpw)."',").
(empty($ud_email) ? '' : "user_email='".$S->F($ud_email)."',")."
user_emailshow='".$S->F(intval($ud_emailshow))."',
user_sex='".$S->F($ud_sex)."',
user_country='".$S->F($ud_country)."',
user_hpage='".$S->F($ud_hpage)."',
user_aimid='".$S->F($ud_aimid)."',
user_yim='".$S->F($ud_yim)."',
user_icqid='".$S->F($ud_icqid)."',
user_sig='".$S->F($ud_usersig)."',
user_qou='".$S->F($ud_userqou)."',
user_hobby='".$S->F($ud_userhobby)."',
user_bd_day='".$S->F($user_bd_day)."',
user_bd_month='".$S->F($user_bd_month)."',
user_bd_year='".$S->F($user_bd_year)."'
WHERE user_id='".$SQL->i(pkGetUservalue('id'))."'"
);

$info=$S->fetch_array($S->query("SELECT
*
FROM ".pkSQLTAB_USER."
WHERE user_id='".$SQL->i(pkGetUservalue('id'))."'"));

if(isset($_POST['profilefields']) && is_array($_POST['profilefields']))
{
$query=NULL;
$userfield_counter=$S->fetch_array($S->query("SELECT
COUNT(userid) as counter
FROM ".$db_tab['userfields']."
WHERE userid='".$SQL->i(pkGetUservalue('id'))."' LIMIT 1"));

if($userfield_counter['counter']<1)
$S->query("INSERT INTO ".pkSQLTAB_USER_FIELDS." (userid) VALUES ('".$SQL->i(pkGetUservalue('id'))."')");

foreach($_POST['profilefields'] as $id=>$value)
$query.=(empty($query) ? '' : ',')."field_".intval($id)."='".$S->f($value)."'";

if($query)
$S->query("UPDATE ".pkSQLTAB_USER_FIELDS."
SET ".$query."
WHERE userid='".$SQL->i(pkGetUservalue('id'))."'");
}

$array=array(
'nick'=>'nick',
'pass'=>'pw',
'email'=>'email',
'sex'=>'sex',
'hpage'=>'hpage',
'icqid'=>'icqid'
);

foreach($array as $k=>$v)
pkSetUservalue($k,$info['user_'.$v]);

#stats update
usercount();
newestuser();
bdusertoday();

pkHeaderLocation('userprofile','edit','event=profileupdate');
}


pkLoadLang('profile');


$uderror=$ENV->_get('uderror');

if($uderror)
pkEvent('profileupdate_'.$uderror,false);

$userfields=$S->fetch_assoc($S->query("SELECT
*
FROM ".pkSQLTAB_USER_FIELDS."
WHERE userid='".$SQL->i(pkGetUservalue('id'))."'
LIMIT 1"));

$result=$S->query("SELECT
profilefields_id,
profilefields_description,
profilefields_name,
profilefields_maxlength,
profilefields_groups,
profilefields_status_edit,
profilefields_pflicht,
profilefields_area,
profilefields_bbcode
FROM ".pkSQLTAB_USER_PROFILEFIELDS."
ORDER by profilefields_sorts ASC, profilefields_order ASC");
while(list($fieldid,$fielddescription,$fieldname,$fieldlength,$fieldgroup,$fieldstatusedit,$fieldpfl icht,$fieldarea,$fieldbbcode)=$S->fetch_row($result))
{
$value=pkEntities($userfields['field_'.$fieldid]);
$name='profilefields['.$fieldid.']';

if($fieldbbcode==1 AND $fielddescription!='') $code_ausgabe='<br><span style="color:#d70007;">BBCodes erlaubt</span>';
elseif($fieldbbcode==1 AND $fielddescription=='') $code_ausgabe='<span style="color:#d70007;">BBCodes erlaubt</span>';
else $code_ausgabe='';
if($fieldgroup !="")
eval ("\$user_ext_group = \"".pkTpl("usereditprofile_userfield_group")."\";");
else unset($user_ext_group);
if (getrights($fieldstatusedit)=="true"){
if($fieldpflicht=="0" AND $fieldarea=="0"){ unset($pflichtfeld);
eval ("\$editprofile_userfield.= \"".pkTpl("usereditprofile_userfield")."\";");}
elseif($fieldpflicht=="0" AND $fieldarea=="1"){ unset($pflichtfeld);
eval ("\$editprofile_userfield.= \"".pkTpl("usereditprofile_userfield_area")."\";");}
elseif($fieldpflicht=="0" AND $fieldarea=="2"){ unset($pflichtfeld);
eval ("\$editprofile_userfield.= \"".pkTpl("usereditprofile_userfield_num")."\";");}
elseif($fieldpflicht=="1" AND $fieldarea=="0"){$pflichtfeld='<span style="color:#d70007;">*</span>';
eval ("\$editprofile_userfield.= \"".pkTpl("usereditprofile_userfield")."\";");}
elseif($fieldpflicht=="1" AND $fieldarea=="1"){$pflichtfeld='<span style="color:#d70007;">*</span>';
eval ("\$editprofile_userfield.= \"".pkTpl("usereditprofile_userfield_area")."\";");}
elseif($fieldpflicht=="1" AND $fieldarea=="2"){$pflichtfeld='<span style="color:#d70007;">*</span>';
eval ("\$editprofile_userfield.= \"".pkTpl("usereditprofile_userfield_num")."\";");}
} else eval ("\$editprofile_userfield.= \"".pkTpl("usereditprofile_no_edit")."\";");
}
}

switch($info['user_sex'])
{
case 'w' :
$user_sex_option_1='selected="selected"';
break;
case 'm' :
$user_sex_option_2='selected="selected"';
break;
default :
$user_sex_option_0='selected="selected"';
}

foreach(range(1,31) as $d)
$bd_option_day.='<option value="'.$d.'"'.($info['user_bd_day']==$d ? ' selected="selected"' : '').'>'.$d.'</option>';

foreach(range(1,12) as $m)
$bd_option_month.='<option value="'.$m.'"'.($info['user_bd_month']==$m ? ' selected="selected"' : '').'>'.pkGetSpecialLang('month',$m).'</option>';

foreach(range(date('Y')-5,1900) as $y)
$bd_option_year.='<option '.($info['user_bd_year']==$y ? ' selected="selected"' : '').'>'.$y.'</option>';


$action_target=pkLink('userprofile','edit');

$user_name=pkEntities($info['user_name']);
$user_nick=pkEntities($info['user_nick']);
$user_email=pkEntities($info['user_email']);
$user_aimid=pkEntities($info['user_aimid']);
$user_yim=pkEntities($info['user_yim']);
$user_sig=pkEntities($info['user_sig']);
$user_qou=pkEntities($info['user_qou']);
$user_hobby=pkEntities($info['user_hobby']);
$user_hpage=pkEntities($info['user_hpage']);

$user_status=pkUserStatus($info['user_status']);
$user_signin=formattime($info['signin']);
$user_country=pkUserCountryOptionlist($info['user_country']);
$user_icqid=intval($info['user_icqid'])>0 ? intval($info['user_icqid']) : NULL;
$info['user_emailshow']==1 ? $user_email_option_1=' checked="checked"' : $user_email_option_0=' checked="checked"';

$user_navigation=pkUsernavigation();

$L_save=pkGetLang('save');
$L_reset=pkGetLang('reset');
$L_email_address=pkGetLang('email_address');

foreach(array(
'edit_profile',
'username',
'username_description',
'userstatus',
'userstatus_description',
'member_since',
'account_information',
'current_password',
'current_password_description',
'nickname',
'nickname_description',
'password',
'password_description',
'confirm_password',
'confirm_password_description',
'email_description',
'optional_specifications',
'show_email',
'show_email_description',
'sex',
'sex_description',
'sex_not_specified',
'sex_male',
'sex_female',
'dateofbirth',
'dateofbirth_description',
'dateofbirth_day',
'dateofbirth_month',
'dateofbirth_year',
'origin',
'origin_description',
'origin_ger',
'origin_aut',
'origin_ch',
'origin_nl',
'origin_oth',
'origin_def',
'homepage',
'homepage_description',
'aim_screenname',
'aim_screenname_description',
'yim',
'yim_description',
'icq',
'icq_description',
'signature',
'signature_description',
'quotation',
'quotation_description',
'hobbies',
'hobbies_description'
) as $l) {
$v='L_editprofile_'.$l;
$$v=pkGetLang($l);
}

eval("\$site_body.= \"".pkTpl("usereditprofile")."\";");
unset($S);
break;
#END case edit
case 'friends' :
pkLoadFunc('user');
$user_navigation=pkUserNavigation();

$add=isset($_REQUEST['add']) && intval($_REQUEST['add'])>0 ? intval($_REQUEST['add']) : 0;
$drop=isset($_REQUEST['drop']) && intval($_REQUEST['drop'])>0 ? intval($_REQUEST['drop']) : 0;

if($add && $add!=pkGetUservalue('id'))
{
if($DB->num_rows($DB->query("SELECT
*
FROM ".$db_tab['buddy']."
WHERE buddy_friendid='".$add."' AND
buddy_userid='".$SQL->i(pkGetUservalue('id'))."'
LIMIT 1"))==0)
{
$DB->query("INSERT INTO ".$db_tab['buddy']."
(buddy_userid, buddy_friendid) VALUES ('".$SQL->i(pkGetUservalue('id'))."','".$add."')");
}
}
elseif($add==pkGetUservalue('id'))
{
pkEvent('buddy_addself');
}

if($drop)
{
$DB->query("DELETE FROM ".$db_tab['buddy']."
WHERE buddy_friendid='".$drop."' AND
buddy_userid='".$SQL->i(pkGetUservalue('id'))."'");
}

unset($sqlcommand);
$getbuddies=$DB->query("SELECT
buddy_friendid
FROM ".$db_tab['buddy']."
WHERE buddy_userid='".$SQL->i(pkGetUservalue('id'))."'
ORDER BY buddy_userid");
while($buddy=$DB->fetch_array($getbuddies))
{
$buddy_chache[$buddy['buddy_friendid']]=$buddy;
if($sqlcommand=='')
{
$sqlcommand="SELECT
user_id,
user_ghost,
user_nick,
user_emailshow,
user_email,
user_hpage,
user_sex,
user_imoption,
user_icqid
FROM ".$db_tab['user']."
WHERE user_id='".$buddy['buddy_friendid']."'";
}
else
{
$sqlcommand.=" OR user_id='".$buddy['buddy_friendid']."'";
}
}

if($sqlcommand!='')
{
$getuserinfo=$DB->query($sqlcommand);
while($userinfo=$DB->fetch_array($getuserinfo))
{
$user_hash[$userinfo['user_id']]=$userinfo;
}

foreach($buddy_chache as $buddy)
{
if(!$userinfo=$user_hash[$buddy['buddy_friendid']])
{
$DB->query("DELETE FROM ".$db_tab['buddy']."
WHERE buddy_friendid='".$buddy['buddy_friendid']."' OR
buddy_userid='".$buddy['buddy_friendid']."'");
continue;
}

$row=rowcolor($row);
$userinfo['user_nick']=pkEntities($userinfo['user_nick']);

if(isonline($userinfo['user_id']))
eval("\$info_os= \"".pkTpl("member_os_online")."\";");
else
eval("\$info_os= \"".pkTpl("member_os_offline")."\";");

eval("\$info_nick= \"".pkTpl("member_showprofil_textlink")."\";");


if($userinfo['user_emailshow']==1)
{
eval("\$info_email= \"".pkTpl("member_email_textlink")."\";");
}
else
{
$info_email='&nbsp;';
}

if($userinfo['user_hpage']!="")
{
if(ereg('http://',$userinfo['user_hpage']))
{
$info_link=pkEntities($userinfo['user_hpage']);
}
else
{
$info_link='http://'.pkEntities($userinfo['user_hpage']);
}

eval("\$info_hpage= \"".pkTpl("member_hpage_iconlink")."\";");
}
else
{
$info_hpage='&nbsp;';
}

if($userinfo['user_sex']=='m')
{
eval("\$info_profile= \"".pkTpl("member_showprofil_iconlink_m")."\";");
}
elseif($userinfo['user_sex']=='w')
{
eval("\$info_profile= \"".pkTpl("member_showprofil_iconlink_w")."\";");
}
else
{
eval("\$info_profile= \"".pkTpl("member_showprofil_iconlink")."\";");
}


if($userinfo['user_imoption']==1)
{
eval("\$info_im= \"".pkTpl("member_sendim_iconlink")."\";");
}
else
{
eval("\$info_im= \"".pkTpl("member_sendim_nolink")."\";");
}


if($userinfo['user_icqid']!=0)
{
eval("\$info_icq= \"".pkTpl("member_icq_iconlink")."\";");
}
else
{
eval("\$info_icq= \"".pkTpl("blank_18_18")."\";");
}


eval("\$info_delete= \"".pkTpl("buddy_deletelink")."\";");
eval("\$buddy_list.= \"".pkTpl("buddy_row")."\";");
}

eval("\$buddy_head= \"".pkTpl("buddy_head")."\";");
}
else
{
eval ("\$buddy_list= \"".pkTpl("buddy_empty")."\";");
}

eval("\$site_body.= \"".pkTpl("buddy")."\";");
break;
#END case friends
case 'options' :
$userinfo=$style_option='';
$userinfo=$SQL->fetch_assoc($SQL->query("SELECT
*
FROM ".pkSQLTAB_USER."
WHERE user_name='".$SQL->f(pkGetUservalue('name'))."' AND
user_pw='".$SQL->f(pkGetUservalue('pass'))."' AND
user_id='".$SQL->f(pkGetUservalue('id'))."'
LIMIT 1"));

if($info['user_profillock']==1)
return pkEvent('eventtitle_profile_update_disabled');


pkLoadLang('profile');
pkLoadFunc('user');


if($ENV->_post_action('action','save'))
{
if($_POST['profil_delete']==1)
pkHeaderLocation('userprofile','delete');

$SESSION->setUservalue('sigoption',intval($_POST['new_sigoption']));
$SESSION->setUservalue('design',intval($_POST['user_design']));
$SESSION->setUservalue('imoption',intval($_POST['new_imoption']));

$SQL->query("UPDATE ".pkSQLTAB_USER."
SET user_design='".$ENV->_post_id('user_design')."',
user_imoption='".$ENV->_post_id('new_imoption')."',
user_imnotify='".$ENV->_post_id('new_imnotify')."',
user_sigoption='".$ENV->_post_id('new_sigoption')."',
user_nloption='".$ENV->_post_id('new_nloption')."',
user_ghost='".$ENV->_post_id('ghost_option')."'
WHERE user_id='".pkGetUservalue('id')."'");

pkHeaderLocation('userprofile','options');
}

if(isset($_REQUEST['setavatar']))
{
if($_REQUEST['unset']==1)
{
if(strstr($_REQUEST['setavatar'],'avauser'))
{
$name=pkGetConfig('avatar_path')."/avauser_".pkGetUservalue('id').".";

@unlink($name.'gif');
@unlink($name.'jpg');
@unlink($name.'png');
}

unset($_REQUEST['setavatar']);
}

$avatar=basename($_REQUEST['setavatar']);
$path=pkGetConfig('avatar_path').'/'.$avatar;

if( (!pkFileCheck($path)) ||
(substr($path,-4)=='.php') ||
(strstr($avatar,'avauser') && (substr($avatar,0,8+strlen(pkGetUservalue('id')))!='avauser_'.pkGetUservalue('id') || pkGetConfig('avatar_eod')!=2)) ||
(strstr($avatar,'avamember') && (pkGetUservalue('status')!='member' && pkGetUservalue('status')!='mod' && pkGetUservalue('status')!='admin')) ||
(strstr($avatar,'avamod') && (pkGetUservalue('status')!='mod' && pkGetUservalue('status')!='admin')) ||
(strstr($avatar,'avaadmin') && pkGetUservalue('status')!='admin')
)
$avatar='';

$SQL->query("UPDATE ".pkSQLTAB_USER."
SET user_avatar='".$SQL->f($avatar)."'
WHERE user_id='".$SQL->i(pkGetUservalue('id'))."'");

pkHeaderLocation('userprofile','options');
}

$userinfo['user_nick']=pkEntities($userinfo['user_nick']);

if($userinfo['user_imoption']==1)
$im_option1=' checked';
else
$im_option0=' checked';

if($userinfo['user_imnotify']==1)
$im_imnotify1=' checked';
else
$im_imnotify0=' checked';

if($userinfo['user_sigoption']==1)
$im_sigoption1=' checked';
else
$im_sigoption0='checked';

if($userinfo['user_nloption']==1)
$nl_option1=' checked';
else
$nl_option0=' checked';

if($config['user_ghost']==1)
{
if($userinfo['user_ghost']==1)
$ghost_option1=' checked';
else
$ghost_option0=' checked';

eval("\$ghost_eod= \"".pkTpl("extoption_ghost")."\";");
}

if($config['user_design']==1)
{
$userdesign=$userinfo['user_design'] ? $userinfo['user_design'] : pkGetConfig('site_design');

$result=$SQL->query("SELECT
style_id,
style_name
FROM ".pkSQLTAB_STYLE."
WHERE style_user=1 OR
style_id='".pkGetConfig('site_style')."'
ORDER by style_name ASC");
while($styleinfo=$SQL->fetch_array($result))
{
$style_option.='<option value="'.$styleinfo['style_id'].'"'.(($userdesign==$styleinfo['style_id']) ? ' selected' : '').'>'.pkEntities($styleinfo['style_name']).'</option>';
}

if($style_option)
eval("\$style_option= \"".pkTpl("extoption_style")."\";");
}

if($config['avatar_eod']==1 || $config['avatar_eod']==2)
{
$userinfo['user_avatar']=basename($userinfo['user_avatar']);

if($userinfo['user_avatar']!='' && @filecheck($config['avatar_path']."/".$userinfo['user_avatar']))
{
$avatar_dimension[3]=@getimagesize($config['avatar_path']."/".$userinfo['user_avatar']);

eval("\$avatar_show= \"".pkTpl("user_avatar_show")."\";");
eval("\$avatar_deselect= \"".pkTpl("extoption_avatar_deselect")."\";");
}

if($config['avatar_eod']==2)
{
eval("\$avatar_upload= \"".pkTpl("extoption_avatar_upload")."\";");
}

eval("\$avatar_eod= \"".pkTpl("extoption_avatar")."\";");
}

if(pkGetConfig('user_delete'))
eval("\$extoption_delete= \"".pkTpl("extoption_delete")."\";");

$user_navigation=pkUserNavigation();

eval("\$site_body.=\"".pkTpl("extoption")."\";");
break;
#END case options
default :
$phpkit_status=phpkitstatus();

$favstatus=$DB->fetch_array($DB->query("SELECT COUNT(*) FROM ".$db_tab['forumfav']." WHERE forumfav_userid='".$SQL->i(pkGetUservalue('id'))."' LIMIT 1"));

if($favstatus[0]>0)
{
eval ("\$profil_favorits= \"".pkTpl("profile_favorits")."\";");
}

if($config['member_gbook']==1)
{
$user_nav2=" • ";
$link_userguestbook=pkLink('userguestbook');

$counter=$DB->fetch_array($DB->query("SELECT COUNT(*) FROM ".$db_tab['comment']." WHERE comment_cat='user' AND comment_subid='".$SQL->i(pkGetUservalue('id'))."'"));

eval("\$profile_gbook= \"".pkTpl("profile_gbook")."\";");
}

unset($sqlcommand);

$getbuddies=$DB->query("SELECT buddy_friendid FROM ".$db_tab['buddy']." WHERE buddy_userid='".$SQL->i(pkGetUservalue('id'))."' ORDER BY buddy_userid");
while($buddy=$DB->fetch_array($getbuddies))
{
$buddy_cache[$buddy['buddy_friendid']]=$buddy;

if(!$sqlcommand)
{
$sqlcommand="SELECT user_imoption, user_nick, user_id, user_ghost FROM ".$db_tab['user']." WHERE user_id='".$buddy['buddy_friendid']."'";
}
else
{
$sqlcommand.=" OR user_id='".$buddy['buddy_friendid']."'";
}
}

if(is_array($buddy_cache))
{
$getuserinfo=$DB->query($sqlcommand);
while($userinfo=$DB->fetch_array($getuserinfo))
{
$user_cache[$userinfo['user_id']]=$userinfo;
}

foreach($buddy_cache as $buddy)
{
$row=rowcolor($row);

$userinfo=$user_cache[$buddy['buddy_friendid']];
$userinfo['user_nick']=pkEntities($userinfo['user_nick']);

if(isonline($userinfo['user_id']))
eval("\$info_os= \"".pkTpl("member_os_online")."\";");
else
eval("\$info_os= \"".pkTpl("member_os_offline")."\";");

if($userinfo['user_imoption']==1)
eval("\$info_im= \"".pkTpl("member_sendim_iconlink")."\";");
else
eval("\$info_im= \"".pkTpl("member_sendim_nolink")."\";");

eval("\$info_nick= \"".pkTpl("member_showprofil_textlink")."\";");
eval("\$buddy_list.= \"".pkTpl("profile_buddy_row")."\";");
}

if($buddy_list!='')
{
eval("\$profile_info.= \"".pkTpl("profile_buddy")."\";");
}
}

if(intval($imstatus_info=imstatus())>0)
eval("\$profile_info.= \"".pkTpl("profile_newim")."\";");

$online_time=formattime(pkGetUservalue('logtime'));
$usernick=pkGetUservalueF('nick');

$sitename=pkGetConfigF('site_name');

$link_userprofile=pkLink('userinfo');
$link_privatemessages=pkLink('privatemessages');
$link_userprofile_edit=pkLink('userprofile','edit');
$link_userprofile_friends=pkLink('userprofile','friends');
$link_userprofile_options=pkLink('userprofile','options');


eval("\$site_body.= \"".pkTpl("profile")."\";");
break;
#END case default
}
?>
 
Bitte, bitte den Code in Zukunft in [PHP]mein Code[/PHP] setzen

Hab keine Lust die Zeilen durchzuzählen umd ein Fehler in der 611ten zu finden.

Bitte gitb ein wenig Code vorher und nachher aus Also irgendiwe Zeile 600 bis 620. Dann markierst du darin noch welches die 611te ist.

Nachtrag:
1002 Zeilen Flacher Code in einer Datei mit etwa 10 Kommentaren - Mutig
Du solltest den Code in verscheidene Dateien splitten. AM besten mit Klassen arbeiten...
 
Zuletzt bearbeitet:
hmm ok hoffe mache es richtig nun :-[ mit dem PHP und so... könnt michaber auchanrufen und mir helfen wenn ihmögt..wäre echt cool... bin nicht so der PHP/html speziallist hatte mir ein hack eingebaut... -.-

PHP:
		'hobbies',
				'hobbies_description'
				) as $l) {
			$v='L_editprofile_'.$l;
			$$v=pkGetLang($l);
			}
		
		eval("\$site_body.= \"".pkTpl("usereditprofile")."\";");
		unset($S);		
		break;
		#END case edit
611---->	case 'friends' :
		pkLoadFunc('user');
		$user_navigation=pkUserNavigation();

		$add=isset($_REQUEST['add']) && intval($_REQUEST['add'])>0 ? intval($_REQUEST['add']) : 0;
		$drop=isset($_REQUEST['drop']) && intval($_REQUEST['drop'])>0 ? intval($_REQUEST['drop']) : 0;

		if($add && $add!=pkGetUservalue('id'))
			{
			if($DB->num_rows($DB->query("SELECT


einen gleichen fehler macht er auch in Zeile 777

PHP:
		}
		else
			{
			eval ("\$buddy_list= \"".pkTpl("buddy_empty")."\";");
			}
		
		eval("\$site_body.= \"".pkTpl("buddy")."\";");
		break;
		#END case friends
777---->	case 'options' :
		$userinfo=$style_option='';
		$userinfo=$SQL->fetch_assoc($SQL->query("SELECT 
			*
			FROM ".pkSQLTAB_USER." 
			WHERE user_name='".$SQL->f(pkGetUservalue('name'))."' AND
				user_pw='".$SQL->f(pkGetUservalue('pass'))."' AND 
				user_id='".$SQL->f(pkGetUservalue('id'))."'
			LIMIT 1"));
 
Zurück