Commit | Line | Data |
---|---|---|
e586807d H |
1 | <?php |
2 | /* This program is free software. It comes without any warranty, to | |
3 | * the extent permitted by applicable law. You can redistribute it | |
4 | * and/or modify it under the terms of the Do What The Fuck You Want | |
5 | * To Public License, Version 2, as published by Sam Hocevar. See | |
6 | * http://sam.zoy.org/wtfpl/COPYING for more details. */ | |
7 | ||
8 | ||
9 | function register_users() { | |
10 | global $permissions,$node,$db,$error; | |
11 | $user_id=$_SESSION['user_id']; | |
12 | $user_name=$_SESSION['user_name']; | |
13 | $hello="ahoj, tymto ta vitam v systeme kyberia.sk. do systemu ta zaregistrovala moja malickost. v pripade ze budes mat akykolvek problem, kontaktuj ma prosim cez postu\n\nako prve by si mal navstivit forum <a href=\'/id/1017832\'><b><font color=yellow>Zaciname s kyberiou</font></b></a>\n\ntoto je automaticky vygenerovana sprava"; | |
14 | require(SYSTEM_ROOT."/inc/phpmailer.inc"); | |
15 | $mail = new PHPMailer(); | |
16 | $mail->IsSMTP(); // send via SMTP | |
17 | $mail->Host = "onyx.hysteria.sk"; // SMTP servers | |
18 | $mail->From = "admin@kyberia.sk"; | |
19 | $mail->FromName = "kyberia.sk admin"; | |
20 | $mail->WordWrap = 50; // set word wrap | |
21 | $mail->Subject = "kyberia.sk uspesna registracia"; | |
22 | ||
23 | ||
24 | if (!$permissions['w']) { | |
25 | $error="you don't have permissions for performing this event"; | |
26 | return false; | |
27 | } | |
28 | ||
29 | foreach ($_POST['waiting'] as $user =>$value) { | |
30 | $set=$db->query("select email,login,node_creator from users left join nodes on nodes.node_id=users.user_id where user_id='$user'"); | |
31 | $set->next(); | |
32 | $email=$set->getString('email'); | |
33 | $login=$set->getString('login'); | |
34 | ||
35 | $application_id=$set->getString('node_creator'); | |
36 | /* | |
37 | $application=$db->query("select * from nodes where node_id='$application_id'"); | |
38 | $application->next(); | |
39 | $application_vector=$application->getString('node_vector').";".$application_id; | |
40 | $application_parent=$application->getString('node_parent'); | |
41 | $db->query("insert into nodes set node_created=NOW(),node_name='$login registered',node_vector='$application_vector',node_creator='$user_id',node_type='4',node_parent='$application_parent'"); | |
42 | $id=$db->getLastInsertId(); | |
43 | $db->query("insert into node_content set node_id='$id',node_content='user $login successfully registered by $user_name'"); | |
44 | */ | |
45 | $params['node_creator']=$user_id; | |
46 | $params['node_parent']=$application_id; | |
47 | $params['node_name']="$login registered"; | |
48 | $params['node_content']="user $login successfully registered by $user_name"; | |
49 | nodes::addNode($params); | |
50 | ||
51 | $db->query("update users set user_status='newbie' where user_id='$user'"); | |
52 | $db->query("update nodes set node_creator=node_id where node_id='$user'"); | |
53 | $db->query("insert into mail set mail_user='$user',mail_to='$user',mail_from='$user_id',mail_text='$hello'"); | |
54 | $db->query("insert into mail set mail_user='$user_id',mail_to='$user',mail_from='$user_id',mail_text='$hello'"); | |
55 | $db->query("update users set user_mail='1',user_mail_name='$user_name' where user_id='$user'"); | |
56 | $mail->ClearAddresses(); | |
57 | $mail->AddAddress($email); // optional name | |
58 | $mail->AltBody = "bol si uspesne zaregistrovany do komunity kyberia.sk s loginom $login . njoy"; | |
59 | if(!$mail->Send()) | |
60 | { | |
61 | $error="could not sent mail"; | |
62 | return false; | |
63 | } | |
64 | ||
65 | } | |
66 | return true; | |
67 | } | |
68 | ?> |