Handle basic HTTP auth using PHP instead of using webserver configuration = better...
[mirrors/Kyberia-bloodline.git] / data / templates / own_templates / 1961063.tpl
CommitLineData
51ff3226 1function register() {
2
3global $db,$error;
4$user_info=AddSlashes($_POST['user_info']);
5$email=AddSlashes($_POST['email']);
6$password1=$_POST['password1'];
7$password2=$_POST['password2'];
8$login=AddSlashes($_POST['login']);
9$node_content=AddSlashes($_POST['user_info']);
10
11$set=$db->query("select * from users where login='$login'");
12if($set->getNumRows()>0) {
13global $error;
14$error="user with $login already registered";
15return false;
16}
17elseif($password1!=$password2) {
18global $error;
19$error="passwords do not match";
20return false;
21}
22elseif(strlen($password1)<6) {
23global $error;
24$error="password too short";
25return false;
26}
27elseif(empty($user_info)) {
28global $error;
29$error="please write something about Thee";
30return false;
31}
32elseif(empty($email)) {
33global $error;
34$error="please enter your email address";
35return false;
36}
37elseif((strpos($email, '@') === false) || (strpos($email, '@') == '0') || (strpos($email, '@') >= (strlen($email) - 4))) {
38
39global $error;
40$error="please enter correct mail";
41return false;
42}
43/*
44if (!empty($_POST['cube_vector'])) {
45$q = "insert into nodes set external_link='db://user',node_creator='$id',node_name='$login',node_external_access='yes',node_system_access='public',node_parent='$parent',node_vector='$vector', template_id='7'";
46$db->query("insert into nodes set external_link='db://user',node_creator='$id',node_name='$login',node_external_access='yes',node_system_access='public',node_parent='$parent',node_vector='$vector', template_id='7'");
47$last_id=$db->getLastInsertId();
48$db->query("insert into node_content set node_content='$node_content',node_id='$last_id'");
49
50$q="INSERT INTO users set user_status='waiting',user_id='$last_id',login='$login'";
51$node_content=nodes::processContent($user_info);
52if (!empty($email)) $q.=", email='$email'";
53$q.=",password='".md5($password1)."'";
54if (!empty($user_icq)) $q.=", icq='$user_icq' ";
55if (!empty($user_www)) $q.=", www='$user_www' ";
56if (!empty($user_ad)) $q.=", user_ad='$user_ad' ";
57$q.=",cube_vector='".$_POST['cube_vector']."'";
58$db->query($q);
59}
60
61*/
62$id=ubik::ubikRegister();
63$db->query("insert into nodes set external_link='db://user',node_name='$login',
64node_external_access='yes',node_system_access='public',
65node_parent='$parent',node_vector='$vector', template_id='7'");
66$last_id=$db->getLastInsertId();
67$db->query("insert into node_content set node_content='$node_content',node_id='$last_id'");
68$db->query("update nodes set node_creator='$last_id' where node_id='$last_id'");
69$q="INSERT INTO users set user_id='$last_id',login='$login'";
70$node_content=nodes::processContent($user_info);
71if (!empty($email)) $q.=", email='$email'";
72$q.=",password='".md5($password1)."'";
73$db->query($q);
74
75
76
77
78echo "<p>Access granted.</p>";
79die();
80}
81
82
83
84
85?>
86
This page took 0.673171 seconds and 4 git commands to generate.