Allow deletion of member accounts in profile
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
Add an offline inbox for members
|
||||
Allow deletion of member accounts in profile
|
||||
|
||||
Version 1.18 - Apr. 28, 2016
|
||||
Add time zone settings
|
||||
|
32
chat.php
32
chat.php
@ -98,8 +98,15 @@ function route(){
|
||||
}elseif($_REQUEST['action']==='profile'){
|
||||
check_session();
|
||||
$arg='';
|
||||
if(isSet($_REQUEST['do']) && $_REQUEST['do']==='save'){
|
||||
if(!isSet($_REQUEST['do'])){
|
||||
}elseif($_REQUEST['do']==='save'){
|
||||
$arg=save_profile();
|
||||
}elseif($_REQUEST['do']==='delete'){
|
||||
if(isSet($_REQUEST['confirm'])){
|
||||
delete_account();
|
||||
}else{
|
||||
send_delete_account();
|
||||
}
|
||||
}
|
||||
send_profile($arg);
|
||||
}elseif($_REQUEST['action']==='logout'){
|
||||
@ -785,6 +792,15 @@ function send_destroy_chat(){
|
||||
print_end();
|
||||
}
|
||||
|
||||
function send_delete_account(){
|
||||
global $H, $I;
|
||||
print_start('delete_account');
|
||||
echo "<table class=\"center-table\"><tr><td colspan=\"2\">$I[confirm]</td></tr><tr><td>";
|
||||
echo "<$H[form]>$H[commonform]".hidden('action', 'profile').hidden('do', 'delete').hidden('confirm', 'yes').submit($I['yes'], 'class="delbutton"').'</form></td><td>';
|
||||
echo "<$H[form]>$H[commonform]".hidden('action', 'profile').submit($I['no'], 'class="backbutton"').'</form></td><tr></table>';
|
||||
print_end();
|
||||
}
|
||||
|
||||
function send_init(){
|
||||
global $H, $I, $L;
|
||||
print_start('init');
|
||||
@ -1857,6 +1873,9 @@ function send_profile($arg=''){
|
||||
thr();
|
||||
}
|
||||
echo '<tr><td>'.submit($I['savechanges']).'</td></tr></table></form>';
|
||||
if($U['status']>1 && $U['status']<8){
|
||||
echo "<br><$H[form]>$H[commonform]".hidden('action', 'profile').hidden('do', 'delete').submit($I['deleteacc'], 'class="delbutton"').'</form>';
|
||||
}
|
||||
echo "<br><p>$I[changelang]";
|
||||
foreach($L as $lang=>$name){
|
||||
echo " <a href=\"$_SERVER[SCRIPT_NAME]?lang=$lang&session=$U[session]&action=controls\" target=\"controls\">$name</a>";
|
||||
@ -2393,6 +2412,17 @@ function read_members(){
|
||||
}
|
||||
}
|
||||
|
||||
function delete_account(){
|
||||
global $U, $db;
|
||||
if($U['status']<8){
|
||||
$stmt=$db->prepare('UPDATE ' . PREFIX . 'sessions SET status=1 WHERE nickname=?;');
|
||||
$stmt->execute(array($U['nickname']));
|
||||
$stmt=$db->prepare('DELETE FROM ' . PREFIX . 'members WHERE nickname=?;');
|
||||
$stmt->execute(array($U['nickname']));
|
||||
$U['status']=1;
|
||||
}
|
||||
}
|
||||
|
||||
function register_guest($status, $nick){
|
||||
global $A, $I, $P, $U, $db;
|
||||
if(!isSet($P[$nick])){
|
||||
|
@ -342,6 +342,7 @@ $T=array(
|
||||
'regednick' => 'Dieser Nickname ist ein registeriertes Mitglied.',
|
||||
'eninbox' => 'Offline Posteingang aktivieren',
|
||||
'inboxmsgs' => '%d Nachrichten im Posteingang lesen',
|
||||
'offline' => '(offline)'
|
||||
'offline' => '(offline)',
|
||||
'deleteacc' => 'Konto löschen'
|
||||
);
|
||||
?>
|
||||
|
@ -342,6 +342,7 @@ $I=array(
|
||||
'regednick' => 'This nickname is a registered member.',
|
||||
'eninbox' => 'Enable offline inbox',
|
||||
'inboxmsgs' => 'Read %d messages in your inbox',
|
||||
'offline' => '(offline)'
|
||||
'offline' => '(offline)',
|
||||
'deleteacc' => 'Delete account'
|
||||
);
|
||||
?>
|
||||
|
Reference in New Issue
Block a user