Trasovatelnejsi templaty
[mirrors/Kyberia-bloodline.git] / cron / register.php
1 #!/usr/bin/php
2
3 <?php
4 /*
5 * Script that register new users who gaind enough K (votes)
6 * Called once a day at 0:42
7 *
8 * TODO: ? call only function from eventz ?
9 * remove sql code
10 * update texts & send mail
11 */
12
13
14 // Use relative address of config file
15 // Change this, if you move you cron directory.
16 $dir=substr(__FILE__, 0, strrpos(__FILE__, '/'));
17 require($dir.'/../wwwroot/config/config.inc');
18
19 require(INCLUDE_DIR.'/log.inc');
20 require(INCLUDE_DIR.'/database.inc');
21 require(INCLUDE_DIR.'/nodes.inc');
22 include_once(BACKEND_DIR.'/'.DB_TYPE.'/permissions.inc');
23 require(INCLUDE_DIR.'/ubik.inc');
24 //require(INCLUDE_DIR.'/senate.inc');
25
26 //REGISTRATION_VOTES CONSTANT DEFINED IN INC/SENATE.INC
27 define('REGISTER_TEXT','request for access');
28
29 $_SESSION['user_id']=UBIK_ID;
30
31 $db=new CLASS_DATABASE();
32
33 $q="select users.login as persona,users.email as email,
34 k,node_id,node_creator,login from nodes
35 left join users on nodes.node_creator=users.user_id
36 where node_name like '".REGISTER_TEXT."%'
37 and node_parent=".REGISTRATION_REQUEST_NODE."
38 and k >=".REGISTRATION_VOTES;
39
40 $set=$db->query($q);
41
42 while ($set->next()) {
43 $q="update users set header_id=0,hash='' where user_id=".$set->getString('node_id');
44 $db->update($q);
45 $login=$set->getString('login');
46 echo $login." registered\n";
47 $db->update("update nodes set
48 template_id=7,
49 external_link='db://user',
50 node_name='$login'
51 where node_id=".$set->getString('node_id'));
52 $mail=$set->getString('email');
53 mail($mail,"kyberia gate is opened","Vitaj v kyberii");
54
55 //VHODNE POSLAT ZACIATOCNIKOVI POSTU
56 // XXX undefined params FIX
57 // ubik::ubikMail($params);
58 }
59
60 ?>
This page took 0.376129 seconds and 4 git commands to generate.