- Timestamp:
- Oct 13, 2008, 8:01:02 PM (16 years ago)
- Location:
- branches/3
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3
-
Property svn:ignore
set to
config.php
-
Property svn:ignore
set to
-
branches/3/class/database.php
r27 r28 19 19 { 20 20 $this->LastQuery = "SELECT ".$What." FROM `".$this->Prefix.$Table."` WHERE ".$Condition; 21 $count = $this->query($this->LastQuery);22 $count = $count->fetch_array();23 $this->Last_num_rows = count($count);24 21 return($this->query($this->LastQuery)); 25 22 } -
branches/3/class/user.php
r27 r28 4 4 { // BEGIN class User 5 5 // variables 6 var $ID,$ Permission, $user,$Database;6 var $ID,$user,$Database; 7 7 var $AnonymousUserId = 1; 8 var $DefaultRole = 1;8 var $DefaultRole = 2; 9 9 var $IPAddress = ' '; 10 10 … … 46 46 $this->user = $Query->fetch_array(); 47 47 $Result = USER_NOT_LOGGED; 48 $this->LoadPermission(1); 48 49 } 49 50 return $Result; 50 51 } 51 52 52 function Register($Dat e)53 function Register($Data) 53 54 { 54 55 global $Options; 55 if(($Dat e['Email'] == '') || ($Date['Nick'] == '') || ($Date['Password'] == '') || ($Date['Password2'] == '')) $Result = DATA_MISSING;56 else if($Dat e['Password'] != $Date['Password2']) $Result = PASSWORDS_UNMATCHED;56 if(($Data['Email'] == '') || ($Data['Nick'] == '') || ($Data['Password'] == '') || ($Data['Password2'] == '')) $Result = DATA_MISSING; 57 else if($Data['Password'] != $Data['Password2']) $Result = PASSWORDS_UNMATCHED; 57 58 else 58 59 { 59 60 // Je uživatel registrován? 60 $Query = $this->Database->select('User', '*', 'Name = "'.$Dat e['Nick'].'"');61 $Query = $this->Database->select('User', '*', 'Name = "'.$Data['Nick'].'"'); 61 62 if($this->Database->Last_num_rows > 0) $Result = NICK_USED; 62 63 else 63 64 { 64 $this->Database->insert('User', array('Name' => addslashes($Dat e['Nick']), 'FullName' => addslashes($Date['FullName']), 'Password' => addslashes($Date['Password']), 'Email' => htmlspecialchars($Date['Email']), 'Permission' => $this->DefaultRole, 'TranslationLanguage' => $Date['Language'], 'LastIpAddress' => $this->IPAddress, 'LastLoginTime' => 'NOW()'));65 $this->Database->insert('User', array('Name' => addslashes($Data['Nick']), 'FullName' => addslashes($Data['FullName']), 'Password' => addslashes($Data['Password']), 'Email' => htmlspecialchars($Data['Email']), 'Permission' => $this->DefaultRole, 'TranslationLanguage' => $Data['Language'], 'LastIpAddress' => $this->IPAddress, 'LastLoginTime' => 'NOW()')); 65 66 //echo $this->Database->LastQuery; 66 67 $Result = USER_REGISTRATED; … … 70 71 } 71 72 72 function Login($ Nick, $Password)73 function Login($Data) 73 74 { 74 75 $SID = session_id(); 75 76 // Je uživatel registrován? 76 $Query = $this->Database->select('User', '*', 'Name="'.$ Nick.'"');77 $Query = $this->Database->select('User', '*', 'Name="'.$Data['Nick'].'"'); 77 78 if($Query->num_rows > 0) 78 79 { 79 80 $Row = $Query->fetch_array(); 80 if($Row['Password'] != $ Password) $Result = BAD_PASSWORD;81 if($Row['Password'] != $Data['Password']) $Result = BAD_PASSWORD; 81 82 else 82 83 { 83 $this->Database->update('User', 'Id='.$Row['Id'], array('LastLoginTime' => 'NOW()' ));84 $this->Database->update('User', 'Id='.$Row['Id'], array('LastLoginTime' => 'NOW()', 'LastIpAddress' => $this->IPAddress)); 84 85 $this->Database->update('UserOnline', 'SessionId="'.$SID.'"', array('User' => $Row['Id'])); 85 86 // načtení stavu stromu 86 87 $Result = USER_LOGGED_IN; 88 $this->Check(); 87 89 } 88 90 } else $Result = USER_NOT_REGISTRED; 91 89 92 return($Result); 90 93 } … … 110 113 echo '<h2>'.REGISTRATION_PAGE_TITLE.'</h2> 111 114 <form action="" method="post"> 112 <table >115 <table cellspacing="0"> 113 116 <tr><td>'.REGISTRATION_PAGE_NAME.'</td><td><input name="Nick" type="text" /></td></tr> 114 117 <tr><td>'.REGISTRATION_PAGE_PASS.'</td><td><input name="Password" type="password" /></td></tr> … … 125 128 } 126 129 echo '</select></td></tr> 127 <tr><td></td><td ><inputvalue="'.REGISTRATION_PAGE_BUTTON.'" type="submit" /></td></tr>130 <tr><td></td><td align="right"><input name="Register" value="'.REGISTRATION_PAGE_BUTTON.'" type="submit" /></td></tr> 128 131 </table> 129 132 </form>'; 130 133 } // END function WriteRegistration 131 134 135 function WriteLogin() 136 { // BEGIN function WriteLogin 137 echo '<h2>'.LOGIN_PAGE_TITLE.'</h2> 138 <form action="" method="post"> 139 <table cellspacing="0"> 140 <tr><td>'.LOGIN_PAGE_NAME.'</td><td><input name="Nick" type="text" /></td></tr> 141 <tr><td>'.LOGIN_PAGE_PASS.'</td><td><input name="Password" type="password" /></td></tr> 142 <tr><td></td><td align="right"><input name="Login" value="'.LOGIN_PAGE_BUTTON.'" type="submit" /></td></tr> 143 </table> 144 </form>'; 145 } // END function WriteLogin 146 147 function Role() 148 { // BEGIN function State 149 return $this->user['Permission']['Title']; 150 } // END function State 151 152 function Permission() 153 { // BEGIN function Permission 154 return $this->user['Permission']['Id']; 155 } // END function Permission 156 132 157 } // END class User 133 158 -
branches/3/events.php
r27 r28 1 1 <?php 2 2 3 if (array_key_exists(' Email', $_POST)) {3 if (array_key_exists('Register', $_POST)) { 4 4 $Result = $user->Register($_POST); 5 5 } 6 if (array_key_exists('Login', $_POST)) { 7 $Result = $user->Login($_POST); 6 8 } 7 9 -
branches/3/functions.php
r27 r28 3 3 function ShowHeader() 4 4 { // BEGIN function ShowHeader 5 global $Config,$menu,$ User;6 echo '<?xml version="1.0" encoding="'.$Config['Charset'].'"? >5 global $Config,$menu,$user; 6 echo '<?xml version="1.0" encoding="'.$Config['Charset'].'"?'.'> 7 7 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 8 8 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> … … 30 30 31 31 echo '</ul>'; 32 if ($user->Permission() > 0) { 33 echo $user->Role(); 34 } else { 35 $user->WriteLogin(); 36 } 32 37 echo ' 33 38 </div> 34 39 </div> 35 40 '; 36 37 41 } // END function ShowHeader 38 42 -
branches/3/global.php
r27 r28 11 11 12 12 //include('error.php'); 13 $database = new Database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password'], $Config['Database']['Database']);13 $database = new database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password'], $Config['Database']['Database']); 14 14 $database->Prefix = $Config['Database']['Prefix']; 15 15 $database->charset($Config['Database']['Charset']); -
branches/3/language_cz.php
r27 r28 60 60 define('REGISTRATION_PAGE_TITLE', 'Registrace'); 61 61 62 define('LOGIN_PAGE_NAME', REGISTRATION_PAGE_NAME); 63 define('LOGIN_PAGE_PASS', REGISTRATION_PAGE_PASS); 64 define('LOGIN_PAGE_BUTTON', 'Přihlásit'); 65 define('LOGIN_PAGE_TITLE', ' '); 66 62 67 63 68 //menu -
branches/3/style.css
r27 r28 139 139 input, textarea, select { 140 140 background-color: #E8E8E8; 141 border: thin#c43300 solid;141 border: 1px #c43300 solid; 142 142 font-size: 11px; 143 143 font-family: Verdana, Arial, SunSans-Regular, Sans-Serif; … … 146 146 td,tr { 147 147 border-spacing: 0; 148 border: thin #c43300 solid; 148 border: 1px #c43300 solid; 149 padding: 0; 149 150 } 150 151 … … 152 153 margin: 10px; 153 154 border-spacing: 0; 154 border: thin #c43300 solid; 155 border: 1px #c43300 solid; 156 padding: 0; 155 157 }
Note:
See TracChangeset
for help on using the changeset viewer.