psql db schema test
[mirrors/Kyberia-bloodline.git] / cron / register.php
CommitLineData
ae9f7457 1#!/usr/bin/php
2
b42b2bf9 3<?php
a3be90c6 4/*
5 * Script that register new users who gaind enough K (votes)
5b9c0808 6 * Called once a day at 0:42
7 *
8 * TODO: ? call only function from eventz ?
8ab966c2 9 * remove sql code
10 * update texts & send mail
a3be90c6 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__, '/'));
17require($dir.'/../wwwroot/config/config.inc');
18
19require(INCLUDE_DIR.'/log.inc');
20require(INCLUDE_DIR.'/database.inc');
21require(INCLUDE_DIR.'/nodes.inc');
8ab966c2 22include_once(BACKEND_DIR.'/'.DB_TYPE.'/permissions.inc');
a3be90c6 23require(INCLUDE_DIR.'/ubik.inc');
ac6dff25 24//require(INCLUDE_DIR.'/senate.inc');
b42b2bf9
H
25
26//REGISTRATION_VOTES CONSTANT DEFINED IN INC/SENATE.INC
27define('REGISTER_TEXT','request for access');
b42b2bf9
H
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,
a3be90c6 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;
b42b2bf9
H
39
40$set=$db->query($q);
41
42while ($set->next()) {
78c3f2a8 43 $q="update users set header_id=0,hash='' where user_id=".$set->getString('node_id');
b42b2bf9
H
44 $db->update($q);
45 $login=$set->getString('login');
46 echo $login." registered\n";
a3be90c6 47 $db->update("update nodes set
48 template_id=7,
e4a5b5dc 49 external_link='db://user',
a3be90c6 50 node_name='$login'
51 where node_id=".$set->getString('node_id'));
b42b2bf9
H
52 $mail=$set->getString('email');
53 mail($mail,"kyberia gate is opened","Vitaj v kyberii");
54
f525e165 55 //VHODNE POSLAT ZACIATOCNIKOVI POSTU
56 // XXX undefined params FIX
57// ubik::ubikMail($params);
b42b2bf9
H
58}
59
a3be90c6 60?>
This page took 0.672352 seconds and 4 git commands to generate.