Registrierungsformular erweitern und Informationen übernehmen

Eingetragen von Lord|Schirmer am Fr, 13. Jun 2014 - 20:11


Bei diesem Tutorial wird erklärt, wie man das Registrierungsformular der Version ilchClan 1.1 P um Eingabefelder erweitern kann und die hier eingegebenen Informationen, nach der Registrierung, auch in den Userdetails übernommen werden.

Als Beispiel werden nun die zwei Felder Vorname und Nachname eingefügt.

Damit die eingebenen Informationen auch in der Datenbank gespeichert werden, muss diese natürlich auch um die Spalten erweitert werden. Dazu muss die Tabelle prefix_usercheck (Registrierungsinformationen) und prefix_user (Userinformationen) angepasst werden. Das prefix_ bedarf der Anpassung, so wie es bei Euch in der Datenbank steht, bei der ersten und Standard-Installation ist es normalerweise ic1_.

Dazu geht Ihr in PhpMyAdmin und ruft die Datenbank auf. Hier drückt ihr auf SQL für SQL Befehl ausführen und führt folgende Befehle aus:

ALTER TABLE `ic1_usercheck` ADD `firstname` VARCHAR(100) NOT NULL DEFAULT '';
ALTER TABLE `ic1_usercheck` ADD `familyname` VARCHAR(100) NOT NULL DEFAULT '';

ALTER TABLE `ic1_user` ADD `firstname` VARCHAR(100) NOT NULL DEFAULT '';
ALTER TABLE `ic1_user` ADD `familyname` VARCHAR(100) NOT NULL DEFAULT '';


Bild: Registrierungsformular original


Bild: Registrierungsformular erweitert


Jetzt erweitern wir das Template des Registrierungsformulares und fügen die markierten Zeilen ein:
<!-- REGELN -->
<form action="index.php?user-regist-2" method="POST">

    {_lang_attentionplease}:
    <br />
    {regeln}


    <br /><br /><input type="submit" value="{_lang_readandok}" name="Yes">

</form>
{EXPLODE}
<form action="index.php?user-regist-2" method="POST">
    <input type="hidden" value="Gelesen und einverstanden" name="checked">
    <table width="100%" border="0" cellspacing="1" cellpadding="3" class="border">
        <tr class="Chead">
            <th colspan="2"><b>{_lang_REGISTER}</b></th>
        </tr><tr>
            <td colspan="2" class="Cdark">{FEHLER}</td>
        </tr><tr>
            <td class="Cmite" width="60">{_lang_nickname}</td>
            <td class="Cnorm"><input type="text" name="nutz" value="{name}" maxlength="15"></td>
        </tr><tr>
            <td class="Cmite" width="60">{_lang_firstname}</td>
            <td class="Cnorm"><input type="text" name="firstname" value="{firstname}" maxlength="30"></td>
        </tr><tr>
            <td class="Cmite" width="60">{_lang_familyname}</td>
            <td class="Cnorm"><input type="text" name="familyname" value="{familyname}" maxlength="30"></td>
        </tr><tr>
            <td class="Cmite">{_lang_mail}</td>
            <td class="Cnorm"><input type="text" maxlength="100" value="{email}" name="email"></td>
        </tr>{EXPLODE}<tr>
            <td class="Cmite">{_lang_password}</td>
            <td class="Cnorm"><input type="password" name="pass"></td>
        </tr>{EXPLODE}
        <tr>
            <td class="Cmite">Antispam</td>
            <td class="Cnorm">{antispam}</td>
        </tr>
        <tr class="Cdark">
            <td></td>
            <td><input type="submit" name="register" value="{_lang_register}"></td>
        </tr>
    </table>
</form>
{EXPLODE}
{_lang_hello} {NAME}<br>

{_lang_yourregistrationwassuccessful}!<br><br>
{_lang_amailhasbeensenttoyouwithmailandpass}!<br><br>
{_lang_afteryoureceivedthemail} <a href="index.php?user-2">{_lang_login2}</a>


