Anihilating constans
[mirrors/Kyberia-bloodline.git] / wwwroot / inc / eventz / verify.inc
CommitLineData
a726dd1c 1<?php
6314a12e 2function verify(){
51ff3226 3
4global $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
4b313ce7 11// XXX HARD CODED
09f0f2fa 12$set=$db->query("select * from nodes where node_id='$userid' and node_parent=".UNVERIFIED_REGISTRATIONS_NODE);
51ff3226 13if($set->getNumRows()!=1) {
14 global $error;
15 $error="User already verificated or invalid.";
16 return false;
17}
18
19
20$kset=$db->query("select hash from users where login='$login'");
21$kset->next();$vercode=$kset->getString('hash');
22
23if($uvercode!=$vercode) {
6314a12e 24 global $error;
25 $error="Wrong verification code or username";
26 return false;
27} else {
51ff3226 28// ouch!! this is gonna be dirty!!!!! will be revised later:-)
ac3bdc72 29// XXX hardcoded, rewrite
09f0f2fa 30$q="update nodes set node_parent=".REGISTRATION_REQUEST_NODE.", node_vector='0000010120914480$userid' where node_id='$userid'";
51ff3226 31$db->update($q);
09f0f2fa 32$q="update nodes set node_children_count=node_children_count+1 where node_id=".REGISTRATION_REQUEST_NODE;
51ff3226 33$db->update($q);
34$q="update nodes set node_created=NOW() where node_id='$userid'";
35$db->update($q);
36$q="update nodes set node_system_access='public' where node_id='$userid'";
37$db->update($q);
09f0f2fa 38$q="update node_access set node_user_subchild_count=node_user_subchild_count+1 where node_id=".REGISTRATION_REQUEST_NODE;
51ff3226 39$db->update($q);
40
41
42// and now the happy news:-))
51ff3226 43echo "<center>Verification successfull.<br><h3>from now on your registration is in the hands of kyberians</h3></center>";
6314a12e 44 die();
51ff3226 45}
6314a12e 46
51ff3226 47}
ac3bdc72 48?>
This page took 0.316967 seconds and 4 git commands to generate.