51ff3226 |
1 | <?php |
2 | |
3 | function remove_users() { |
4 | global $permissions,$node,$db,$error; |
5 | $user_id=$_SESSION['user_id']; |
6 | $user_name=$_SESSION['user_name']; |
7 | |
e909f81b |
8 | require(INCLUDE_DIR."phpmailer.inc"); |
51ff3226 |
9 | $mail = new PHPMailer(); |
b6e35197 |
10 | $mail->IsSMTP(); // send via SMTP |
11 | $mail->Host = "molly.kyberia.cz"; // SMTP servers |
12 | $mail->From = "root@kyberia.cz"; |
13 | $mail->FromName = "kyberia.cz admin"; |
14 | $mail->WordWrap = 50; // set word wrap |
15 | $mail->Subject = "kyberia.cz neuspesna registracia"; |
51ff3226 |
16 | |
17 | |
18 | if (!$permissions['w']) { |
19 | $error="you don't have permissions for performing this event"; |
20 | return false; |
21 | } |
22 | |
23 | foreach ($_POST['waiting'] as $user =>$value) { |
24 | |
25 | $set=$db->query("select email,login,node_creator from users left join nodes on nodes.node_id=users.user_id where user_id='$user'"); |
26 | $set->next(); |
27 | $email=$set->getString('email'); |
28 | $login=$set->getString('login'); |
29 | |
30 | $application_id=$set->getString('node_creator'); |
31 | /* |
32 | $application=$db->query("select * from nodes where node_id='$application_id'"); |
33 | $application->next(); |
34 | $application_vector=$application->getString('node_vector').";".$application_id; |
35 | $application_parent=$application->getString('node_parent'); |
36 | $db->query("insert into nodes set node_created=NOW(),node_name='$login refused',node_vector='$application_vector',node_creator='$user_id',node_type='4',node_parent='$application_parent'"); |
37 | $id=$db->getLastInsertId(); |
38 | $db->query("insert into node_content set node_id='$id',node_content='user $login was refused by by $user_name'"); |
39 | */ |
40 | |
41 | $params['node_creator']=$user_id; |
42 | $params['node_parent']=$application_id; |
43 | $params['node_name']="$login refused"; |
44 | $params['node_content']="user $login was refused by $user_name"; |
45 | nodes::addNode($params); |
46 | |
47 | $db->query("delete from users where user_id='$user' and user_status='waiting'"); |
48 | $db->query("delete from nodes where node_id='$user' and node_type=7"); |
49 | $db->query("delete from node_content where node_id='$user'"); |
50 | |
51 | |
52 | |
53 | $mail->ClearAddresses(); |
54 | $mail->AddAddress($email); |
b6e35197 |
55 | $mail->AltBody = "bohuzial si nebol zaregistrovany na ".SYSTEM_URL.". ked chces skus znovu"; |
51ff3226 |
56 | if(!$mail->Send()) |
57 | { |
58 | $error="could not sent mail"; |
59 | return false; |
60 | } |
61 | |
62 | |
63 | } |
64 | return true; |
65 | } |
66 | ?> |