Advertisement
Guest User

Untitled

a guest
Feb 4th, 2012
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.12 KB | None | 0 0
  1. <?php
  2.  
  3. ########################################
  4. # @Author Xenous(Lucas)
  5. # @Regards to Limez,XenoGFX &
  6. # @others who supported me during dev
  7. ########################################
  8.  
  9. define("XenCMS", true);
  10. if (!defined("XenCMS")) {
  11.  
  12. die ("404 Page not found");
  13. }
  14. # Class users, still to be finished. #
  15.  
  16. class xUsers {
  17.  
  18. # Checks if the name is allowed. #
  19.  
  20. private $invalidNames = array('xenous', 'mod', 'adm', 'moderator', 'administrator', 'staff', 'manage', 'admin', 'guest', 'lucas', 'l33t', 'owner');
  21.  
  22. # Checks if part of the name is not allowed. #
  23.  
  24. private $invalidNamesParts = array('xenous', 'staff', 'adm', 'mod', 'system');
  25.  
  26. # Check for user validity. #
  27.  
  28. public function xValName($user) {
  29.  
  30. if (strlen($user) >= 1 && strlen($user) <= 32 && ctype_alnum($user)) {
  31.  
  32. return true;
  33. }
  34. return die('Name is invalid');
  35. }
  36.  
  37. # Check for email vaidity. #
  38.  
  39. public function xValEmail($email) {
  40.  
  41. global $db;
  42. if ($db->xRows($db->xQuery("SELECT * FROM users WHERE mail = ' " . $email . " ' "))>0)
  43.  
  44. return true;
  45. return preg_match("/^[a-z0-9_\.-]+@([a-z0-9]+([\-]+[a-z0-9]+)*\.)+[a-z]{2,7}$/i", $email);
  46. }
  47.  
  48. # Checks if name is allowed. #
  49.  
  50. public function xNameBlocked($name) {
  51.  
  52. foreach ($this->invalidNames as $blocked) {
  53.  
  54. if(strtolower($name) !== strtolower($blocked)) {
  55. return true;
  56. }
  57. }
  58. foreach ($this->invalidNameParts as $blocked) {
  59.  
  60. if (strpos(strltolower($name), strtolower($blocked)) !== false) {
  61. return true;
  62. }
  63. }
  64. return die('The name ' . $name . ' is not allowed on this hotel');
  65. }
  66.  
  67. # Check Security Pin. #
  68.  
  69. public function checkSec($sec) {
  70.  
  71. if(strlen($sec) == 4 && ctype_digit($sec)) {
  72.  
  73. return true;
  74. }
  75. return die ('Your security key must be numerical and 4 digits long.');
  76. }
  77.  
  78. # Check for bans. #
  79.  
  80. /* public function xBanCheck($user) {
  81.  
  82. if(mysql_result(mysql_query("SELECT FROM bans WHERE value = ' " . $user . " ' ")),0) {
  83.  
  84. return true;
  85. }
  86. return false;
  87. }*/
  88.  
  89. # Add user. #
  90.  
  91. public function xAddUser($user, $pass, $email, $credits, $pixels, $motto, $look, $rank, $sec, $vip) {
  92.  
  93. return mysql_query("INSERT INTO users (`username`, `password`, `mail`, `credits`, `activity_points`, `look`, `gender`, `motto`, `rank`, `vip`, `xsec`, `ip_last`, `ip_reg`) VALUES (' " . $user . " ', ' " . $pass . " ', ' " . $email . " ', ' " . $credits . " ' , ' " . $pixels . " ' , ' " . $look . " ' , 'M', ' " . $motto . " ' , ' " . $rank . " ' , ' " .$vip . " ' , ' " . $sec . " ', ' " . $ip . " ', ' " .$ip . " ')");
  94. }
  95. }
  96. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement