Migration to PDO database abstraction layer
[mirrors/Kyberia-bloodline.git] / wwwroot / inc / eventz / verify.inc
CommitLineData
a726dd1c 1<?php
6314a12e 2function verify(){
51ff3226 3
4global $db;
78f1a5f4
H
5$uvercode=db_escape_string($_POST['vc']);
6$login=db_escape_string($_POST['login']);
51ff3226 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 14if($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
24if($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 36nodes::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);
918e58f4 47nodes::putNode($userid,$guild_id,false);
51ff3226 48
49// and now the happy news:-))
51ff3226 50echo "<center>Verification successfull.<br><h3>from now on your registration is in the hands of kyberians</h3></center>";
6314a12e 51 die();
51ff3226 52}
6314a12e 53
918e58f4
DH
54
55
51ff3226 56}
ac3bdc72 57?>
This page took 0.338041 seconds and 4 git commands to generate.