Handle basic HTTP auth using PHP instead of using webserver configuration = better...
[mirrors/Kyberia-bloodline.git] / data / templates / own_templates / 1961063.tpl
1 function register() {
2
3 global $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'");
12 if($set->getNumRows()>0) {
13 global $error;
14 $error="user with $login already registered";
15 return false;
16 }
17 elseif($password1!=$password2) {
18 global $error;
19 $error="passwords do not match";
20 return false;
21 }
22 elseif(strlen($password1)<6) {
23 global $error;
24 $error="password too short";
25 return false;
26 }
27 elseif(empty($user_info)) {
28 global $error;
29 $error="please write something about Thee";
30 return false;
31 }
32 elseif(empty($email)) {
33 global $error;
34 $error="please enter your email address";
35 return false;
36 }
37 elseif((strpos($email, '@') === false) || (strpos($email, '@') == '0') || (strpos($email, '@') >= (strlen($email) - 4))) {
38
39 global $error;
40 $error="please enter correct mail";
41 return false;
42 }
43 /*
44 if (!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);
52 if (!empty($email)) $q.=", email='$email'";
53 $q.=",password='".md5($password1)."'";
54 if (!empty($user_icq)) $q.=", icq='$user_icq' ";
55 if (!empty($user_www)) $q.=", www='$user_www' ";
56 if (!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',
64 node_external_access='yes',node_system_access='public',
65 node_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);
71 if (!empty($email)) $q.=", email='$email'";
72 $q.=",password='".md5($password1)."'";
73 $db->query($q);
74
75
76
77
78 echo "<p>Access granted.</p>";
79 die();
80 }
81
82
83
84
85 ?>
86
This page took 0.572889 seconds and 4 git commands to generate.