6abf4bcfbba14ffde54a1a4c3d9628a0bfe9d471
[mirrors/Kyberia-bloodline.git] / wwwroot / inc / eventz / verify.inc
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
37 // $params['node_parent']=REGISTRATION_REQUEST_NODE;
38 // $params['node_id']=$userid;
39 // nodes::setParent($params);
40
41
42 $q="update nodes set node_children_count=node_children_count+1 where node_id=".REGISTRATION_REQUEST_NODE;
43 $db->update($q);
44 $q="update nodes set node_created=NOW() where node_id='$userid'";
45 $db->update($q);
46 $q="update nodes set node_system_access='public' where node_id='$userid'";
47 $db->update($q);
48 $q="update node_access set node_user_subchild_count=node_user_subchild_count+1 where node_id=".REGISTRATION_REQUEST_NODE;
49 $db->update($q);
50
51 nodes::putNode($userid,$guild_id,false);
52
53 // and now the happy news:-))
54 echo "<center>Verification successfull.<br><h3>from now on your registration is in the hands of kyberians</h3></center>";
55 die();
56 }
57
58
59
60 }
61 ?>
This page took 0.515042 seconds and 3 git commands to generate.