]> git.mxchange.org Git - friendica.git/blob - mod/removeme.php
Merge pull request #99 from tobiasd/master
[friendica.git] / mod / removeme.php
1 <?php
2
3 function removeme_post(&$a) {
4
5         if(! local_user())
6                 return;
7
8         if((! x($_POST,'qxz_password')) || (! strlen(trim($_POST['qxz_password']))))
9                 return;
10
11         if((! x($_POST,'verify')) || (! strlen(trim($_POST['verify']))))
12                 return;
13
14         if($_POST['verify'] !== $_SESSION['remove_account_verify'])
15                 return;
16
17         $encrypted = hash('whirlpool',trim($_POST['qxz_password']));
18
19         if((strlen($a->user['password'])) && ($encrypted === $a->user['password'])) {
20                 require_once('include/Contact.php');
21                 user_remove($a->user['uid']);
22                 // NOTREACHED
23         }
24
25 }
26
27
28
29 function removeme_content(&$a) {
30
31         if(! local_user())
32                 goaway($a->get_baseurl());
33
34         $hash = random_string();
35
36         $_SESSION['remove_account_verify'] = $hash;
37
38         $tpl = get_markup_template('removeme.tpl');
39         $o .= replace_macros($tpl, array(
40                 '$basedir' => $a->get_baseurl(),
41                 '$hash' => $hash,
42                 '$title' => t('Remove My Account'),
43                 '$desc' => t('This will completely remove your account. Once this has been done it is not recoverable.'),
44                 '$passwd' => t('Please enter your password for verification:'),
45                 '$submit' => t('Remove My Account')
46         ));
47
48         return $o;              
49
50 }