5 $guild_id = mysql_real_escape_string(strip_tags(trim($_POST['guild_id'])));
6 $content = mysql_real_escape_string(strip_tags(trim($_POST['reg_content'])));
7 $email = mysql_real_escape_string(strip_tags(trim($_POST['reg_email'])));
8 $login = mysql_real_escape_string(strip_tags(trim($_POST['reg_login'])));
9 $xmpp = mysql_real_escape_string(strtolower(strip_tags(trim($_POST['reg_login']))));
10 $pass = mysql_real_escape_string($_POST['reg_pass']);
11 $pass2 = mysql_real_escape_string($_POST['reg_pass2']);
14 $error = 'please enter your nick name';
17 elseif (empty($email)) {
18 $error = 'please enter your email address';
21 elseif (preg_match('/^(.+?)@(.+?)\.([a-z]{2,4})$/', $email) == false) {
22 $error = 'please enter correct mail';
25 elseif (empty($content)) {
26 $error = 'please write something about you';
29 elseif (strlen($pass) < 5) {
30 $error = 'password toooooooo short, (<5)';
33 elseif ($pass != $pass2) {
34 $error = 'passwords do not match';
38 $set = $db->query(sprintf('select login from users where
39 login = "%s" or email = "%s" or xmpp = "%s"', $login, $email, $xmpp));
40 if ($set->getNumRows() > 0) {
41 $error = sprintf('No-no, user with this nick/email is already registered');
45 // registration clause // XXX hard coded, registration text
46 $qr_rc = $db->query('select node_content from nodes where node_id = '.REGISTRATION_TEXT_NODE);
49 $params['node_content'] = sprintf('<i>%s</i><br />%s<br />
51 $qr_rc->getString('node_content'),
55 $params['node_parent'] = UNVERIFIED_REGISTRATIONS_NODE; // registrations_noverified forum
56 $params['node_name'] = 'request for access';
57 $params['flag'] = 'registration';
58 $user_id = nodes::addNode($params);
61 //puttin in the guild node is realized only after email verification
62 //nodes::putNode($user_id,$guild_id);
64 $q = sprintf('update nodes set node_system_access = "private" where node_id = %d', $user_id);
68 $vercode = substr( md5( uniqid( rand() ) ), rand(0, 7), 23);
69 $q = sprintf('insert into users set password = "%s", user_id = %d,
70 header_id = 2091520, login = "%s", email = "%s",
71 hash = "%s", xmpp="%s", guild_id="%s"',
72 $pass, $user_id, $login, $email, $vercode, $xmpp, $guild_id);
73 $db->query($q); // XXX rewrite
75 'Vitaj %s! Prave som sa s radostou dozvedel, ze si vyplnil(a)
76 registracny formular na stranke '.SYSTEM_URL.' a chces sa stat
77 clenom tejto komunity.
78 Budem sa snazit urobit tento pokec trosku dlhsi,
79 lebo v povodnej kratkej forme ho pohlcuju spamfiltre, takze
80 ospravedln nasledujuce blabla a moj typicky atypicky zmysel
81 pre cierny humor, kedze sluzi ku dobrej veci :)
82 Pri registracii ti bol prideleny verifikacny kod.
83 Ten kod znie "%s" [bez uvodzoviek].
84 Ten musis zadat na adresu '.SYSTEM_URL.'/id/1976899/, kde
85 vyplnis formular s tvojim nickom a verifkacnym kodom.
86 Od tej chvile bude tvoja ziadost volne pristupna
87 uz zaregistrovanym clenom, ktori o nej budu hlasovat.
88 Pocet hlasov aby sa ziadosti vyhovelo je x.
89 Deadline na nazbieranie je 1 tyzden.
90 Takze fakticky dufam ze si o sebe napisal(a) nieco inteligentne :)
92 Prajem pekny zvysok dna',
95 $headers = 'From: kyberia@'. SYSTEM_URL . "\r\n" . 'X-Mailer: PHP';
96 mail($email, SYSTEM_URL.' verification code', $emailtext, $headers);
97 $error = '<h2>Request saved, verification code sent, please check your e-mail.<h2>';