Commit | Line | Data |
---|---|---|
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 | ||
918e58f4 DH |
8 | $kset=$db->query("select user_id,guild_id from users where login='$login'"); |
9 | $kset->next(); | |
10 | $userid=$kset->getString('user_id'); | |
11 | $guild_id=$kset->getString('guild_id'); | |
51ff3226 | 12 | |
383a2aea | 13 | $set=$db->query("select node_id from nodes where node_id='$userid' and node_parent=".UNVERIFIED_REGISTRATIONS_NODE); |
51ff3226 | 14 | if($set->getNumRows()!=1) { |
15 | global $error; | |
16 | $error="User already verificated or invalid."; | |
17 | return false; | |
18 | } | |
19 | ||
20 | ||
21 | $kset=$db->query("select hash from users where login='$login'"); | |
22 | $kset->next();$vercode=$kset->getString('hash'); | |
23 | ||
24 | if($uvercode!=$vercode) { | |
6314a12e | 25 | global $error; |
26 | $error="Wrong verification code or username"; | |
27 | return false; | |
28 | } else { | |
c7ad1c0a | 29 | |
51ff3226 | 30 | // ouch!! this is gonna be dirty!!!!! will be revised later:-) |
ac3bdc72 | 31 | // XXX hardcoded, rewrite |
c7ad1c0a | 32 | |
4c113a6b | 33 | //$q="update nodes set node_parent=".REGISTRATION_REQUEST_NODE.", node_vector='000001010473807402091448$userid' where node_id='$userid'"; |
34 | //$db->update($q); | |
c7ad1c0a | 35 | |
4c113a6b | 36 | nodes::setParent($userid,REGISTRATION_REQUEST_NODE); |
c7ad1c0a | 37 | |
38 | ||
09f0f2fa | 39 | $q="update nodes set node_children_count=node_children_count+1 where node_id=".REGISTRATION_REQUEST_NODE; |
51ff3226 | 40 | $db->update($q); |
41 | $q="update nodes set node_created=NOW() where node_id='$userid'"; | |
42 | $db->update($q); | |
43 | $q="update nodes set node_system_access='public' where node_id='$userid'"; | |
44 | $db->update($q); | |
09f0f2fa | 45 | $q="update node_access set node_user_subchild_count=node_user_subchild_count+1 where node_id=".REGISTRATION_REQUEST_NODE; |
51ff3226 | 46 | $db->update($q); |
47 | ||
918e58f4 | 48 | nodes::putNode($userid,$guild_id,false); |
51ff3226 | 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 | |
918e58f4 DH |
55 | |
56 | ||
51ff3226 | 57 | } |
ac3bdc72 | 58 | ?> |