source: trunk/pages/registrace.php

Last change on this file was 693, checked in by george, 15 years ago
  • Opraveny: Další odkazy na stránky.
File size: 3.8 KB
Line 
1<?php
2
3include('inc/registration_limit.php');
4
5$RegistrationLimit = new RegistrationLimit($db, $server, $Config);
6
7function sha_password($account, $password)
8{
9 $account = strtoupper($account);
10 $password = strtoupper($password);
11 return(sha1($account.':'.$password));
12}
13
14if(array_key_exists('account', $_POST)) $account = $_POST['account']; else $account = '';
15if(array_key_exists('heslo1', $_POST)) $password1 = $_POST['heslo1']; else $password1 = '';
16if(array_key_exists('heslo2', $_POST)) $password2 = $_POST['heslo2']; else $password2 = '';
17if(array_key_exists('email', $_POST)) $email = $_POST['email']; else $email = '';
18if(array_key_exists('expansion', $_POST)) $expansion = $_POST['expansion']; else $expansion = '';
19if(array_key_exists('agree', $_POST)) $agree = $_POST['agree']; else $agree = '';
20
21echo('<div style="margin-left:auto; margin-right:auto; text-align:center; align: center;">'.
22 '<div style="margin-left:auto; margin-right:auto; text-align:center; align: center;">'.
23 '<img style="align: center" src="'.$html->Link('/imgs/logoreg.png').'" alt="logo" /></div>'.
24 '<form method="post" action="?">'.
25 '<table style="margin-left:auto; margin-right:auto; text-align:center;">'.
26 '<tr><td>Účet:</td><td><input type="text" name="account" value="'.$account.'" class="textinput"/></td></tr>'.
27 '<tr><td>Heslo:</td><td><input type="password" name="heslo1" value="'.$password1.'" class="textinput"/></td></tr>'.
28 '<tr><td>Heslo znovu:</td><td><input type="password" name="heslo2" value="'.$password2.'" class="textinput"/></td></tr>'.
29 '<tr><td>Email:</td><td><input type="text" name="email" value="'.$email.'" class="textinput"/></td></tr>'.
30 '<tr><td>Typ účtu:</td><td><select name="expansion" value="'.$expansion.'">'.
31 '<option value="">-- vyber typ účtu --</option>'.
32 '<option value="0">Klasický</option>'.
33 '<option value="1">Rozšíření TBC</option>'.
34 '<option value="2">Rozšíření WoTLK</option>'.
35 '</select></td></tr>'.
36 '<tr><td>Pravidla <a href="'.$Config['Web']['BaseURL'].'forum/viewtopic.php?f=11&amp;t=2066">ČTI</a></td><td>Souhlasím <input type="checkbox" name="agree" value="on" /></td><td></td></tr>'.
37 '<tr><td></td><td><input type="submit" value="Registrovat" /></td></tr></table>'.
38 '</form>'.
39 '<br />');
40
41//if($RegistrationLimit->GetFreeRegistrationCount() == 0)
42//{
43// echo('<div class="h10">Registrace pro dnešní den vyčerpány</div>');
44// echo('<div class="h10">Dnes bylo '.$RegistrationLimit->GetPerDeyRegistrationCount().' volných registrací</div>');
45//} else
46{
47 //echo('<div class="h11">Pro tento den je povoleno '.$RegistrationLimit->GetPerDeyRegistrationCount().' volných registrací</div>');
48 //echo('<div class="h11">Zbývá ještě '.$RegistrationLimit->GetFreeRegistrationCount().' volných registrací</div>');
49 echo('<br />');
50
51 if(($account == '') or ($password1 == '') or ($password2 == '') or ($email == '') or ($expansion == '') or ($agree == ''))
52 {
53 echo('<div class="h10">Je nutno vyplnit všechny údaje</div>');
54 } else
55 {
56 if($password1 != $password2) echo('Zadaná hesla se neshodují');
57 else
58 {
59 $password = $password1;
60 $account = strtoupper($account);
61 $heslo = sha_password($account, $password);
62
63 $db->select_db($Config['Mangos']['DatabaseRealmd']);
64 $DbResult = $db->query('SELECT `id`, `username`, `sha_pass_hash` FROM `account` WHERE `username`="'.$account.'"');
65 if($DbResult->num_rows > 0)
66 {
67 echo('<div class="h10">Účet již existuje</div>');
68 } else
69 {
70 $DbResult = $db->query('INSERT INTO `account` (`username`,`sha_pass_hash`,`email`,`expansion`) values ("'.$account.'","'.$heslo.'","'.$email.'","'.$expansion.'")');
71 echo('<div class="h10">Účet '.$account.' byl vytvořen!</div>');
72 }
73 }
74 }
75}
76echo('</div><p></p>');
77
78?>
Note: See TracBrowser for help on using the repository browser.