From 7fe9f9f1b18134299ac2d0a7233f07d5910ebf87 Mon Sep 17 00:00:00 2001 From: niekt0 Date: Wed, 8 Dec 2010 02:06:59 +0100 Subject: [PATCH] Added register event --- wwwroot/inc/eventz/register.inc | 94 +++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 wwwroot/inc/eventz/register.inc diff --git a/wwwroot/inc/eventz/register.inc b/wwwroot/inc/eventz/register.inc new file mode 100644 index 0000000..9823487 --- /dev/null +++ b/wwwroot/inc/eventz/register.inc @@ -0,0 +1,94 @@ +query(sprintf('select login from users where + login = "%s" or email = "%s"', $login, $email)); + if ($set->getNumRows() > 0) { + $error = sprintf('No-no, user with this email is already registered'); + return false; + } + + // registration clause // XXX hard coded + $qr_rc = $db->query('select node_content from nodes where node_id = 791946'); + $qr_rc->next(); + + $params['node_content'] = sprintf('%s
%s
+ E-mail address:: %s', + $qr_rc->getString('node_content'), + $content, + $email); + // XXX hard-coded + $params['node_parent'] = 1836516; // registrations_noverified forum + $params['node_name'] = 'request for access'; + $params['flag'] = 'registration'; + $user_id = nodes::addNode($params); + $q = sprintf('update nodes set node_system_access = "private" where node_id = %d', $user_id); + $db->update($q); + + $pass = md5($pass); + $vercode = substr( md5( uniqid( rand() ) ), rand(0, 7), 23); + $q = sprintf('insert into users set password = "%s", user_id = %d, + header_id = 2091520, login = "%s", email = "%s", + hash = "%s"', + $pass, $user_id, $login, $email, $vercode); + $db->query($q); // XXX rewrite + $emailtext = sprintf( +'Vitaj %s! Prave som sa s radostou dozvedel, ze si vyplnil(a) +registracny formular na stranke kyberia.sk a chces sa stat +clenom tejto komunity. +Budem sa snazit urobit tento pokec trosku dlhsi, +lebo v povodnej kratkej forme ho pohlcuju spamfiltre, takze +ospravedln nasledujuce blabla a moj typicky atypicky zmysel +pre cierny humor, kedze sluzi ku dobrej veci :) +Pri registracii ti bol prideleny verifikacny kod. +Ten kod znie "%s" [bez uvodzoviek]. +Ten musis zadat na adresu https://kyberia.sk/id/1976899/, kde +vyplnis formular s tvojim nickom a verifkacnym kodom. +Od tej chvile bude tvoja ziadost volne pristupna +uz zaregistrovanym clenom, ktori o nej budu hlasovat. +Pocet hlasov aby sa ziadosti vyhovelo je 5. +Deadline na nazbieranie je 1 tyzden. +Takze fakticky dufam ze si o sebe napisal(a) nieco inteligentne :) + +Prajem pekny zvysok dna', + $login, $vercode); + // edit by br + $headers = 'From: kyberia@'. SYSTEM_URL . "\r\n" . 'X-Mailer: PHP'; + mail($email, SYSTEM_URL.' verification code', $emailtext, $headers); + $error = '

Request saved, verification code sent, please check your e-mail.

'; + + return false; +} +?> -- 2.30.2