Kyberia v2.0
[mirrors/Kyberia-bloodline.git] / inc / eventz / register.inc
1 <?php
2 /* This program is free software. It comes without any warranty, to
3 * the extent permitted by applicable law. You can redistribute it
4 * and/or modify it under the terms of the Do What The Fuck You Want
5 * To Public License, Version 2, as published by Sam Hocevar. See
6 * http://sam.zoy.org/wtfpl/COPYING for more details. */
7
8
9 function register() {
10
11 global $db,$error;
12 $error="kyberia.sk had shut down operations. we'll make a comeback";
13 return false;
14 $user_info=AddSlashes($_POST['user_info']);
15 $email=AddSlashes($_POST['email']);
16 $password1=$_POST['password1'];
17 $password2=$_POST['password2'];
18 $login=AddSlashes($_POST['login']);
19 $user_icq=AddSlashes($_POST['user_icq']);
20 $user_www=AddSlashes($_POST['user_www']);
21 $user_ad=$_POST['user_ad'];
22 $node_content=AddSlashes($_POST['user_info']);
23
24 $set=$db->query("select * from users where login='$login'");
25 if($set->getNumRows()>0) {
26 global $error;
27 $error="<br><br>CHYBA:: Uzivatel s podobnym loginom uz je zaregistrovany.";
28 return false;
29 }
30 elseif($password1!=$password2) {
31 global $error;
32 $error="<br><br>CHYBA:: Heslo a overovacie heslo niesu rovnake. Prosim skus znova.";
33 return false;
34 }
35 elseif(strlen($password1)<6) {
36 global $error;
37 $error="<br><br>CHYBA:: Heslo musi mat minimalne 6 znakov. Noze potrap mozocek.";
38 return false;
39 }
40 elseif(empty($user_info)) {
41 global $error;
42 $error="<br><br>CHYBA:: Prosim napis nieco o sebe.<br><br>";
43 return false;
44 }
45 elseif(empty($email)) {
46 global $error;
47 $error="<br><br>CHYBA:: Prosim zadaj svoj email.<br><br>";
48 return false;
49 }
50 elseif((strpos($email, '@') === false) || (strpos($email, '@') == '0') || (strpos($email, '@') >= (strlen($email) - 4))) {
51
52 global $error;
53 $error="<br><br>CHYBA:: Prosim zadaj korektny email.<br><br>";
54 return false;
55 }
56
57 $fplog = fopen("/tmp/keket.txt", "a");
58 fwrite($fplog, "\n$email\n");
59 fwrite($fplog, $_SERVER['REMOTE_ADDR'].' '.$_SERVER['X_FORWARDED_FOR']);
60 fclose($fplog);
61
62 if ($email == 'foobar@pisem.net') {
63 die();
64 }
65
66 if ($_SERVER['HTTP_HOST']=='www.slobodnavolba.sk') {
67 $vector=';1;103';
68 $parent='103';
69 }
70
71 elseif ($_SERVER['HTTP_HOST']=='www.hysteria.sk') {
72 $vector=';1;102';
73 $parent='102';
74 }
75
76 else {
77 $vector='';
78 $parent='';
79 }
80
81
82 if (!empty($_POST['cube_vector'])) {
83 $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'";
84 $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'");
85 $last_id=$db->getLastInsertId();
86 $db->query("insert into node_content set node_content='$node_content',node_id='$last_id'");
87
88 $q="INSERT INTO users set user_status='waiting',user_id='$last_id',login='$login'";
89 $node_content=nodes::processContent($user_info);
90 if (!empty($email)) $q.=", email='$email'";
91 $q.=",password='".md5($password1)."'";
92 if (!empty($user_icq)) $q.=", icq='$user_icq' ";
93 if (!empty($user_www)) $q.=", www='$user_www' ";
94 if (!empty($user_ad)) $q.=", user_ad='$user_ad' ";
95 $q.=",cube_vector='".$_POST['cube_vector']."'";
96 $db->query($q);
97 }
98
99 else {
100 $id=ubik::ubikRegister();
101 $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'";
102 $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'");
103 $last_id=$db->getLastInsertId();
104 $db->query("insert into node_content set node_content='$node_content',node_id='$last_id'");
105
106 $q="INSERT INTO users set user_status='waiting',user_id='$last_id',login='$login'";
107 $node_content=nodes::processContent($user_info);
108 if (!empty($email)) $q.=", email='$email'";
109 $q.=",password='".md5($password1)."'";
110 if (!empty($user_icq)) $q.=", icq='$user_icq' ";
111 if (!empty($user_www)) $q.=", www='$user_www' ";
112 if (!empty($user_ad)) $q.=", user_ad='$user_ad' ";
113 $db->query($q);
114
115 }
116
117 echo "<center><span class='most_important'>Registracia prebehla uspesne. Budete informovany e-mailom.</span>";
118 die();
119 }
120
121
122
123
124 ?>
This page took 0.288102 seconds and 4 git commands to generate.