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