Als Nächstes fügen wir die Sprachvariablen {_lang_firstname} & {_lang_familyname} in die Language Dateien nach $lang = array( in die Listen ein:
'firstname' => 'Vorname',
'familyname' => 'Nachname',
'firstname' => 'first name',
'familyname' => 'family name',


Jetzt wird die Verarbeitungsdatei welche die Daten aus dem Template aufnimmt angepasst. Die markierten Zeilen zeigen die Änderungen und Erweiterungen.
<?php

#   Copyright by: Manuel
#   Support: www.ilch.de


defined('main') or die('no direct access');

if (!isset($_GET['step'])) {
    $_GET['step'] = 1;
}

if ($allgAr['forum_regist'] == 0) {
    # user duerfen sich nicht registrieren.
    $title = $allgAr['title'] . ' :: Users :: Keine registrierung möglich';
    $hmenu = $extented_forum_menu . '<a class="smalfont" href="?user">User</a><b> » </b>Keine Registrierung möglich' . $extented_forum_menu_sufix;
    $design = new design($title, $hmenu, 1);
    $design->header();
    $tpl = new tpl('user/login');
    echo '<b> Der Administrator hat festgelegt das man sich nicht registrieren kann </b>';
    $tpl->set_out('WDLINK', '?' . $allgAr['smodul'], 0);
    $design->footer();
    exit();
}

switch ($menu->get(2)) {
    default :
        $title = $allgAr['title'] . ' :: Users :: Registrieren :: Step 1 von 3';
        $hmenu = $extented_forum_menu . '<a class="smalfont" href="?user">User</a><b> » </b><a class="smalfont" href="?user-regist">Registrieren</a><b> » </b>Step 1 von 3' . $extented_forum_menu_sufix;
        $design = new design($title, $hmenu, 1);
        $design->header();
        $tpl = new tpl('user/regist');
        $tpl->set_out('regeln', bbcode($allgAr['allg_regeln']), 0);
        $design->footer();
        break;

    case 2 :
        $name = '';
        $email = '';
		$firstname = '';
		$familyname = '';
		
        if (!empty($_POST['nutz'])) {
            $name = escape($_POST['nutz'], 'string');
        }
        if (!empty($_POST['email'])) {
            $email = escape($_POST['email'], 'string');
        }
        if (!empty($_POST['firstname'])) {
            $firstname = escape($_POST['firstname'], 'string');
        }
        if (!empty($_POST['familyname'])) {
            $familyname = escape($_POST['familyname'], 'string');
        }
		
		$checkNotEmpty = array(
		    'name'	=> 'Nickname',
			'email' => 'E-Mail',
			'firstname' => 'Vorname',
			'familyname' => 'Nachname'
		);
		
		$emptyErrorMsg = '';
		foreach ($checkNotEmpty as $field => $label) {
			if (empty($$field)) {
				$emptyErrorMsg .= '• <b>' . $label . '</b> ist ein Pflichtfeld!' . PHP_EOL;
			}
		}

        $ch_name = false;
        $xname = escape_nickname($name);
        if (!empty($name) AND $xname == $name AND 0 == db_result(db_query("SELECT COUNT(*) FROM prefix_user WHERE name = BINARY '" . $name . "'"), 0)) {
            $ch_name = true;
        }

        $chkAntispam = chk_antispam('regist');
        if (!empty($emptyErrorMsg) OR $name != $xname OR $ch_name == false OR !$chkAntispam) {
            $title = $allgAr['title'] . ' :: Users :: Registrieren :: Step 2 von 3';
            $hmenu = $extented_forum_menu . '<a class="smalfont" href="?user">User</a><b> » </b><a class="smalfont" href="?user-regist">Registrieren</a><b> » </b>Step 2 von 3' . $extented_forum_menu_sufix;
            $design = new design($title, $hmenu, 1);
            $design->header();
            if (isset($_POST['register'])) {
                if (!empty($emptyErrorMsg)) {
                    $fehler = $lang['entereddataincomplete'] . '<br/>' . $emptyErrorMsg;
                } elseif ($name != $xname) {
                    $fehler = $lang['wrongnickname'];
                } elseif ($ch_name == false) {
                    $fehler = $lang['namealreadyinuse'];
                } elseif (!$chkAntispam) {
                    $fehler = $lang['wrongcaptchaentered']; //antispamtxt
                }
            } else {
                $fehler = '';
            }
            $tpl = new tpl('user/regist');
            $tpl->set('name', $name);
            $tpl->set('email', $email);
            $tpl->set('firstname', $firstname);
            $tpl->set('familyname', $familyname);
            $tpl->set('antispam', get_antispam('regist', 0));
            $tpl->set_out('FEHLER', $fehler, 1);
            if ($allgAr['forum_regist_user_pass'] == 1) {
                $tpl->out(2);
            }
            $tpl->out(3);
        } else {
            $pass = genkey(8);
            if (!empty($_POST['pass'])) {
                $pass = escape($_POST['pass'], 'string');
            }
            user_regist($name, $firstname, $familyname, $email, $pass);

            $tpl = new tpl('user/regist');
            $title = $allgAr['title'] . ' :: Users :: Registrieren :: Step 3 von 3';
            $hmenu = $extented_forum_menu . '<a class="smalfont" href="?user">User</a><b> » </b><a class="smalfont" href="?user-regist">Registrieren</a><b> » </b>Step 3 von 3' . $extented_forum_menu_sufix;
            $design = new design($title, $hmenu, 1);
            $design->header();
            $tpl->set_out('NAME', $name, 4);
        }
        $design->footer();
        break;
}
?>


Nun muss die Fuktion user_regist() angepasst werden, damit die Daten auch an die Datenbank gesendet werden. Die Änderungen wurden markiert.

<?php

# hier werden alle user spezifischen funktionen
# definert...

function user_identification () {
  user_auth();
  user_login_check();
  user_update_database();
  user_check_url_rewrite();
}

function user_auth () {
  debug ('user - auth gestartet'. session_id());
  $cn = session_und_cookie_name();
  if (!user_key_in_db()
   OR !isset($_SESSION['authid'])
   OR (isset($_SESSION['authsess']) AND $_SESSION['authsess'] != $cn)) {

    debug ('user - nicht in db oder nicht authid');

    user_set_guest_vars();
    user_set_user_online ();

    # wenn cn cookie vorhanden
    # dann checken ob er sich damit einloggen darf
    if (isset($_COOKIE[$cn])) {
      user_auto_login_check();
    }

    # gruppen, und modulzugehoerigkeit setzten
    user_set_grps_and_modules();
  }
}

function user_check_url_rewrite() {
  global $allgAr;
  if ( !loggedin() AND $allgAr['show_session_id'] == 0 ) {
    # loescht die sessionid von allen urls
    # auch urls wie formulare usw. damit
    # suchmaschienen bots nicht iritiert sind ;)
    # output_reset_rewrite_vars ist eine php funktion
    # nicht unnoetig dannach suchen ;) ...
    output_reset_rewrite_vars ();
  }
}

function user_update_database () {
  $dif = date('Y-m-d H:i:s', time() - 7200);
  db_query("UPDATE prefix_online SET uptime = now() WHERE sid = '".session_id()."'");
  db_query("DELETE FROM prefix_online WHERE uptime < '". $dif."'");
  if ( loggedin() ) {
    db_query("UPDATE prefix_user SET llogin = '".time()."' WHERE id = '".$_SESSION['authid']."'");
  }
}

function user_set_user_online () {
  global $allgAr;
  if (0 == db_result(db_query("SELECT COUNT(*) FROM prefix_online WHERE sid = '".session_id()."'"),0) ) {
    db_query("INSERT INTO prefix_online (sid,uptime,ipa) VALUES ('".session_id()."',now(),'".getip()."')");
  }
  $_SESSION['authgfx'] = $allgAr['gfx'];
}

function user_key_in_db() {
  if ( 1 == db_result(db_query("SELECT COUNT(*) FROM prefix_online WHERE sid = '".session_id()."'"),0) ) {
    return ( true );
  } else {
    return ( false );
  }
}

function session_und_cookie_name () {
  return (md5(dirname($_SERVER["HTTP_HOST"].$_SERVER["SCRIPT_NAME"]).DBPREF));
}

function user_pw_crypt($plainPassword) {
    if (version_compare(PHP_VERSION, '5.0') !== -1) {
        $pwCrypt = new PwCrypt();
        return $pwCrypt->cryptPasswd($plainPassword);
    }
    return md5($plainPassword);
}

function user_pw_check($plainPassword, &$passwordHash, $userId = false) {
    if (version_compare(PHP_VERSION, '5.0') !== -1) {
        $pwCrypt = new PwCrypt();
        $correct = $pwCrypt->checkPasswd($plainPassword, $passwordHash);
        if ($correct && $userId !== false && $pwCrypt->checkHashStrength($passwordHash)) {
            $passwordHash = $pwCrypt->cryptPasswd($plainPassword);
            if ($passwordHash) {
                db_query('UPDATE `prefix_user` SET `pass` = "' . $passwordHash . '" WHERE `id` = ' . $userId);
            }
        }
        return $correct;
    }
    return md5($plainPassword) === $passwordHash;
}

function user_set_cookie($id, $cryptedPassword) {
    $cookieString = $id . '=' . md5(DBUSER . $cryptedPassword);
    setcookie($_SESSION['authsess'], $cookieString , strtotime('+1 year'), '/' );
}

function user_cookie_check($cookieHash, $cryptedPassword) {
    return md5(DBUSER . $cryptedPassword) == $cookieHash;
}

function user_login_check () {
  if ( isset ($_POST['user_login_sub']) AND isset ($_POST['name']) AND isset ($_POST['pass']) ) {
    debug ('posts vorhanden');
    $name = escape_nickname($_POST['name']);
    if ($name != $_POST['name'] OR strlen($_POST['name']) > 15) {
        return false;
    }
    $erg = db_query("SELECT name,id,recht,pass,llogin FROM prefix_user WHERE name = BINARY '".$name."'");
    if ( db_num_rows($erg) == 1 ) {
      debug ('user gefunden');
      $row = db_fetch_assoc($erg);
      if (user_pw_check($_POST['pass'], $row['pass'], $row['id']) ) {
        debug ('passwort stimmt ... '.$row['name']);
        $_SESSION['authname']  = $row['name'];
        $_SESSION['authid']    = $row['id'];
        $_SESSION['authright'] = $row['recht'];
        $_SESSION['lastlogin'] = $row['llogin'];
        $_SESSION['authsess']  = session_und_cookie_name();
        db_query("UPDATE prefix_online SET uid = ".$_SESSION['authid']." WHERE sid = '".session_id()."'");
        user_set_cookie($row['id'], $row['pass']);
        user_set_grps_and_modules();
        return (true);
      }
    }
    global $menu;
    $menu->set_url (0, 'user');
    $menu->set_url (1, 'login');
  }
  return ( false );
}

function user_auto_login_check () {
  $cn = session_und_cookie_name();
  $dat = explode('=',$_COOKIE[$cn]);
  $id = $pw = 0;
  if (isset($dat[0])) { $id = escape($dat[0], 'integer'); }
  if (isset($dat[1])) { $pw = $dat[1]; }
  debug (' pw ' . $pw );
  debug (' id ' . $id );
  $erg = db_query("SELECT name,id,recht,pass,llogin FROM prefix_user WHERE id = ".$id);
  if (db_num_rows($erg) == 1) {
    debug ('benutzer gefunden');
    $row = db_fetch_assoc($erg);
    if (user_cookie_check($pw, $row['pass'])) {
      debug ('passwoerter stimmen');
      debug ($row['name']);
      $_SESSION['authname']  = $row['name'];
      $_SESSION['authid']    = $row['id'];
      $_SESSION['authright'] = $row['recht'];
      $_SESSION['lastlogin'] = $row['llogin'];
      $_SESSION['authsess']  = $cn;
      db_query("UPDATE prefix_online SET uid = ".$_SESSION['authid']." WHERE sid = '".session_id()."'");
      user_set_cookie($row['id'], $row['pass']);
      return (true);
    }
  }

  user_logout ();
  return (false);
}

function user_set_guest_vars() {
  $_SESSION['authname']  = 'Gast';
  $_SESSION['authid']    = 0;
  $_SESSION['authright'] = 0;
  $_SESSION['lastlogin'] = time();
  $_SESSION['authgrp'] = array();
  $_SESSION['authmod'] = array();
  $_SESSION['authsess']  = session_und_cookie_name();
}

function user_markallasread () {
  $_SESSION['lastlogin'] = time();
}

function user_logout () {
  #global $allgAr;
  #$_SESSION = array();
  #$_SESSION['authgfx'] = $allgAr['gfx'];
  user_set_guest_vars();
  db_query("UPDATE prefix_online SET uid = ".$_SESSION['authid']." WHERE sid = '".session_id()."'");
  setcookie(session_und_cookie_name(), "", time()-999999999999, "/" );
  #if (isset($_COOKIE[session_name()])) {
  #  setcookie(session_name(), '', time()-99999999999931104000, '/');
  #}
  #setcookie(session_und_cookie_name(), "", time()-999999999999, "/" );
  #session_destroy();
}

function user_set_grps_and_modules() {
    $_SESSION['authgrp'] = array();
    $_SESSION['authmod'] = array();
    $_SESSION['adminaccess'] = array();
    if (loggedin()) {
        $erg = db_query('SELECT gid FROM prefix_groupusers WHERE uid = ' . $_SESSION['authid']);
        while ($row = db_fetch_assoc($erg)) {
            $_SESSION['authgrp'][$row['gid']] = true;
        }
        $erg = db_query('SELECT DISTINCT m.url, m.gshow '
            . 'FROM prefix_modulerights mr '
            . 'INNER JOIN prefix_modules m ON m.id = mr.mid '
            . 'WHERE mr.uid = ' . $_SESSION['authid']);
        while ($row = db_fetch_assoc($erg)) {
            $_SESSION['authmod'][$row['url']] = true;
            if ($row['gshow']) {
                $_SESSION['adminaccess'][$row['url']] = true;
            }
        }
    }
}

function loggedin () {
  if ( has_right(-1) ) { return ( true ); } else { return ( false ); }
}
function is_admin () {
  if ( has_right(-9) ) { return ( true ); } else { return ( false ); }
}
function is_coadmin () {
  if ( has_right(-8) ) { return ( true ); } else { return ( false ); }
}
function is_siteadmin ($m = NULL) {
  if ( has_right(-7) ) { return ( true ); }
  if ( !is_null($m) AND has_right(NULL, $m)) { return (true); }
  return ( false );
}

# diese funktion liefert immer true wenn es ein admin ist.
# wenn kein kein admin wird geprueft ob der user
# entweder ein angegebenes recht oder in einer angegebene
# gruppe ist. oder ob er fals angegben das modulrecht hat.
# wenn eines von diesen 3 kriterien stimmt wird true ansonsten
# wenn keins uebereinstimmt false zurueck gegeben.
function has_right ($recht,$modul = '') {
  if ( !is_array($recht) AND !is_null($recht) ) {
    $recht = array ( $recht );
  }

  if ( $_SESSION['authright'] == -9 ) {
    return ( true );
  }

  if ( !is_null($recht) ) {
    foreach ( $recht as $v ) {
      if ( ($v <= 0 AND $v >= $_SESSION['authright'] ) OR (isset($_SESSION['authgrp'][$v]) AND $_SESSION['authgrp'][$v] === true) ) {
        return (true);
      }
    }
  }

  if ( !empty($modul) AND isset($_SESSION['authmod'][$modul]) AND $_SESSION['authmod'][$modul] === true ) {
    return ( true );
  }

  return (false);
}

### admin
# wenn der 2. parameter weggelassen wird oder auf true gesetzt wird
# dann wird ein login formular angezeigt, wenn der user kein admin ist.
# wird der parameter auf false gesetzt wird das login formular nicht angezeigt.
# erste parameter ist das menu objekt...
function user_has_admin_right($menu, $sl = true) {
    if ($_SESSION['authright'] <= -8) {  # co leader...
        return true;
    } else {
        $uri_to_check1 = $menu->get(0);
        $uri_to_check2 = $menu->get(1);
        if (count($_SESSION['adminaccess']) < 1 OR !loggedin()) {
            if ($sl === true) {
                if (!loggedin()) {
                    $tpl = new tpl('user/login.htm');
                    $tpl->set_out('WDLINK', 'admin.php', 0);
                } else {
                    echo '<strong>Keine Berechtigung!</strong> <a href="index.php">Startseite</a>';
                }
            }
            return false;
        } elseif ((isset($_SESSION['adminaccess'][$uri_to_check1]) AND $_SESSION['adminaccess'][$uri_to_check1] == true)
            || (isset($_SESSION['adminaccess'][$uri_to_check1 . '-' . $uri_to_check2]) AND $_SESSION['adminaccess'][$uri_to_check1 . '-' . $uri_to_check2] == true)
        ) {
            return true;
        } elseif (count($_SESSION['adminaccess']) > 0 AND loggedin()) {
            if ($sl === true) {
                foreach ($_SESSION['adminaccess'] as $k => $v) {
                    $x = $k;
                    break;
                }
                $x = explode('-', $x);
                $menu->set_url(0, $x[0]);
                if (isset($x[1])) {
                    $menu->set_url(1, $x[1]);
                }
            }
            return true;
        }
    }
    return false;
}

function user_regist ($name, $firstname, $familyname, $mail, $pass) {
  global $allgAr, $lang;

  $erg = db_query("SELECT id FROM prefix_user WHERE name = BINARY '".$name."'");
  if (db_num_rows($erg) > 0) {
    return (false);
  }

  if ( $allgAr['forum_regist_user_pass'] == 0 ) {
		$new_pass = genkey(8);
  } else {
	  $new_pass = $pass;
	}

  $passwordHash = user_pw_crypt($new_pass);
	$confirmlinktext = '';

	# confirm insert in confirm tb not confirm insert in user tb
	if ( $allgAr['forum_regist_confirm_link'] == 1 ) {
		# confirm link + text ... bit of shit put it in languages file
	  $page = $_SERVER["HTTP_HOST"].$_SERVER["SCRIPT_NAME"];
		$id = md5 (uniqid (rand()));
		$confirmlinktext = "\n".$lang['registconfirm']."\n\n".sprintf($lang['registconfirmlink'], $page, $id );
		db_query("INSERT INTO prefix_usercheck (`check`,name,firstname,familyname,email,pass,datime,ak)
		VALUES ('".$id."','".$name."','".$firstname."','".$familyname."','".$mail."','".$passwordHash."',NOW(),1)");
  } else {
	  db_query("INSERT INTO prefix_user (name,firstname,familyname,pass,recht,regist,llogin,email,status,opt_mail,opt_pm)
		VALUES('".$name."','".$firstname."','".$familyname."','".$passwordHash."',-1,'".time()."','".time()."','".$mail."',1,1,1)");
		$userid = db_last_id();
	}
  $regmail = sprintf($lang['registemail'],$name, $confirmlinktext, $name, $new_pass);

	icmail($mail,'Anmeldung',$regmail); # email an user

  return (true);
}

function user_remove($uid){
    $row = @db_fetch_object(db_query("SELECT recht,avatar FROM prefix_user WHERE id = ".$uid));
    if ( $uid <> 1 AND ($_SESSION['authid'] == $uid OR $_SESSION['authid'] == 1 OR (is_coadmin() AND $_SESSION['authright'] < $row->recht))) {
        db_query("DELETE FROM prefix_user WHERE id = ".$uid);
        db_query("DELETE FROM prefix_userfields WHERE uid = ".$uid);
        db_query("DELETE FROM prefix_groupusers WHERE uid = ".$uid);
        db_query("DELETE FROM prefix_modulerights WHERE uid = ".$uid);
        db_query("DELETE FROM prefix_pm WHERE eid = ".$uid);
        db_query("DELETE FROM prefix_online WHERE uid = ".$uid);
        //Usergallery entfernen
        $sql = db_query("SELECT id,endung FROM prefix_usergallery WHERE uid = ".$uid);
        while( $r = db_fetch_object($sql) ){
            @unlink("include/images/usergallery/img_$r->id.$r->endung");
            @unlink("include/images/usergallery/img_thumb_$r->id.$r->endung");
        }
        db_query("DELETE FROM prefix_usergallery WHERE uid = ".$uid);
        //Avatar
        @unlink($row->avatar);
    }
}

function sendpm ($sid,$eid,$ti,$te,$status = 0) {
  if (is_array($eid)) {
  	db_query("INSERT INTO `prefix_pm` (`sid`,`eid`,`time`,`titel`,`txt`,`status`) ".
  	"SELECT  ".$sid.",`prefix_user`.`id`,'".time()."','".$ti."','".$te."',".$status." FROM `prefix_user` WHERE `prefix_user`.`id` IN (" . implode(',', $eid) . ")");
  } else {
  	db_query("INSERT INTO `prefix_pm` (`sid`,`eid`,`time`,`titel`,`txt`,`status`) VALUES (".$sid.",".$eid.",'".time()."','".$ti."','".$te."',".$status.")");
  }
}
?>


Damit nun auch die Daten der Registrierung auch nach der Emailbestätigung direkt in die Usertabelle geschrieben werden muss nun noch folgende Datei angepasst werden:
<?php
#   Copyright by: Manuel
#   Support: www.ilch.de


defined ('main') or die ( 'no direct access' );

$title = $allgAr['title'].' :: User :: Confirm';
$hmenu = $extented_forum_menu.'<a class="smalfont" href="?user">User</a><b> » </b>Confirm'.$extented_forum_menu_sufix;
$design = new design ( $title , $hmenu, 1);
$design->header();

$abgelaufen = time() - 2592000; # 30 tage
$abgelaufen = date('Y-m-d H:i:s',$abgelaufen);
db_query("DELETE FROM prefix_usercheck WHERE datime < '".$abgelaufen."'");

$erg = db_query("SELECT * FROM prefix_usercheck WHERE `check` = '".escape($_GET['check'], 'string')."'");
if ( db_num_rows($erg) == 1 ) {
  $row = db_fetch_assoc($erg);
	switch ( $row['ak'] ) {

		# confirm regist
	  case 1 :
		  if ( 0 == db_count_query("SELECT COUNT(*) FROM prefix_user WHERE name = BINARY '".$row['name']."'") ) {
			  db_query("INSERT INTO prefix_user (name,firstname,familyname,pass,recht,regist,llogin,email,status,opt_mail,opt_pm)
			  VALUES('".$row['name']."','".$row['firstname']."','".$row['familyname']."','".$row['pass']."',-1,'".time()."','".time()."','".$row['email']."',1,1,1)");

			  echo $lang['confirmregist'];
			} else {
			  echo $lang['confirmregistfailed'];
			}
		  break;

		# confirm new pass
		case 2 :
		  db_query("UPDATE prefix_user SET pass = '".$row['pass']."' WHERE name = BINARY '".$row['name']."'");
		  echo $lang['confirmpassword'];
      break;

    # confirm new email
    case 3 :
      list ($id, $muell) = explode('||', $row['check']);
      db_query("UPDATE prefix_user SET email = '".$row['email']."' WHERE id = ". escape($id, 'integer'));
      echo $lang['confirmemail'];
      break;

    # ak 4 wurde besetzt fuer joinus anfragen...
    case 4 :  break;

    # ak 5 remove account
    case 5:
        list ($id, $muell) = explode('-remove-', $row['check']);
        if ($id != $_SESSION['authid']) {
            break;
        }
        user_remove($id);
        wd('index.php','Dein Account wurde gelöscht. Du wirst nun auf die Startseite geleitet.',7);
        break;
	}
	db_query("DELETE FROM prefix_usercheck WHERE `check` = '".$row['check']."'");
} else {
  echo $lang['confirmfailure'];
}

$design->footer();
?>


So nun ist die komplette Registrierung um die neuen Felder angepasst und jetzt geht es natürlich um die Ausgabe in den Userdetails

Bild: Userdetails original


Bild: Userdetails erweitert



Jetzt erweitern wir das Template der Useransicht:
<a href="javascript:history.back(1)"><b>«</b> {_lang_back}</a>
<br />
<br />

<table width="100%" cellpadding="3" cellspacing="1" class="border">
  <tr class="Chead"> 
    <th colspan="3"><b>{_lang_detailsfrom} {NAME}</b></th>
  </tr><tr>
    <td class="Cmite" width="30%">{_lang_nickname}</td>
    <td class="Cnorm" width="40%">{NAME}</td>
    <td class="Cnorm" width="30%" rowspan="{rowspan}" valign="top" align="center">
		  {AVATA}
			<br /><br />
			<font class="smalfont">{RANG}</font>
		</td>
  </tr><tr>
    <td class="Cmite">{_lang_firstname}</td>
    <td class="Cnorm">{FIRSTNAME}</td>
  </tr><tr>
    <td class="Cmite">{_lang_familyname}</td>
    <td class="Cnorm">{FAMILYNAME}</td>
  </tr><tr>
    <td class="Cmite">{_lang_regsince}</td>
    <td class="Cnorm">{JOINED}</td>
  </tr><tr>
    <td class="Cmite">{_lang_lastactivity}</td>
    <td class="Cnorm">{LASTAK}</td>
  </tr><tr>
    <td class="Cmite">{_lang_posts2}</td>
    <td class="Cnorm">{POSTS}, {_lang_perday}: {postpday}</td>
  </tr>
	
{profilefields}
	
</table>

<br />
<a href="javascript:history.back(1)"><b>«</b> {_lang_back}</a>


und die dazugehörige Datei, welche die Daten aus der Datenbank holt:
<?php
#   Copyright by: Manuel
#   Support: www.ilch.de


defined ('main') or die ( 'no direct access' );

$uid = intval($menu->get(2));

$abf = 'SELECT * FROM prefix_user WHERE id = "'.$uid.'"';
$erg = db_query($abf);

if (db_num_rows($erg)) {
	$row = db_fetch_assoc($erg);

	$avatar = '';
	if ( file_exists($row['avatar'])) {
		$avatar = '<img src="'.$row['avatar'].'" border="0">';
	}

	$regsek = mktime ( 0,0,0, date('m'), date('d'), date('Y') )  - $row['regist'];
	$regday = round($regsek / 86400);
	$postpday = ( $regday == 0 ? 0 : round($row['posts'] / $regday, 2 ) );

	$ar = array (
	    'NAME' => $row['name'],
	    'FIRSTNAME' => $row['firstname'],
	    'FAMILYNAME' => $row['familyname'],
		'JOINED'  => date('d M Y',$row['regist']),
		'LASTAK'  => date('d M Y - H:i',$row['llogin']),
		'POSTS'   => $row['posts'],
		'postpday' => $postpday,
		'RANG'    => userrang ($row['posts'],$uid),
		'AVATA'   => $avatar,
	);


	$title = $allgAr['title'].' :: Users :: Details von '.$row['name'];
	$hmenu  = $extented_forum_menu.'<a class="smalfont" href="?user">Users</a><b> » </b> Details von '.$row['name'].$extented_forum_menu_sufix;
	$design = new design ( $title , $hmenu, 1);
	$design->header();

	$tpl = new tpl ( 'user/userdetails' );

	$l = profilefields_show ( $uid );

	$ar['rowspan'] = 6 + substr_count($l, '<tr><td class="');

	$ar['profilefields'] = $l;
	$tpl->set_ar_out($ar,0);
} else {
	$title = $allgAr['title'].' :: Users :: User nicht gefunden';
	$hmenu  = $extented_forum_menu.'<a class="smalfont" href="?user">Users</a> '.$extented_forum_menu_sufix;
	$design = new design ( $title , $hmenu, 1);
	$design->header();

	echo 'Der Benutzer wurde nicht gefunden bzw. die Seite wurde nicht richtig aufgerufen.<br />';
}

$design->footer();
?>


Damit diese Informationen auch von den jeweiligen Usern geändert werden können, müssen folgende 2 Dateien noch angepasst werden:

<form action="index.php?user-profil" method="POST" enctype="multipart/form-data">
	{antispam}
    <fieldset>
	  <legend>Persönliche Daten ändern</legend>
		  <br />
		    <label style="float:left; width:35%;">{_lang_firstname}</label><input style="margin-bottom:2px;" name="firstname" value="{firstname}" /><br style="clear:both;" />
		    <label style="float:left; width:35%;">{_lang_familyname}</label><input style="margin-bottom:2px;" name="familyname" value="{familyname}" /><br style="clear:both;" />
            <label style="float:left; width:35%;">{_lang_mail}</label><input style="margin-bottom:2px;" name="email" value="{email}" /><input type="hidden" name="aemail" value="{email}" /><font class="smalfont">{_lang_mustbeentered}</font><br />
			<label style="float:left; width:35%;">{_lang_homepage}</label><input style="margin-bottom:2px;" name="homepage" value="{homepage}" /><br style="clear:both;" />
			<label style="float:left; width:35%;">{_lang_hometown}</label><input style="margin-bottom:2px;" name="wohnort" value="{wohnort}" /><br style="clear:both;" />
			<label style="float:left; width:35%;">{_lang_icq}</label><input style="margin-bottom:2px;" name="icq" value="{icq}" /><br style="clear:both;" />
			<label style="float:left; width:35%;">{_lang_msn}</label><input style="margin-bottom:2px;" name="msn" value="{msn}" /><br style="clear:both;" />
			<label style="float:left; width:35%;">{_lang_yahoo}</label><input style="margin-bottom:2px;" name="yahoo" value="{yahoo}" /><br style="clear:both;" />
			<label style="float:left; width:35%;">{_lang_aim}</label><input style="margin-bottom:2px;" name="aim" value="{aim}" /><br style="clear:both;" />
			<label style="float:left; width:35%;">{_lang_birthday}</label><input style="margin-bottom:2px;" name="gebdatum" value="{gebdatum}" /><font class="smalfont">{_lang_dateformat}</font><br style="clear:both;" />
			<label style="float:left; width:35%;">{_lang_state}</label><select style="margin-bottom:2px;" name="staat">{_list_staat@<option%1 value="%2">%3</option>}</select><br style="clear:both;" />
			<label style="float:left; width:35%;">{_lang_sex}</label><input style="margin-bottom:2px;" type="radio" value="1" id="geschlecht1" name="geschlecht" {geschlecht1} /><label for="geschlecht1"> {_lang_male}</label>, <input id="geschlecht2" type="radio" value="2" name="geschlecht" {geschlecht2} /><label for="geschlecht2"> {_lang_female}</label>, <input id="geschlecht0" type="radio" value="0" name="geschlecht" {geschlecht0} /><label for="geschlecht0"> {_lang_itdoesntmatter}</label><br style="clear:both;" />
			<label style="float:left; width:35%;">{_lang_status}</label><input id="status_aktiv" type="radio" value="1" name="status" {status1} /><label for="status_aktiv"> {_lang_active}</label>, <input id="status_inaktiv" type="radio" value="0" name="status" {status0} /><label for="status_inaktiv"> {_lang_inactive}</label><br style="clear:both;" />
			<label style="float:left; width:35%;">{_lang_mails}<span class="smalfont"> {_lang_fromotherusers}?</span></label><input id="opt_mail1" type="radio" value="1" name="opt_mail" {opt_mail1} /><label for="opt_mail1"> {_lang_yes}</label>, <input id="opt_mail0" type="radio" value="0" name="opt_mail" {opt_mail0} /><label for="opt_mail0"> {_lang_no}</label><br style="clear:both;" />
			<label style="float:left; width:35%;">{_lang_privatemessages}<span class="smalfont"> {_lang_fromotherusers}?</span></label><input id="opt_pm1" type="radio" value="1" name="opt_pm" {opt_pm1} /><label for="opt_pm1"> {_lang_yes}</label>, <input id="opt_pm0" type="radio" value="0" name="opt_pm" {opt_pm0} /><label for="opt_pm0"> {_lang_no}</label><br style="clear:both;" />
			<label style="float:left; width:35%;">{_lang_privatemessages}<span class="smalfont"> {_lang_popupbynewmsg}?</span></label><input id="opt_pm_popup1" type="radio" value="1" name="opt_pm_popup" {opt_pm_popup1} /><label for="opt_pm_popup1"> {_lang_yes}</label>, <input id="opt_pm_popup0" type="radio" value="0" name="opt_pm_popup" {opt_pm_popup0} /><label for="opt_pm_popup0"> {_lang_no}</label><br  style="fclear:both;" /><br />
			{_if_{forum_usergallery}=='1'}<div align="center">
                <a href="index.php?user-usergallery-{uid}">Usergallery</a>   <a href="index.php?user-remove"/></a>
            </div>{/_endif}<br />
            {EXPLODE}
      <fieldset>
      <legend>{_lang_removeaccount}</legend>
      <label style="float:left; width:35%;"> </label><input type="checkbox" value="yes" name="removeaccount" /> {_lang_delete}?   <font class="smalfont">{_lang_mustbeentered}</font>
      </fieldset>
      <fieldset>
			  <legend>{_lang_avatar}</legend>
			    <label style="float:left; width:35%;"> </label>{avatarbild}<input type="checkbox" value="yes" name="avatarloeschen" /> {_lang_delete}?<br /><br />
			    <label style="float:left; width:35%;"> </label><input style="margin-bottom:2px;" type="file" name="avatarfile" /><br /><font class="smalfont"><br />{_lang_criterions}: {_lang_maxwidth} {Fabreite}px, {_lang_maxheight} {Fahohe}px {_lang_and} max size {Fasize} bytes.  {_lang_otherwisenoaction}.</font><br />
			</fieldset>
			<br />
			{EXPLODE}
			<fieldset>
			  <legend>{_lang_signature}</legend>
			    <label style="float:left; width:35%;"><font class="smalfont">{_lang_max} {forum_max_sig} {_lang_signs}.</font></label><textarea style="margin-bottom:2px;" cols="60" rows="2" name="sig">{sig}</textarea><br />
			</fieldset>
			<br />
			<fieldset>
			  <legend>{_lang_editpassword}</legend>
			    <br />
			    <label style="float:left; width:35%;">{_lang_current}</label><input style="margin-bottom:2px;" type="password" name="op" maxlength="20"><br />
			    <label style="float:left; width:35%;">{_lang_new}</label><input style="margin-bottom:2px;" type="password" name="np1" maxlength="20"><br />
			    <label style="float:left; width:35%;">{_lang_repeat}</label><input style="margin-bottom:2px;" type="password" name="np2" maxlength="20"><br />
			</fieldset>
      <br />
      <fieldset>
        <br />
    {EXPLODE}
      </fieldset>
      <br />
      <div align="center">
      <input style="margin-bottom:2px;" type="submit" value="{_lang_send2}" name="submit">
      </div>
	</fieldset>
</form>


<?php
#   Copyright by: Manuel
#   Support: www.ilch.de


defined ('main') or die ( 'no direct access' );


$title = $allgAr['title'].' :: Users :: Profil';
$hmenu  = $extented_forum_menu.'<a class="smalfont" href="?user">Users</a><b> » </b> Profil'.$extented_forum_menu_sufix;
$design = new design ( $title , $hmenu, 1);



if ( $_SESSION['authright'] <= -1 ) {

    $csrfCheck = chk_antispam('user_profile_edit', true);
    
if ( empty ($_POST['submit']) || !$csrfCheck ) {
  $design->header();
	$abf = 'SELECT firstname,familyname,email,wohnort,homepage,aim,msn,icq,yahoo,avatar,status,staat,gebdatum,sig,opt_pm_popup,opt_pm,opt_mail,geschlecht,spezrank FROM `prefix_user` WHERE id = "'.$_SESSION['authid'].'"';
	$erg = db_query($abf);
	if ( db_num_rows($erg) > 0 ) {
	  $row = db_fetch_assoc($erg);

		$tpl = new tpl ('user/profil_edit');
		$row['staat'] = '<option></option>'.arliste ( $row['staat'] , get_nationality_array() , $tpl , 'staat' );
    $row['geschlecht0'] = ( $row['geschlecht'] < 1 ? 'checked' : '' );
    $row['geschlecht1'] = ( $row['geschlecht'] == 1 ? 'checked' : '' );
    $row['geschlecht2'] = ( $row['geschlecht'] == 2 ? 'checked' : '' );
    if ( $row['status'] == 1 ) { $row['status1'] = 'checked'; $row['status0'] = ''; } else { $row['status1'] = ''; $row['status0'] = 'checked'; }
    if ( $row['opt_mail'] == 1 ) { $row['opt_mail1'] = 'checked'; $row['opt_mail0'] = ''; } else { $row['opt_mail1'] = ''; $row['opt_mail0'] = 'checked'; }
    if ( $row['opt_pm'] == 1 ) { $row['opt_pm1'] = 'checked'; $row['opt_pm0'] = ''; } else { $row['opt_pm1'] = ''; $row['opt_pm0'] = 'checked'; }
    if ( $row['opt_pm_popup'] == 1 ) { $row['opt_pm_popup1'] = 'checked'; $row['opt_pm_popup0'] = ''; } else { $row['opt_pm_popup1'] = ''; $row['opt_pm_popup0'] = 'checked'; }

    $row['avatarbild'] = ( file_exists ( $row['avatar'] ) ? '<img src="'.$row['avatar'].'" alt=""><br />' : '' );
    $row['Fabreite'] = $allgAr['Fabreite'];
    $row['Fahohe'] = $allgAr['Fahohe'];
    $row['Fasize'] = $allgAr['Fasize'];
    $row['forum_max_sig'] = $allgAr['forum_max_sig'];
    $row['uid'] = $_SESSION['authid'];
    $row['forum_usergallery'] = $allgAr['forum_usergallery'];
    $row['antispam'] = get_antispam('user_profile_edit', 0, true);
    $tpl->set_ar_out($row,0);
    if ($allgAr['forum_avatar_upload']) $tpl->out(1);
    $tpl->set_ar_out($row,2);
		profilefields_change ( $_SESSION['authid'] );
		$tpl->out(3);

  } else {
    $tpl = new tpl ( 'user/login.htm' );
    $tpl->set_out('WDLINK','index.php',0);
	}

} elseif ($csrfCheck) {  # submit

  # change poassword
	if ( !empty($_POST['np1']) AND !empty($_POST['np2']) AND !empty($_POST['op'])) {
    if ($_POST['np1'] == $_POST['np2']) {
		  $akpw = db_result(db_query("SELECT pass FROM prefix_user WHERE id = ".$_SESSION['authid']),0);
			if (user_pw_check($_POST['op'], $akpw)) {
			  $newpw = user_pw_crypt($_POST['np1']);
				db_query("UPDATE prefix_user SET pass = '".$newpw."' WHERE id = ".$_SESSION['authid']);
                user_set_cookie($_SESSION['authid'], $newpw);
				$fmsg = $lang['passwortchanged'];
			} else {
		    $fmsg = $lang['passwortwrong'];
		  }
		} else {
		  $fmsg = $lang['passwortnotequal'];
	  }
  }

  # avatar speichern START
			$avatar_sql_update = '';
      if ( !empty ( $_FILES['avatarfile']['name'] ) AND $allgAr['forum_avatar_upload'] ) {
				$file_tmpe = $_FILES['avatarfile']['tmp_name'];
        $rile_type = ic_mime_type ($_FILES['avatarfile']['tmp_name']);
				$file_type = $_FILES['avatarfile']['type'];
				$file_size = $_FILES['avatarfile']['size'];
        $fmsg = $lang['avatarisnopicture'];
        $size  = @getimagesize ($file_tmpe);
        $endar = array (1 => 'gif', 2 => 'jpg', 3 => 'png');
				if ( ($size[2] == 1 OR $size[2] == 2 OR $size[2] == 3) AND $size[0] > 10 AND $size[1] > 10 AND substr ( $file_type , 0 , 6 ) == 'image/' AND substr ( $rile_type , 0 , 6 ) == 'image/' ) {
				  $endung = $endar[$size[2]];
          $breite = $size[0];
          $hoehe  = $size[1];
          $fmsg = $lang['avatarcannotupload'];
				  if ( $file_size <= $allgAr['Fasize'] AND $breite <= $allgAr['Fabreite'] AND $hoehe <=  $allgAr['Fahohe'] ) {
					  $neuer_name = 'include/images/avatars/'.$_SESSION['authid'].'.'.$endung;
						@unlink (db_result(db_query("SELECT avatar FROM prefix_user WHERE id = ".$_SESSION['authid']),0));
            move_uploaded_file ( $file_tmpe , $neuer_name );
            @chmod($neuer_name, 0777);
            $avatar_sql_update = "avatar = '".$neuer_name."',";
            $fmsg = $lang['pictureuploaded'];
					}
				}
			} elseif ( isset($_POST['avatarloeschen']) ) {
        $fmsg = $lang['picturedelete'];
        @unlink (db_result(db_query("SELECT avatar FROM prefix_user WHERE id = ".$_SESSION['authid']),0));
        $avatar_sql_update = "avatar = '',";
      }
  # avatar speichern ENDE


  # email aendern
  if ($_POST['email'] != $_POST['aemail']) {
    $id = $_SESSION['authid'].'||'.md5 (uniqid (rand()));
    db_query("INSERT INTO prefix_usercheck (`check`,email,datime,ak)
    VALUES ('".$id."','".escape($_POST['email'],'string')."',NOW(),3)");
    $page = $_SERVER["HTTP_HOST"].$_SERVER["SCRIPT_NAME"];
    $text = $lang['changedthemail'] . sprintf ($lang['registconfirmlink'], $page, $id );
    icmail ($_POST['email'], $lang['mail'].' '.$lang['changed'], $text );
    $fmsg = $lang['pleaseconfirmmail'];
  }
  #

  #remove account
  if (isset($_POST['removeaccount'])) {
    $id = $_SESSION['authid'].'-remove-'.md5 (uniqid (rand()));
    db_query("INSERT INTO prefix_usercheck (`check`,email,datime,ak)
    VALUES ('".$id."','".escape($_POST['email'],'string')."',NOW(),5)");
    $page = $_SERVER["HTTP_HOST"].$_SERVER["SCRIPT_NAME"];
    $text = $lang['removeconfirm'] . sprintf ($lang['registconfirmlink'], $page, $id );
    icmail ($_POST['email'], html_entity_decode($lang['removeaccount'], ILCH_ENTITIES_FLAGS, ILCH_CHARSET), $text );
    $fmsg = $lang['pleaseconfirmremove'];
  }
  #remove account


  # statische felder speichern
		  db_query("UPDATE prefix_user
			  SET
          firstname = '".escape($_POST['firstname'], 'string')."',
          familyname = '".escape($_POST['familyname'], 'string')."',
          homepage = '".get_homepage(escape($_POST['homepage'], 'string'))."',
          wohnort = '".escape($_POST['wohnort'], 'string')."',
          icq = '".escape($_POST['icq'], 'string')."',
          msn = '".escape($_POST['msn'], 'string')."',
          yahoo = '".escape($_POST['yahoo'], 'string')."',
          ".$avatar_sql_update."
          aim = '".escape($_POST['aim'], 'string')."',
          staat = '".escape($_POST['staat'], 'string')."',
          geschlecht = '".escape($_POST['geschlecht'], 'string')."',
          status = '".escape($_POST['status'], 'string')."',
          opt_mail = '".escape($_POST['opt_mail'], 'string')."',
          opt_pm = '".escape($_POST['opt_pm'], 'string')."',
          opt_pm_popup = '".escape($_POST['opt_pm_popup'], 'string')."',
          gebdatum = '".get_datum(escape($_POST['gebdatum'], 'string'))."',
          sig = '".substr(escape($_POST['sig'], 'string'),0,$allgAr['forum_max_sig'])."'
				WHERE id = ".$_SESSION['authid']
      );


	# change other profil fields

  profilefields_change_save ( $_SESSION['authid'] );
	$design->header();

	# definie and print msg
	$fmsg = ( isset($fmsg) ? $fmsg : $lang['changesuccessful'] );
	wd('?user-8' , $fmsg  , 3 );

}

} else {
		$tpl = new tpl ( 'user/login' );
		$tpl->set_out('WDLINK', '?user-8', 0);
}

$design->footer();
?>


Und zum Schluss ändern wir noch die Datei, welche es ermöglicht, dass eine noch nicht bestätigte Registrierung durch einen Admin freigeschalten werden kann.

<?php
#   Copyright by: Manuel
#   Support: www.ilch.de


defined ('main') or die ( 'no direct access' );
defined ('admin') or die ( 'only admin access' );

$design = new design ( 'Admins Area', 'Admins Area', 2 );
$design->header();

$tpl = new tpl ( 'puser', 1);

# add pending user
if($menu->get(1) == "confirm" AND isset($_GET['check'])){
  $erg = db_query("SELECT * FROM prefix_usercheck WHERE `check` = '".escape($_GET['check'], 'string')."'");
  if ( db_num_rows($erg) == 1 ) {
    $row = db_fetch_assoc($erg);
   	switch ( $row['ak'] ) {
    # confirm regist
    case 1 :
      if ( 0 == db_count_query("SELECT COUNT(*) FROM prefix_user WHERE name = BINARY '".$row['name']."'") ) {
  			db_query("INSERT INTO prefix_user (name,firstname,familyname,pass,recht,regist,llogin,email,status,opt_mail,opt_pm)
  			 VALUES('".$row['name']."','".$row['firstname']."','".$row['familyname']."','".$row['pass']."',-1,'".time()."','".time()."','".$row['email']."',1,1,1)");
   		  db_query("DELETE FROM prefix_usercheck WHERE `check` = '".escape($_GET['check'], 'string')."'");
      }else {
  			 $tpl->set_out('error','Username existiert bereits',3);
  		}
  		break;
    # confirm new pass
    case 2 :
      db_query("UPDATE prefix_user SET pass = '".$row['pass']."' WHERE name = BINARY '".$row['name']."'");
      db_query("DELETE FROM prefix_usercheck WHERE `check` = '".escape($_GET['check'], 'string')."'");
      break;

    # confirm new email
    case 3 :
      list ($id, $check) = explode('||', $row['check']);
      db_query("UPDATE prefix_user SET email = '".$row['email']."' WHERE id = ". escape($id, 'integer'));
		  db_query("DELETE FROM prefix_usercheck WHERE `check` = '".escape($_GET['check'], 'string')."'");
      break;
    # join us
    case 4 :
    	echo '<br />Joinus kann über diese Liste nicht akzeptiert werden, mache diese über <a style="color:red;" href="http://ilch11.dev/admin.php?groups-joinus">Joinus Anfragen bearbeiten</a><br /><br />';
      break;
	# ak 5 remove account
	case 5:
		list ($id, $muell) = explode('-remove-', $row['check']);
		if ($id == $_SESSION['authid']) {
			echo 'Der eigene Account ist auf diese Weise nicht löschbar.';
			break;
		}
		user_remove($id);
		db_query("DELETE FROM prefix_usercheck WHERE `check` = '".escape($_GET['check'], 'string')."'");
		break;
	}
  } else {
    $tpl->set_out('error','User nicht auffindbar',3);
  }
}

#remove pending user
if($menu->get(1) == "del" AND isset($_GET['check'])){
  db_query("DELETE FROM prefix_usercheck WHERE `check` = '".escape($_GET['check'], 'string')."'");
}


$tpl->out(0);
$ak=array('','neuer User','neues Passwort','neue Emailadresse','Join us','Account löschen');
$c = 0;
$erg = db_query("SELECT `check`, `name`, `email`, `ak`, date_format(datime,'%H:%i Uhr %m.%d.%Y') as time FROM `prefix_usercheck` ORDER by datime DESC");
while ($row = db_fetch_assoc($erg)) {
  if ($class == 'Cmite') { $class = 'Cnorm'; } else { $class = 'Cmite'; }
  $c++;
  $row['c']=$c;
  $row['class']= $class;
  if($row['ak']==3){
    list ($id, $check) = explode('||', $row['check']);
    $row['name']= @db_result(db_query("SELECT name FROM prefix_user WHERE id = ".$id),0);
  }
  $row['aktion'] = $ak[$row['ak']];
  $tpl->set_ar_out($row , 1);
}

$tpl->out(2);

$design->footer();
?>


So nun wurden alle Änderungen getätigt, so dass die beiden Felder von der Registrierung in die Usertabelle übertragen wurden und in den Userdetails angezeigt werden. Auch ist es mit den Änderungen möglich diese Felder nachträglich zu ändern.

Wer die Felder auch im Adminbereich unter User anzeigen und editieren möchte, braucht sich nur die Änderungen der Profiledit-Dateien anschauen, da hier das Prinzip der Anpassung gleich ist.

zuletzt geändert von Lord|Schirmer am Sa, 14. Jun 2014 - 12:38