diff options
-rw-r--r-- | images/screenshot-0.0.20-thumb.png | bin | 53587 -> 0 bytes | |||
-rw-r--r-- | images/screenshot-thumb.png | bin | 0 -> 27639 bytes | |||
-rw-r--r-- | includes/common.php | 2 | ||||
-rw-r--r-- | includes/conf/mysql.conf.php | 14 | ||||
-rw-r--r-- | includes/libs/libstrutils.php | 18 | ||||
-rw-r--r-- | includes/models/account.php | 214 | ||||
-rw-r--r-- | registration.php | 2 |
7 files changed, 125 insertions, 125 deletions
diff --git a/images/screenshot-0.0.20-thumb.png b/images/screenshot-0.0.20-thumb.png Binary files differdeleted file mode 100644 index e1ef939..0000000 --- a/images/screenshot-0.0.20-thumb.png +++ /dev/null diff --git a/images/screenshot-thumb.png b/images/screenshot-thumb.png Binary files differnew file mode 100644 index 0000000..7574322 --- /dev/null +++ b/images/screenshot-thumb.png diff --git a/includes/common.php b/includes/common.php index 1e111a0..89b8494 100644 --- a/includes/common.php +++ b/includes/common.php @@ -68,7 +68,7 @@ function placeHeader($page_title) <div class="section_topright"> <div class="section_bottomright"> <div class="section" style="text-align: center;"> - <a href="http://wiki.themanaworld.org/index.php/Image:Tmw_0.0.20.png"><img src="images/screenshot-0.0.20-thumb.png" alt="screenshot" style="border: 1px solid #784f3f;"/></a> + <a href="http://wiki.themanaworld.org/index.php/Image:TMW_Screenshot_63.png"><img src="images/screenshot-thumb.png" alt="screenshot" style="border: 1px solid #784f3f;"/></a> <div style="text-align: center;"><a style="font-size: 7pt;" href="http://wiki.themanaworld.org/index.php/Screenshots">more screenshots</a></div> </div> </div> diff --git a/includes/conf/mysql.conf.php b/includes/conf/mysql.conf.php index 05122cd..d0122d5 100644 --- a/includes/conf/mysql.conf.php +++ b/includes/conf/mysql.conf.php @@ -1,8 +1,8 @@ -<?php
-
- $conf['mysql_hostname'] = "localhost";
- $conf['mysql_database'] = "test";
- $conf['mysql_username'] = "test";
- $conf['mysql_password'] = "test123";
-
+<?php + + $conf['mysql_hostname'] = "localhost"; + $conf['mysql_database'] = "test"; + $conf['mysql_username'] = "test"; + $conf['mysql_password'] = "test123"; + ?>
\ No newline at end of file diff --git a/includes/libs/libstrutils.php b/includes/libs/libstrutils.php index 9c097af..bc0896d 100644 --- a/includes/libs/libstrutils.php +++ b/includes/libs/libstrutils.php @@ -1,10 +1,10 @@ -<?php
-
- define("BAD_STRING_DESC", "Only printable characters (except spaces and \") are allowed.");
-
- function check_chars($string)
- {
- return ctype_graph($string) && (strpos($string, '"') === FALSE);
- }
-
+<?php + + define("BAD_STRING_DESC", "Only printable characters (except spaces and \") are allowed."); + + function check_chars($string) + { + return ctype_graph($string) && (strpos($string, '"') === FALSE); + } + ?>
\ No newline at end of file diff --git a/includes/models/account.php b/includes/models/account.php index 2d49ff2..ef253c6 100644 --- a/includes/models/account.php +++ b/includes/models/account.php @@ -1,114 +1,114 @@ -<?php
-
-require_once "includes/libs/libstrutils.php";
-
-class TMWAccount
-{
- const ACCOUNT_TBL = "tmw_accounts";
-
- const GENDER_MALE = 1;
- const GENDER_FEMALE = 2;
-
- const STATE_PENDING = 0;
- const STATE_CREATED = 0;
- const STATE_FAILED = 0;
-
- private $id;
- private $username;
- private $password;
- private $email;
- private $gender;
- private $state;
- private $registration;
-
- public static function getAccountCount()
- {
- $db = Database::getInstance();
- $sql = "SELECT COUNT(*) FROM " . TMWAccount::ACCOUNT_TBL;
- return $db->getValue( $sql );
- }
-
- public static function existsUsername($str)
- {
- $db = Database::getInstance();
- $sql = sprintf("SELECT COUNT(*) FROM " . TMWAccount::ACCOUNT_TBL .
- " WHERE USERNAME = '%s'", $db->escape($str));
- return ($db->getValue($sql) == 1);
- }
-
- public function setUsername($name){ $this->username = $name; }
- public function setPassword($pwd){ $this->password = $pwd; }
- public function setEMail($email){ $this->email = $email; }
- public function setGender($gender){ $this->gender = $gender; }
-
- public function validate()
- {
- $errors = array();
-
- // check here for correct values..
- if (strlen($this->username) < 4)
- $errors[] = "Username is too short";
-
- if (strlen($this->username) >= 24)
+<?php + +require_once "includes/libs/libstrutils.php"; + +class TMWAccount +{ + const ACCOUNT_TBL = "tmw_accounts"; + + const GENDER_MALE = 1; + const GENDER_FEMALE = 2; + + const STATE_PENDING = 0; + const STATE_CREATED = 0; + const STATE_FAILED = 0; + + private $id; + private $username; + private $password; + private $email; + private $gender; + private $state; + private $registration; + + public static function getAccountCount() + { + $db = Database::getInstance(); + $sql = "SELECT COUNT(*) FROM " . TMWAccount::ACCOUNT_TBL; + return $db->getValue( $sql ); + } + + public static function existsUsername($str) + { + $db = Database::getInstance(); + $sql = sprintf("SELECT COUNT(*) FROM " . TMWAccount::ACCOUNT_TBL . + " WHERE USERNAME = '%s'", $db->escape($str)); + return ($db->getValue($sql) == 1); + } + + public function setUsername($name){ $this->username = $name; } + public function setPassword($pwd){ $this->password = $pwd; } + public function setEMail($email){ $this->email = $email; } + public function setGender($gender){ $this->gender = $gender; } + + public function validate() + { + $errors = array(); + + // check here for correct values.. + if (strlen($this->username) < 4) + $errors[] = "Username is too short"; + + if (strlen($this->username) >= 24) $errors[] = "Username is too long"; -
- if (strlen($this->password) < 4)
- $errors[] = "Password is too short";
-
- if (strlen($this->password) >= 24)
+ + if (strlen($this->password) < 4) + $errors[] = "Password is too short"; + + if (strlen($this->password) >= 24) $errors[] = "Password is too long"; -
- if (strlen($this->email) < 4)
+ + if (strlen($this->email) < 4) $errors[] = "EMail is too short"; - if (strlen($this->email) >= 40)
+ if (strlen($this->email) >= 40) $errors[] = "EMail is too long"; - if (!check_chars($this->username))
- $errors[] = 'Username contains invalid characters. ' . BAD_STRING_DESC;
-
- if (!check_chars($this->password))
- $errors[] = 'Password contains invalid characters. ' . BAD_STRING_DESC;
-
- if ($this->gender != TMWAccount::GENDER_MALE &&
- $this->gender != TMWAccount::GENDER_FEMALE )
- {
- $errors[] = 'Gender has to be Male or Female!';
- }
-
- if (!filter_var($this->email, FILTER_VALIDATE_EMAIL))
- {
- $errors[] = 'EMail has wrong format.';
- }
-
-
- // returns true if everything is fine ( test with === true)
- if (count($errors) == 0)
- {
- return true;
- }
- else
- {
- return $errors;
- }
- }
-
-
-
- public function storeAccount()
- {
- $db = Database::getInstance();
- $sql = sprintf( "INSERT INTO " . TMWAccount::ACCOUNT_TBL .
- " (USERNAME, PASSWORD, EMAIL, GENDER) " .
- "VALUES ('%s', '%s', '%s', %d) ",
- $db->escape($this->username),
- $db->escape($this->password),
- $db->escape($this->email),
- $this->gender);
-
- $rows = $db->exec( $sql );
- return ( $rows == 1 );
- }
-}
-
+ if (!check_chars($this->username)) + $errors[] = 'Username contains invalid characters. ' . BAD_STRING_DESC; + + if (!check_chars($this->password)) + $errors[] = 'Password contains invalid characters. ' . BAD_STRING_DESC; + + if ($this->gender != TMWAccount::GENDER_MALE && + $this->gender != TMWAccount::GENDER_FEMALE ) + { + $errors[] = 'Gender has to be Male or Female!'; + } + + if (!filter_var($this->email, FILTER_VALIDATE_EMAIL)) + { + $errors[] = 'EMail has wrong format.'; + } + + + // returns true if everything is fine ( test with === true) + if (count($errors) == 0) + { + return true; + } + else + { + return $errors; + } + } + + + + public function storeAccount() + { + $db = Database::getInstance(); + $sql = sprintf( "INSERT INTO " . TMWAccount::ACCOUNT_TBL . + " (USERNAME, PASSWORD, EMAIL, GENDER) " . + "VALUES ('%s', '%s', '%s', %d) ", + $db->escape($this->username), + $db->escape($this->password), + $db->escape($this->email), + $this->gender); + + $rows = $db->exec( $sql ); + return ( $rows == 1 ); + } +} + ?> diff --git a/registration.php b/registration.php index ed7b528..9dda613 100644 --- a/registration.php +++ b/registration.php @@ -129,7 +129,7 @@ else { ?> - <p>Your account has been created and was scheduled for creation! In a few minutes you should receive an email with verification of your new account.</p> + <p>Your was scheduled for creation! In a few minutes you should receive an email with verification of your new account.</p> <?php } placeFooter(); ?> |