a726dd1c |
1 | <?php |
6314a12e |
2 | function verify(){ |
51ff3226 |
3 | |
4 | global $db; |
5 | $uvercode=mysql_real_escape_string($_POST['vc']); |
6 | $login=mysql_real_escape_string($_POST['login']); |
7 | |
8 | $kset=$db->query("select user_id from users where login='$login'"); |
9 | $kset->next();$userid=$kset->getString('user_id'); |
10 | |
383a2aea |
11 | $set=$db->query("select node_id from nodes where node_id='$userid' and node_parent=".UNVERIFIED_REGISTRATIONS_NODE); |
51ff3226 |
12 | if($set->getNumRows()!=1) { |
13 | global $error; |
14 | $error="User already verificated or invalid."; |
15 | return false; |
16 | } |
17 | |
18 | |
19 | $kset=$db->query("select hash from users where login='$login'"); |
20 | $kset->next();$vercode=$kset->getString('hash'); |
21 | |
22 | if($uvercode!=$vercode) { |
6314a12e |
23 | global $error; |
24 | $error="Wrong verification code or username"; |
25 | return false; |
26 | } else { |
c7ad1c0a |
27 | |
51ff3226 |
28 | // ouch!! this is gonna be dirty!!!!! will be revised later:-) |
ac3bdc72 |
29 | // XXX hardcoded, rewrite |
c7ad1c0a |
30 | |
8630d217 |
31 | $q="update nodes set node_parent=".REGISTRATION_REQUEST_NODE.", node_vector='000001010473807402091448$userid' where node_id='$userid'"; |
32 | $db->update($q); |
c7ad1c0a |
33 | |
34 | |
8630d217 |
35 | // $params['node_parent']=REGISTRATION_REQUEST_NODE; |
36 | // $params['node_id']=$userid; |
37 | // nodes::setParent($params); |
c7ad1c0a |
38 | |
39 | |
09f0f2fa |
40 | $q="update nodes set node_children_count=node_children_count+1 where node_id=".REGISTRATION_REQUEST_NODE; |
51ff3226 |
41 | $db->update($q); |
42 | $q="update nodes set node_created=NOW() where node_id='$userid'"; |
43 | $db->update($q); |
44 | $q="update nodes set node_system_access='public' where node_id='$userid'"; |
45 | $db->update($q); |
09f0f2fa |
46 | $q="update node_access set node_user_subchild_count=node_user_subchild_count+1 where node_id=".REGISTRATION_REQUEST_NODE; |
51ff3226 |
47 | $db->update($q); |
48 | |
49 | |
50 | // and now the happy news:-)) |
51ff3226 |
51 | echo "<center>Verification successfull.<br><h3>from now on your registration is in the hands of kyberians</h3></center>"; |
6314a12e |
52 | die(); |
51ff3226 |
53 | } |
6314a12e |
54 | |
51ff3226 |
55 | } |
ac3bdc72 |
56 | ?> |