Commit | Line | Data |
---|---|---|
bc13d5d6 | 1 | <?php |
e586807d H |
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 | ||
bc13d5d6 H |
8 | |
9 | switch ($_POST['event']) { | |
e586807d H |
10 | case 'register': |
11 | $status=register(); | |
12 | if($status) { | |
13 | echo $status; | |
14 | die(); | |
15 | } | |
16 | else echo "<center><b><font color='red'>$error</font></b></center>"; | |
17 | break; | |
bc13d5d6 H |
18 | |
19 | ||
20 | } | |
21 | ||
bc13d5d6 | 22 | function register() { |
e586807d H |
23 | global $db; |
24 | $user_info=AddSlashes($_POST['user_info']); | |
25 | $email=$_POST['email']; | |
26 | $password1=$_POST['password1']; | |
27 | $password2=$_POST['password2']; | |
28 | $login=$_POST['login']; | |
29 | $user_icq=$_POST['user_icq']; | |
30 | $user_www=$_POST['user_www']; | |
31 | $user_ad=$_POST['user_ad']; | |
32 | $set=$db->query("select * from users where login='$login'"); | |
33 | if($set->getNumRows()>0) { | |
34 | global $error; | |
35 | $error="<br><br>CHYBA:: Uzivatel s podobnym loginom uz je zaregistrovany."; | |
36 | return false; | |
37 | } | |
38 | elseif($password1!=$password2) { | |
39 | global $error; | |
40 | $error="<br><br>CHYBA:: Heslo a overovacie heslo niesu rovnake. Prosim skus znova."; | |
41 | return false; | |
42 | } | |
43 | elseif(strlen($password1)<6) { | |
44 | global $error; | |
45 | $error="<br><br>CHYBA:: Heslo musi mat minimalne 6 znakov. Noze potrap mozocek."; | |
46 | return false; | |
47 | } | |
48 | elseif(empty($user_info)) { | |
49 | global $error; | |
50 | $error="<br><br>CHYBA:: Prosim napis nieco o sebe.<br><br>"; | |
51 | return false; | |
52 | } | |
53 | elseif(empty($email)) { | |
54 | global $error; | |
55 | $error="<br><br>CHYBA:: Prosim zadaj svoj email.<br><br>"; | |
56 | return false; | |
57 | } | |
58 | elseif((strpos($email, '@') === false) || (strpos($email, '@') == '0') || (strpos($email, '@') >= (strlen($email) - 4))) { | |
59 | ||
60 | global $error; | |
61 | $error="<br><br>CHYBA:: Prosim zadaj korektny email.<br><br>"; | |
62 | return false; | |
63 | } | |
64 | ||
65 | $db->query("insert into nodes set node_name='$login',node_external_access='yes',node_system_access='public',node_type='7',node_parent='1',node_vector=';1'"); | |
66 | $last_id=$db->getLastInsertId(); | |
67 | $db->query("insert into node_content set node_content='$node_content',node_id='$last_id'"); | |
68 | ||
69 | $q="INSERT INTO users set user_id='$last_id', user_status='ban',login='$login'"; | |
70 | $node_content=nodes::processContent($user_info); | |
71 | if (!empty($email)) $q.=", email='$email'"; | |
72 | $q.=",password='".md5($password1)."'"; | |
73 | if (!empty($user_icq)) $q.=", icq='$user_icq' "; | |
74 | if (!empty($user_www)) $q.=", www='$user_www' "; | |
75 | if (!empty($user_ad)) $q.=", user_ad='$user_ad' "; | |
76 | $db->query($q); | |
77 | ||
78 | // $db->ubikRegister($login,$email,$user_www,$user_info,$last_id,$otazka_1,$otazka_2,$otazka_3); | |
79 | return "<center><span class='most_important'>Registracia prebehla uspesne</span><br><a href='/'>Return to main page</a>"; | |
bc13d5d6 H |
80 | } |
81 | ||
e586807d H |
82 | |
83 | ||
84 | ||
85 | ?> |