| 1 | <?php |
| 2 | function verify(){ |
| 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,guild_id from users where login='$login'"); |
| 9 | $kset->next(); |
| 10 | $userid=$kset->getString('user_id'); |
| 11 | $guild_id=$kset->getString('guild_id'); |
| 12 | |
| 13 | $set=$db->query("select node_id from nodes where node_id='$userid' and node_parent=".UNVERIFIED_REGISTRATIONS_NODE); |
| 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) { |
| 25 | global $error; |
| 26 | $error="Wrong verification code or username"; |
| 27 | return false; |
| 28 | } else { |
| 29 | |
| 30 | // ouch!! this is gonna be dirty!!!!! will be revised later:-) |
| 31 | // XXX hardcoded, rewrite |
| 32 | |
| 33 | //$q="update nodes set node_parent=".REGISTRATION_REQUEST_NODE.", node_vector='000001010473807402091448$userid' where node_id='$userid'"; |
| 34 | //$db->update($q); |
| 35 | |
| 36 | nodes::setParent($userid,REGISTRATION_REQUEST_NODE); |
| 37 | |
| 38 | |
| 39 | $q="update nodes set node_children_count=node_children_count+1 where node_id=".REGISTRATION_REQUEST_NODE; |
| 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); |
| 45 | $q="update node_access set node_user_subchild_count=node_user_subchild_count+1 where node_id=".REGISTRATION_REQUEST_NODE; |
| 46 | $db->update($q); |
| 47 | |
| 48 | nodes::putNode($userid,$guild_id,false); |
| 49 | |
| 50 | // and now the happy news:-)) |
| 51 | echo "<center>Verification successfull.<br><h3>from now on your registration is in the hands of kyberians</h3></center>"; |
| 52 | die(); |
| 53 | } |
| 54 | |
| 55 | |
| 56 | |
| 57 | } |
| 58 | ?> |