diff --git a/assets/config/database.php b/assets/config/database.php index aff7676a..58550cff 100644 --- a/assets/config/database.php +++ b/assets/config/database.php @@ -1,9 +1,9 @@ +$mysqli = new MySQLi($host['hostname'], $host['user'], $host['password'], $host['database']); diff --git a/assets/config/funcs.php b/assets/config/funcs.php index 1cd4fc6b..569fc2bc 100644 --- a/assets/config/funcs.php +++ b/assets/config/funcs.php @@ -1,128 +1,136 @@ 1) ? 1 : $position; - if ($position === 1) { - $end = substr($str, 0, -($max_length - strlen($beg))); - } - else { - $end = substr($str, -($max_length - strlen($beg))); - } - return $beg.$ellipsis.$end; +function ellipsize($str, $max_length, $position = 1, $ellipsis = '…') +{ + // Strip tags + $str = trim(strip_tags($str)); + // Is the string long enough to ellipsize? + if (strlen($str) <= $max_length) { + return $str; + } + $beg = substr($str, 0, floor($max_length * $position)); + $position = ($position > 1) ? 1 : $position; + if ($position === 1) { + $end = substr($str, 0, - ($max_length - strlen($beg))); + } else { + $end = substr($str, - ($max_length - strlen($beg))); + } + return $beg . $ellipsis . $end; } -function getRealIpAddr() { - //check ip from share internet - if(!empty($_SERVER['HTTP_CLIENT_IP'])) { - $ip = $_SERVER['HTTP_CLIENT_IP']; - } - //to check ip is pass from proxy - elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { - $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; - } - else { - $ip = $_SERVER['REMOTE_ADDR']; - } - return $ip; +function getRealIpAddr() +{ + //check ip from share internet + if (!empty($_SERVER['HTTP_CLIENT_IP'])) { + $ip = $_SERVER['HTTP_CLIENT_IP']; + } + //to check ip is pass from proxy + elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { + $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; + } else { + $ip = $_SERVER['REMOTE_ADDR']; + } + return $ip; } -function redirect($url) { - if(!headers_sent()) { - header('Location: '.$url); - exit; - } - else { - echo ''; - echo ''; exit; +function redirect($url) +{ + if (!headers_sent()) { + header('Location: ' . $url); + exit; + } else { + echo ''; + echo ''; + exit; } } -function redirect_wait5($url) { - echo ''; - exit; +function redirect_wait5($url) +{ + echo ''; + exit; } -function get_gravatar($email, $s = 80, $d = 'mm', $r = 'g', $img = false, $atts = array()) { +function get_gravatar($email, $s = 80, $d = 'mm', $r = 'g', $img = false, $atts = array()) +{ $url = 'https://www.gravatar.com/avatar/'; - $url .= md5( strtolower( trim( $email ) ) ); + $url .= md5(strtolower(trim($email))); $url .= "?s=$s&d=identicon&r=$r"; - if($img) { + if ($img) { $url = ' $val) + foreach ($atts as $key => $val) { $url .= ' ' . $key . '="' . $val . '"'; + } $url .= ' />'; } return $url; } -function ago($time) { - $periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade"); - $lengths = array("60","60","24","7","4.35","12","10"); - $now = time(); - $difference = $now - $time; - $tense = "ago"; +function ago($time) +{ + $periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade"); + $lengths = array("60", "60", "24", "7", "4.35", "12", "10"); + $now = time(); + $difference = $now - $time; + $tense = "ago"; - for($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) { - $difference /= $lengths[$j]; - } - $difference = round($difference); - if($difference != 1) { - $periods[$j].= "s"; - } - return "$difference $periods[$j] ago"; + for ($j = 0; $difference >= $lengths[$j] && $j < count($lengths) - 1; $j++) { + $difference /= $lengths[$j]; + } + $difference = round($difference); + if ($difference != 1) { + $periods[$j] .= "s"; + } + return "$difference $periods[$j] ago"; } -function getCountries() { - $countries = array("United States", "Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegowina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia (Hrvatska)", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands (Malvinas)", "Faroe Islands", "Fiji", "Finland", "France", "France Metropolitan", "French Guiana", "French Polynesia", "French Southern Territories", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Heard and Mc Donald Islands", "Holy See (Vatican City State)", "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran (Islamic Republic of)", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea, Democratic People's Republic of", "Korea, Republic of", "Kuwait", "Kyrgyzstan", "Lao, People's Democratic Republic", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libyan Arab Jamahiriya", "Liechtenstein", "Lithuania", "Luxembourg", "Macau", "Macedonia, The Former Yugoslav Republic of", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia, Federated States of", "Moldova, Republic of", "Monaco", "Mongolia", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepal", "Netherlands", "Netherlands Antilles", "New Caledonia", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Pitcairn", "Poland", "Portugal", "Puerto Rico", "Qatar", "Reunion", "Romania", "Russian Federation", "Rwanda", "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent and the Grenadines", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Seychelles", "Sierra Leone", "Singapore", "Slovakia (Slovak Republic)", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "South Georgia and the South Sandwich Islands", "Spain", "Sri Lanka", "St. Helena", "St. Pierre and Miquelon", "Sudan", "Suriname", "Svalbard and Jan Mayen Islands", "Swaziland", "Sweden", "Switzerland", "Syrian Arab Republic", "Taiwan, Province of China", "Tajikistan", "Tanzania, United Republic of", "Thailand", "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Turks and Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan", "Vanuatu", "Venezuela", "Vietnam", "Virgin Islands (British)", "Virgin Islands (U.S.)", "Wallis and Futuna Islands", "Western Sahara", "Yemen", "Yugoslavia", "Zambia", "Zimbabwe"); - return $countries; +function getCountries() +{ + $countries = array("United States", "Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegowina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia (Hrvatska)", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands (Malvinas)", "Faroe Islands", "Fiji", "Finland", "France", "France Metropolitan", "French Guiana", "French Polynesia", "French Southern Territories", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Heard and Mc Donald Islands", "Holy See (Vatican City State)", "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran (Islamic Republic of)", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea, Democratic People's Republic of", "Korea, Republic of", "Kuwait", "Kyrgyzstan", "Lao, People's Democratic Republic", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libyan Arab Jamahiriya", "Liechtenstein", "Lithuania", "Luxembourg", "Macau", "Macedonia, The Former Yugoslav Republic of", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia, Federated States of", "Moldova, Republic of", "Monaco", "Mongolia", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepal", "Netherlands", "Netherlands Antilles", "New Caledonia", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Pitcairn", "Poland", "Portugal", "Puerto Rico", "Qatar", "Reunion", "Romania", "Russian Federation", "Rwanda", "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent and the Grenadines", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Seychelles", "Sierra Leone", "Singapore", "Slovakia (Slovak Republic)", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "South Georgia and the South Sandwich Islands", "Spain", "Sri Lanka", "St. Helena", "St. Pierre and Miquelon", "Sudan", "Suriname", "Svalbard and Jan Mayen Islands", "Swaziland", "Sweden", "Switzerland", "Syrian Arab Republic", "Taiwan, Province of China", "Tajikistan", "Tanzania, United Republic of", "Thailand", "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Turks and Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan", "Vanuatu", "Venezuela", "Vietnam", "Virgin Islands (British)", "Virgin Islands (U.S.)", "Wallis and Futuna Islands", "Western Sahara", "Yemen", "Yugoslavia", "Zambia", "Zimbabwe"); + return $countries; } -function getJobNames($unique) { - $jobNames = array(0 => "Beginner",100 => "Warrior",110 => "Fighter", 111 => "Crusader", 112 => "Hero",120 => "Page", 121 => "White Knight", 122 => "Paladin",130 => "Spearman", 131 => "Dragon Knight", 132 => "Dark Knight",200 => "Magician",210 => "Wizard (F/P)", 211 => "Mage (F/P)", 212 => "Arch Mage (F/P)",220 => "Wizard (I/L)", 221 => "Mage (I/L)", 222 => "Arch Mage (I/L)",230 => "Cleric", 231 => "Priest", 232 => "Bishop",300 => "Bowman",310 => "Hunter", 311 => "Ranger", 312 => "Bowmaster",320 => "Crossbowman", 321 => "Sniper", 322 => "Marksman",400 => "Thief",410 => "Assassin", 411 => "Hermit", 412 => "Night Lord",420 => "Bandit", 421 => "Chief Bandit", 422 => "Shadower",430 => "Blade Recruit", 431 => "Blade Acolyte", 432 => "Blade Specialist", 433 => "Blade Lord", 434 => "Blade Master",500 => "Pirate",510 => "Brawler", 511 => "Marauder", 512 => "Buccaneer",520 => "Gunslinger", 521 => "Outlaw", 522 => "Corsair",501 => "Pirate", 530 => "Cannoneer", 531 => "Cannon Trooper", 532 => "Cannon Master",508 => "Jett", 570 => "Jett", 571 => "Jett", 572 => "Jett",509 => "Pirate",580 => "Brawler", 581 => "Marauder", 582 => "Buccaneer",590 => "Gunslinger", 591 => "Outlaw", 592 => "Corsair",1000 => "Noblesse",1100 => "Dawn Warrior", 1110 => "Dawn Warrior", 1111 => "Dawn Warrior", 1112 => "Dawn Warrior",1200 => "Blaze Wizard", 1210 => "Blaze Wizard", 1211 => "Blaze Wizard", 1212 => "Blaze Wizard",1300 => "Wind Archer", 1310 => "Wind Archer", 1311 => "Wind Archer", 1312 => "Wind Archer",1400 => "Night Walker", 1410 => "Night Walker", 1411 => "Night Walker", 1412 => "Night Walker",1500 => "Thunder Breaker", 1510 => "Thunder Breaker", 1511 => "Thunder Breaker", 1512 => "Thunder Breaker",2000 => "Legend", 2100 => "Aran", 2110 => "Aran", 2111 => "Aran", 2112 => "Aran",2001 => "Evan", 2200 => "Evan", 2210 => "Evan", 2211 => "Evan", 2212 => "Evan", 2213 => "Evan", 2214 => "Evan", 2215 => "Evan", 2216 => "Evan", 2217 => "Evan", 2218 => "Evan",2002 => "Mercedes", 2300 => "Mercedes", 2310 => "Mercedes", 2311 => "Mercedes", 2312 => "Mercedes",2003 => "Phantom", 2400 => "Phantom", 2410 => "Phantom", 2411 => "Phantom", 2412 => "Phantom",2004 => "Luminous", 2700 => "Luminous", 2710 => "Luminous", 2711 => "Luminous", 2712 => "Luminous",2005 => "Shade", 2500 => "Shade", 2510 => "Shade", 2511 => "Shade", 2512 => "Shade",3000 => "Citizen",3200 => "Battle Mage", 3210 => "Battle Mage", 3211 => "Battle Mage", 3212 => "Battle Mage",3300 => "Wild Hunter", 3310 => "Wild Hunter", 3311 => "Wild Hunter", 3312 => "Wild Hunter",3500 => "Mechanic", 3510 => "Mechanic", 3511 => "Mechanic", 3512 => "Mechanic",3001 => "Demon Slayer",3100 => "Demon Slayer", 3110 => "Demon Slayer", 3111 => "Demon Slayer", 3112 => "Demon Slayer",3101 => "Demon Avenger", 3120 => "Demon Avenger", 3121 => "Demon Avenger", 3122 => "Demon Avenger",3002 => "Xenon", 3600 => "Xenon", 3610 => "Xenon", 3611 => "Xenon", 3612 => "Xenon",4001 => "Hayato", 4100 => "Hayato", 4110 => "Hayato", 4111 => "Hayato", 4112 => "Hayato",4002 => "Kanna", 4200 => "Kanna", 4210 => "Kanna", 4211 => "Kanna", 4212 => "Kanna",5000 => "Mihile", 5100 => "Mihile", 5110 => "Mihile", 5111 => "Mihile", 5112 => "Mihile",6000 => "Kaiser", 6100 => "Kaiser", 6110 => "Kaiser", 6111 => "Kaiser", 6112 => "Kaiser",6001 => "Angelic Buster", 6500 => "Angelic Buster", 6510 => "Angelic Buster", 6511 => "Angelic Buster", 6512 => "Angelic Buster",10000 => "Zero", 10100 => "Zero", 10110 => "Zero", 10111 => "Zero", 10112 => "Zero",11000 => "Beast Tamer", 11200 => "Beast Tamer", 11210 => "Beast Tamer", 11211 => "Beast Tamer", 11212 => "Beast Tamer",13000 => "Pink Bean", 13100 => "Pink Bean",14000 => "Kinesis", 14200 => "Kinesis", 14210 => "Kinesis", 14211 => "Kinesis", 14212 => "Kinesis"); - if($unique) { - return array_unique($jobNames); - } - return $jobNames; +function getJobNames($unique) +{ + $jobNames = array(0 => "Beginner", 100 => "Warrior", 110 => "Fighter", 111 => "Crusader", 112 => "Hero", 120 => "Page", 121 => "White Knight", 122 => "Paladin", 130 => "Spearman", 131 => "Dragon Knight", 132 => "Dark Knight", 200 => "Magician", 210 => "Wizard (F/P)", 211 => "Mage (F/P)", 212 => "Arch Mage (F/P)", 220 => "Wizard (I/L)", 221 => "Mage (I/L)", 222 => "Arch Mage (I/L)", 230 => "Cleric", 231 => "Priest", 232 => "Bishop", 300 => "Bowman", 310 => "Hunter", 311 => "Ranger", 312 => "Bowmaster", 320 => "Crossbowman", 321 => "Sniper", 322 => "Marksman", 400 => "Thief", 410 => "Assassin", 411 => "Hermit", 412 => "Night Lord", 420 => "Bandit", 421 => "Chief Bandit", 422 => "Shadower", 430 => "Blade Recruit", 431 => "Blade Acolyte", 432 => "Blade Specialist", 433 => "Blade Lord", 434 => "Blade Master", 500 => "Pirate", 510 => "Brawler", 511 => "Marauder", 512 => "Buccaneer", 520 => "Gunslinger", 521 => "Outlaw", 522 => "Corsair", 501 => "Pirate", 530 => "Cannoneer", 531 => "Cannon Trooper", 532 => "Cannon Master", 508 => "Jett", 570 => "Jett", 571 => "Jett", 572 => "Jett", 509 => "Pirate", 580 => "Brawler", 581 => "Marauder", 582 => "Buccaneer", 590 => "Gunslinger", 591 => "Outlaw", 592 => "Corsair", 1000 => "Noblesse", 1100 => "Dawn Warrior", 1110 => "Dawn Warrior", 1111 => "Dawn Warrior", 1112 => "Dawn Warrior", 1200 => "Blaze Wizard", 1210 => "Blaze Wizard", 1211 => "Blaze Wizard", 1212 => "Blaze Wizard", 1300 => "Wind Archer", 1310 => "Wind Archer", 1311 => "Wind Archer", 1312 => "Wind Archer", 1400 => "Night Walker", 1410 => "Night Walker", 1411 => "Night Walker", 1412 => "Night Walker", 1500 => "Thunder Breaker", 1510 => "Thunder Breaker", 1511 => "Thunder Breaker", 1512 => "Thunder Breaker", 2000 => "Legend", 2100 => "Aran", 2110 => "Aran", 2111 => "Aran", 2112 => "Aran", 2001 => "Evan", 2200 => "Evan", 2210 => "Evan", 2211 => "Evan", 2212 => "Evan", 2213 => "Evan", 2214 => "Evan", 2215 => "Evan", 2216 => "Evan", 2217 => "Evan", 2218 => "Evan", 2002 => "Mercedes", 2300 => "Mercedes", 2310 => "Mercedes", 2311 => "Mercedes", 2312 => "Mercedes", 2003 => "Phantom", 2400 => "Phantom", 2410 => "Phantom", 2411 => "Phantom", 2412 => "Phantom", 2004 => "Luminous", 2700 => "Luminous", 2710 => "Luminous", 2711 => "Luminous", 2712 => "Luminous", 2005 => "Shade", 2500 => "Shade", 2510 => "Shade", 2511 => "Shade", 2512 => "Shade", 3000 => "Citizen", 3200 => "Battle Mage", 3210 => "Battle Mage", 3211 => "Battle Mage", 3212 => "Battle Mage", 3300 => "Wild Hunter", 3310 => "Wild Hunter", 3311 => "Wild Hunter", 3312 => "Wild Hunter", 3500 => "Mechanic", 3510 => "Mechanic", 3511 => "Mechanic", 3512 => "Mechanic", 3001 => "Demon Slayer", 3100 => "Demon Slayer", 3110 => "Demon Slayer", 3111 => "Demon Slayer", 3112 => "Demon Slayer", 3101 => "Demon Avenger", 3120 => "Demon Avenger", 3121 => "Demon Avenger", 3122 => "Demon Avenger", 3002 => "Xenon", 3600 => "Xenon", 3610 => "Xenon", 3611 => "Xenon", 3612 => "Xenon", 4001 => "Hayato", 4100 => "Hayato", 4110 => "Hayato", 4111 => "Hayato", 4112 => "Hayato", 4002 => "Kanna", 4200 => "Kanna", 4210 => "Kanna", 4211 => "Kanna", 4212 => "Kanna", 5000 => "Mihile", 5100 => "Mihile", 5110 => "Mihile", 5111 => "Mihile", 5112 => "Mihile", 6000 => "Kaiser", 6100 => "Kaiser", 6110 => "Kaiser", 6111 => "Kaiser", 6112 => "Kaiser", 6001 => "Angelic Buster", 6500 => "Angelic Buster", 6510 => "Angelic Buster", 6511 => "Angelic Buster", 6512 => "Angelic Buster", 10000 => "Zero", 10100 => "Zero", 10110 => "Zero", 10111 => "Zero", 10112 => "Zero", 11000 => "Beast Tamer", 11200 => "Beast Tamer", 11210 => "Beast Tamer", 11211 => "Beast Tamer", 11212 => "Beast Tamer", 13000 => "Pink Bean", 13100 => "Pink Bean", 14000 => "Kinesis", 14200 => "Kinesis", 14210 => "Kinesis", 14211 => "Kinesis", 14212 => "Kinesis"); + if ($unique) { + return array_unique($jobNames); + } + return $jobNames; } -function hashPassword($password, $algorithm, $salt) { - switch (strtolower($algorithm)) { - case "bcrypt": - // Using salt has been deprecated - return password_hash($password, PASSWORD_BCRYPT); - case "sha1": - return sha1($password); - case "sha512": - return hash('sha512',$password.$salt); - - return sha1($password); - } +function hashPassword($password, $algorithm, $salt) +{ + switch (strtolower($algorithm)) { + case "bcrypt": + // Using salt has been deprecated + return password_hash($password, PASSWORD_BCRYPT); + case "sha1": + return sha1($password); + case "sha512": + return hash('sha512', $password . $salt); + + return sha1($password); + } } -function verifyPassword($password, $hash, $algorithm, $salt) { - switch (strtolower($algorithm)) { - case "bcrypt": - return password_verify($password, $hash); - case "sha1": - return sha1($password) === $hash; - case "sha512": - return hash('sha512',$password.$salt) === $hash; - - return false; - } +function verifyPassword($password, $hash, $algorithm, $salt) +{ + switch ($algorithm) { + case "bcrypt": + return password_verify($password, $hash); + case "sha1": + return sha1($password) === $hash; + case "sha512": + return hash('sha512', $password . $salt) === $hash; + + return false; + } } -?> diff --git a/assets/config/install/install.php b/assets/config/install/install.php index 587a4f4b..ef73dd97 100644 --- a/assets/config/install/install.php +++ b/assets/config/install/install.php @@ -1,38 +1,42 @@ + - -MapleBit Installation - - - - - + + MapleBit Installation + + + + + + -
-
-
-
-
MapleBit Installation
-
-'; -if(isset($_GET['install'])) { - $install = $_GET['install']; -} else{ - $install = ""; -} -if(file_exists('installdone.txt')) { - echo "
Oops! Looks like MapleBit has already been installed! If you'd like, you can delete everything in the install folder, except for installdone.txt
"; -} else { - switch($install) { - case NULL: - echo ' +
+
+
+
+
MapleBit Installation
+
+ Oops! Looks like MapleBit has already been installed! If you'd like, you can delete everything in the install folder, except for installdone.txt
"; + } else { + switch ($install) { + case null: + echo '
Welcome to MapleBit.

Before you can use your new website, MapleBit must be installed. Please make sure you have the following information handy:

@@ -48,10 +52,10 @@ function goBack() {window.history.back()}

'; - exit; - break; - case 1: - echo ' + exit; + break; + case 1: + echo '
Configure your database settings

@@ -89,38 +93,38 @@ function goBack() {window.history.back()}


'; - break; - case 2: - echo '
SQL Connection Check

'; - error_reporting(0); - $host = $_POST["host"]; - $db = $_POST["DB"]; - $dbuser = $_POST["DBuser"]; - $dbpass = $_POST["DBpass"]; - $dbprefix = $_POST["DBprefix"]; - $mysqli = new mysqli($host, $dbuser, $dbpass, $db); - if ($mysqli->connect_errno) { - printf("
Connect failed: %s\n", $mysqli->connect_error); - echo "

« Go Back

"; - exit(); - } - if($host == "" || $db == "") { - echo"
Please enter the correct information
"; - echo "
« Go Back

"; - exit(); - } -file_put_contents('../database.php', 'SQL Connection Check
'; + error_reporting(0); + $host = $_POST["host"]; + $db = $_POST["DB"]; + $dbuser = $_POST["DBuser"]; + $dbpass = $_POST["DBpass"]; + $dbprefix = $_POST["DBprefix"]; + $mysqli = new mysqli($host, $dbuser, $dbpass, $db); + if ($mysqli->connect_errno) { + printf("
Connect failed: %s\n", $mysqli->connect_error); + echo "

« Go Back

"; + exit(); + } + if ($host == "" || $db == "") { + echo "
Please enter the correct information
"; + echo "
« Go Back

"; + exit(); + } + file_put_contents('../database.php', ' -'); - echo ' -
Successfully connected to MySQL.
-
-
- -
-

'; - break; - case 3: - include '../database.php'; - if($mysqli->query("SHOW TABLES LIKE 'accounts'")->num_rows != 1) { - echo "
(1) You need to have a valid game database installed before installing MapleBit!

« Go Back

"; - exit(); - } - if($mysqli->query("SHOW TABLES LIKE 'characters'")->num_rows != 1) { - echo "
(2) You need to have a valid game database installed before installing MapleBit!

« Go Back

"; - exit(); - } -$queryaccounts = $mysqli->query("SELECT * FROM `accounts`"); -$getcolumns = $queryaccounts->fetch_assoc(); + '); + echo ' +
Successfully connected to MySQL.
+
+
+ +
+

'; + break; + case 3: + include '../database.php'; + if ($mysqli->query("SHOW TABLES LIKE 'accounts'")->num_rows != 1) { + echo " +
+
(1) You need to have a valid game database installed before + installing MapleBit!
+
« Go Back

"; + exit(); + } + if ($mysqli->query("SHOW TABLES LIKE 'characters'")->num_rows != 1) { + echo " +
+
(2) You need to have a valid game database installed before + installing MapleBit!
+
« Go Back

"; + exit(); + } + $queryaccounts = $mysqli->query("SELECT * FROM `accounts`"); + $getcolumns = $queryaccounts->fetch_assoc(); -if(!isset($getcolumns['webadmin'])) { - $mysqli->query("ALTER TABLE accounts ADD `webadmin` int(1) DEFAULT 0;"); - echo "Added webadmin
"; -} -if(!isset($getcolumns['nick'])) { - $mysqli->query("ALTER TABLE accounts ADD `nick` varchar(20);"); - echo "Added nick
"; -} -if(!isset($getcolumns['mute'])) { - $mysqli->query("ALTER TABLE accounts ADD `mute` int(1) DEFAULT 0;"); - echo "Added mute
"; -} -if(!isset($getcolumns['email'])) { - $mysqli->query("ALTER TABLE accounts ADD `email` VARCHAR(45) DEFAULT NULL;"); - echo "Added email
"; -} -if(!isset($getcolumns['ip'])) { - $mysqli->query("ALTER TABLE accounts ADD `ip` text;"); - echo "Added ip
"; -} -if(!isset($getcolumns['birthday'])) { - $mysqli->query("ALTER TABLE accounts ADD `birthday` DATE;"); - echo "Added birthday
"; -} -mysqli_multi_query($mysqli, "DROP TABLE IF EXISTS `".$prefix."properties`; -CREATE TABLE `".$prefix."properties` ( - `name` text, - `type` TINYINT(1) NOT NULL DEFAULT '1', - `client` text, - `server` text, - `version` int(11) NOT NULL DEFAULT '0', - `forumurl` text, - `siteurl` text, - `exprate` text, - `mesorate` text, - `droprate` text, - `banner` text, - `background` text, - `bgcolor` varchar(6) DEFAULT NULL, - `bgrepeat` varchar(20) DEFAULT NULL, - `bgcenter` tinyint(1) DEFAULT NULL, - `bgfixed` tinyint(1) DEFAULT NULL, - `bgcover` tinyint(1) DEFAULT NULL, - `flood` tinyint(4) NOT NULL DEFAULT '1', - `floodint` int(11) DEFAULT NULL, - `gmlevel` int(11) NOT NULL DEFAULT '1', - `theme` text NOT NULL, - `nav` text NOT NULL, - `colnx` TEXT NOT NULL, - `colvp` TEXT NOT NULL, - `homecontent` text, - `jailmaps` text, - `githubapi` INT(12) DEFAULT NULL, - `status` tinyint(1) DEFAULT NULL, - `recaptcha_public` text DEFAULT NULL, - `recaptcha_private` text DEFAULT NULL, - `hash_algorithm` varchar(45), - PRIMARY KEY (`version`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -INSERT INTO ".$prefix."properties (version, theme, nav, colnx, colvp, homecontent) VALUES (83, 'bootstrap', 1, 'paypalNX', 'votepoints', 'Admins: Click here to edit'); + if (!isset($getcolumns['webadmin'])) { + $mysqli->query("ALTER TABLE accounts ADD `webadmin` int(1) DEFAULT 0;"); + echo "Added webadmin
"; + } + if (!isset($getcolumns['nick'])) { + $mysqli->query("ALTER TABLE accounts ADD `nick` varchar(20);"); + echo "Added nick
"; + } + if (!isset($getcolumns['mute'])) { + $mysqli->query("ALTER TABLE accounts ADD `mute` int(1) DEFAULT 0;"); + echo "Added mute
"; + } + if (!isset($getcolumns['email'])) { + $mysqli->query("ALTER TABLE accounts ADD `email` VARCHAR(45) DEFAULT NULL;"); + echo "Added email
"; + } + if (!isset($getcolumns['ip'])) { + $mysqli->query("ALTER TABLE accounts ADD `ip` text;"); + echo "Added ip
"; + } + if (!isset($getcolumns['birthday'])) { + $mysqli->query("ALTER TABLE accounts ADD `birthday` DATE;"); + echo "Added birthday
"; + } + mysqli_multi_query( + $mysqli, + "DROP TABLE IF EXISTS `" . $prefix . "properties`; + CREATE TABLE `" . $prefix . "properties` ( + `name` text, + `type` TINYINT(1) NOT NULL DEFAULT '1', + `client` text, + `server` text, + `version` int(11) NOT NULL DEFAULT '0', + `forumurl` text, + `siteurl` text, + `exprate` text, + `mesorate` text, + `droprate` text, + `banner` text, + `background` text, + `bgcolor` varchar(6) DEFAULT NULL, + `bgrepeat` varchar(20) DEFAULT NULL, + `bgcenter` tinyint(1) DEFAULT NULL, + `bgfixed` tinyint(1) DEFAULT NULL, + `bgcover` tinyint(1) DEFAULT NULL, + `flood` tinyint(4) NOT NULL DEFAULT '1', + `floodint` int(11) DEFAULT NULL, + `gmlevel` int(11) NOT NULL DEFAULT '1', + `theme` text NOT NULL, + `nav` text NOT NULL, + `colnx` TEXT NOT NULL, + `colvp` TEXT NOT NULL, + `homecontent` text, + `jailmaps` text, + `githubapi` INT(12) DEFAULT NULL, + `status` tinyint(1) DEFAULT NULL, + `recaptcha_public` text DEFAULT NULL, + `recaptcha_private` text DEFAULT NULL, + `hash_algorithm` varchar(45), + PRIMARY KEY (`version`) + ) ENGINE=InnoDB DEFAULT CHARSET=latin1; + INSERT INTO " . $prefix . "properties (version, theme, nav, colnx, colvp, homecontent) VALUES + (83, 'bootstrap', 1, 'paypalNX', 'votepoints', 'Admins: Click here to edit'); -DROP TABLE IF EXISTS `".$prefix."pages`; -CREATE TABLE `".$prefix."pages` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` text NOT NULL, - `slug` text NOT NULL, - `author` text NOT NULL, - `content` text NOT NULL, - `visible` tinyint(1) NOT NULL DEFAULT '1', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1; + DROP TABLE IF EXISTS `" . $prefix . "pages`; + CREATE TABLE `" . $prefix . "pages` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` text NOT NULL, + `slug` text NOT NULL, + `author` text NOT NULL, + `content` text NOT NULL, + `visible` tinyint(1) NOT NULL DEFAULT '1', + PRIMARY KEY (`id`) + ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1; -DROP TABLE IF EXISTS `".$prefix."mail`; -CREATE TABLE `".$prefix."mail` ( - `mailid` int(10) unsigned NOT NULL auto_increment, - `to` varchar(50) NOT NULL, - `from` varchar(50) NOT NULL, - `status` tinyint(4) NOT NULL default '-1', - `title` varchar(50) NOT NULL, - `content` text NOT NULL, - `ipaddress` varchar(15) NOT NULL default '127.0.0.1', - `timestamp` varchar(40) NOT NULL default '-', - `dateadded` varchar(30) default 'NULL DATE', - PRIMARY KEY (`mailid`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC; + DROP TABLE IF EXISTS `" . $prefix . "mail`; + CREATE TABLE `" . $prefix . "mail` ( + `mailid` int(10) unsigned NOT NULL auto_increment, + `to` varchar(50) NOT NULL, + `from` varchar(50) NOT NULL, + `status` tinyint(4) NOT NULL default '-1', + `title` varchar(50) NOT NULL, + `content` text NOT NULL, + `ipaddress` varchar(15) NOT NULL default '127.0.0.1', + `timestamp` varchar(40) NOT NULL default '-', + `dateadded` varchar(30) default 'NULL DATE', + PRIMARY KEY (`mailid`) + ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC; -DROP TABLE IF EXISTS `".$prefix."buynx`; -CREATE TABLE `".$prefix."buynx` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `meso` int(11) NOT NULL, - `nx` int(11) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; + DROP TABLE IF EXISTS `" . $prefix . "buynx`; + CREATE TABLE `" . $prefix . "buynx` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `meso` int(11) NOT NULL, + `nx` int(11) NOT NULL, + PRIMARY KEY (`id`) + ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; -DROP TABLE IF EXISTS `".$prefix."vote`; -CREATE TABLE `".$prefix."vote` ( -`id` INT( 10 ) NOT NULL AUTO_INCREMENT , -`name` VARCHAR(45) NOT NULL, -`link` TEXT NOT NULL , -`gnx` INT(11) UNSIGNED NOT NULL DEFAULT 10, -`gvp` INT(11) UNSIGNED NOT NULL DEFAULT 1, -`waittime` INT(11) UNSIGNED NOT NULL DEFAULT 21600, -PRIMARY KEY ( `id` ) -) ENGINE = MYISAM ; + DROP TABLE IF EXISTS `" . $prefix . "vote`; + CREATE TABLE `" . $prefix . "vote` ( + `id` INT( 10 ) NOT NULL AUTO_INCREMENT , + `name` VARCHAR(45) NOT NULL, + `link` TEXT NOT NULL , + `gnx` INT(11) UNSIGNED NOT NULL DEFAULT 10, + `gvp` INT(11) UNSIGNED NOT NULL DEFAULT 1, + `waittime` INT(11) UNSIGNED NOT NULL DEFAULT 21600, + PRIMARY KEY ( `id` ) + ) ENGINE = MYISAM ; -DROP TABLE IF EXISTS `".$prefix."ncomments`; - CREATE TABLE `".$prefix."ncomments` ( -`id` INT( 10 ) NOT NULL AUTO_INCREMENT , -`nid` INT ( 10 ) NOT NULL , -`author` VARCHAR( 16 ) NOT NULL , -`feedback` INT( 1 ) NOT NULL , -`date` VARCHAR( 32 ) NOT NULL , -`comment` TEXT NOT NULL , -PRIMARY KEY ( `id` ) -) ENGINE = MYISAM ; + DROP TABLE IF EXISTS `" . $prefix . "ncomments`; + CREATE TABLE `" . $prefix . "ncomments` ( + `id` INT( 10 ) NOT NULL AUTO_INCREMENT , + `nid` INT ( 10 ) NOT NULL , + `author` VARCHAR( 16 ) NOT NULL , + `feedback` INT( 1 ) NOT NULL , + `date` VARCHAR( 32 ) NOT NULL , + `comment` TEXT NOT NULL , + PRIMARY KEY ( `id` ) + ) ENGINE = MYISAM ; -DROP TABLE IF EXISTS `".$prefix."ecomments`; - CREATE TABLE `".$prefix."ecomments` ( -`id` INT( 10 ) NOT NULL AUTO_INCREMENT , -`eid` INT ( 10 ) NOT NULL , -`author` VARCHAR( 16 ) NOT NULL , -`feedback` INT( 1 ) NOT NULL , -`date` VARCHAR( 32 ) NOT NULL , -`comment` TEXT NOT NULL , -PRIMARY KEY ( `id` ) -) ENGINE = MYISAM ; + DROP TABLE IF EXISTS `" . $prefix . "ecomments`; + CREATE TABLE `" . $prefix . "ecomments` ( + `id` INT( 10 ) NOT NULL AUTO_INCREMENT , + `eid` INT ( 10 ) NOT NULL , + `author` VARCHAR( 16 ) NOT NULL , + `feedback` INT( 1 ) NOT NULL , + `date` VARCHAR( 32 ) NOT NULL , + `comment` TEXT NOT NULL , + PRIMARY KEY ( `id` ) + ) ENGINE = MYISAM ; -DROP TABLE IF EXISTS `".$prefix."bcomments`; - CREATE TABLE `".$prefix."bcomments` ( -`id` INT( 10 ) NOT NULL AUTO_INCREMENT , -`bid` INT ( 10 ) NOT NULL , -`author` VARCHAR( 16 ) NOT NULL , -`feedback` INT( 1 ) NOT NULL , -`date` VARCHAR( 32 ) NOT NULL , -`comment` TEXT NOT NULL , -PRIMARY KEY ( `id` ) -) ENGINE = MYISAM ; + DROP TABLE IF EXISTS `" . $prefix . "bcomments`; + CREATE TABLE `" . $prefix . "bcomments` ( + `id` INT( 10 ) NOT NULL AUTO_INCREMENT , + `bid` INT ( 10 ) NOT NULL , + `author` VARCHAR( 16 ) NOT NULL , + `feedback` INT( 1 ) NOT NULL , + `date` VARCHAR( 32 ) NOT NULL , + `comment` TEXT NOT NULL , + PRIMARY KEY ( `id` ) + ) ENGINE = MYISAM ; -DROP TABLE IF EXISTS `".$prefix."news`; - CREATE TABLE `".$prefix."news` ( -`id` INT( 10 ) NOT NULL AUTO_INCREMENT , -`title` VARCHAR( 50 ) NOT NULL , -`author` VARCHAR( 16 ) NOT NULL , -`date` VARCHAR( 32 ) NOT NULL , -`type` VARCHAR( 50 ) NOT NULL , -`content` TEXT NOT NULL , -`views` INT ( 10 ) NOT NULL DEFAULT '0', -`locked` int(10) unsigned NOT NULL DEFAULT '0', -PRIMARY KEY ( `id` ) -) ENGINE = MYISAM ; + DROP TABLE IF EXISTS `" . $prefix . "news`; + CREATE TABLE `" . $prefix . "news` ( + `id` INT( 10 ) NOT NULL AUTO_INCREMENT , + `title` VARCHAR( 50 ) NOT NULL , + `author` VARCHAR( 16 ) NOT NULL , + `date` VARCHAR( 32 ) NOT NULL , + `type` VARCHAR( 50 ) NOT NULL , + `content` TEXT NOT NULL , + `views` INT ( 10 ) NOT NULL DEFAULT '0', + `locked` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY ( `id` ) + ) ENGINE = MYISAM ; -DROP TABLE IF EXISTS `".$prefix."events`; - CREATE TABLE `".$prefix."events` ( -`id` INT( 10 ) NOT NULL AUTO_INCREMENT , -`title` VARCHAR( 50 ) NOT NULL , -`author` VARCHAR( 16 ) NOT NULL , -`date` VARCHAR( 32 ) NOT NULL , -`type` VARCHAR( 100 ) NOT NULL , -`status` VARCHAR( 32 ) NOT NULL , -`content` TEXT NOT NULL , -`views` INT ( 10 ) NOT NULL DEFAULT '0', -`locked` int(10) unsigned NOT NULL DEFAULT '0', -PRIMARY KEY ( `id` ) -) ENGINE = MYISAM ; + DROP TABLE IF EXISTS `" . $prefix . "events`; + CREATE TABLE `" . $prefix . "events` ( + `id` INT( 10 ) NOT NULL AUTO_INCREMENT , + `title` VARCHAR( 50 ) NOT NULL , + `author` VARCHAR( 16 ) NOT NULL , + `date` VARCHAR( 32 ) NOT NULL , + `type` VARCHAR( 100 ) NOT NULL , + `status` VARCHAR( 32 ) NOT NULL , + `content` TEXT NOT NULL , + `views` INT ( 10 ) NOT NULL DEFAULT '0', + `locked` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY ( `id` ) + ) ENGINE = MYISAM ; -DROP TABLE IF EXISTS `".$prefix."gmblog`; - CREATE TABLE `".$prefix."gmblog` ( -`id` INT( 10 ) NOT NULL AUTO_INCREMENT , -`title` VARCHAR( 50 ) NOT NULL , -`author` VARCHAR( 16 ) NOT NULL , -`date` VARCHAR( 32 ) NOT NULL , -`content` TEXT NOT NULL , -`views` INT( 10 ) NOT NULL DEFAULT '0', -`locked` int(10) unsigned NOT NULL DEFAULT '0', -PRIMARY KEY ( `id` ) -) ENGINE = MYISAM ; + DROP TABLE IF EXISTS `" . $prefix . "gmblog`; + CREATE TABLE `" . $prefix . "gmblog` ( + `id` INT( 10 ) NOT NULL AUTO_INCREMENT , + `title` VARCHAR( 50 ) NOT NULL , + `author` VARCHAR( 16 ) NOT NULL , + `date` VARCHAR( 32 ) NOT NULL , + `content` TEXT NOT NULL , + `views` INT( 10 ) NOT NULL DEFAULT '0', + `locked` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY ( `id` ) + ) ENGINE = MYISAM ; -DROP TABLE IF EXISTS `".$prefix."profile`; -CREATE TABLE `".$prefix."profile` ( - `id` int(10) NOT NULL AUTO_INCREMENT, - `accountid` int(10) DEFAULT NULL, - `name` varchar(255) NOT NULL DEFAULT '', - `mainchar` int(10) DEFAULT NULL, - `realname` varchar(255) DEFAULT NULL, - `age` int(2) DEFAULT NULL, - `country` varchar(255) DEFAULT NULL, - `motto` varchar(255) DEFAULT NULL, - `favjob` varchar(255) DEFAULT NULL, - `text` varchar(200) DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `accountid_UNIQUE` (`accountid`) -) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=utf8; + DROP TABLE IF EXISTS `" . $prefix . "profile`; + CREATE TABLE `" . $prefix . "profile` ( + `id` int(10) NOT NULL AUTO_INCREMENT, + `accountid` int(10) DEFAULT NULL, + `name` varchar(255) NOT NULL DEFAULT '', + `mainchar` int(10) DEFAULT NULL, + `realname` varchar(255) DEFAULT NULL, + `age` int(2) DEFAULT NULL, + `country` varchar(255) DEFAULT NULL, + `motto` varchar(255) DEFAULT NULL, + `favjob` varchar(255) DEFAULT NULL, + `text` varchar(200) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `accountid_UNIQUE` (`accountid`) + ) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=utf8; -DROP TABLE IF EXISTS `".$prefix."gdcache`; -CREATE TABLE ".$prefix."gdcache ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `hash` varchar(32) NOT NULL, - `name` varchar(20) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE = MYISAM ; + DROP TABLE IF EXISTS `" . $prefix . "gdcache`; + CREATE TABLE " . $prefix . "gdcache ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `hash` varchar(32) NOT NULL, + `name` varchar(20) NOT NULL, + PRIMARY KEY (`id`) + ) ENGINE = MYISAM ; -DROP TABLE IF EXISTS `".$prefix."votingrecords`; -CREATE TABLE `".$prefix."votingrecords` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `ip` varchar(30) NOT NULL DEFAULT '0', - `siteid` int(11) DEFAULT NULL, - `account` varchar(13) NOT NULL DEFAULT '0', - `date` int(11) NOT NULL DEFAULT '0', - `times` bigint(20) unsigned NOT NULL DEFAULT '0', - PRIMARY KEY (`id`) -) ENGINE=MYISAM;" -); -echo ""; - break; - case 4: - include('../database.php'); - if(isset($_POST['submit'])) { - $sservername = $mysqli->real_escape_string(stripslashes($_POST['servername'])); - $sclient = $mysqli->real_escape_string(stripslashes($_POST['client'])); - $sserver = $mysqli->real_escape_string(stripslashes($_POST['setup'])); - $sforumurl = $mysqli->real_escape_string(stripslashes($_POST['forumurl'])); - $sexp = $mysqli->real_escape_string(stripslashes($_POST['exprate'])); - $smeso = $mysqli->real_escape_string(stripslashes($_POST['mesorate'])); - $sdrop = $mysqli->real_escape_string(stripslashes($_POST['droprate'])); - $sgmlevel = $mysqli->real_escape_string(stripslashes($_POST['gmlevel'])); - $ssiteurl = str_replace('/assets/config/install/install.php?install=4','',$_SERVER["REQUEST_URI"]) . "/"; - $sversion = $mysqli->real_escape_string(stripslashes($_POST['version'])); - $sservertype = $mysqli->real_escape_string($_POST['servertype']); - $scolnx = $mysqli->real_escape_string(stripslashes($_POST['colnx'])); - $scolvp = $mysqli->real_escape_string(stripslashes($_POST['colvp'])); - $shashalgorithm = $mysqli->real_escape_string(stripslashes($_POST['hash-algorithm'])); - $continue = true; + DROP TABLE IF EXISTS `" . $prefix . "votingrecords`; + CREATE TABLE `" . $prefix . "votingrecords` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `ip` varchar(30) NOT NULL DEFAULT '0', + `siteid` int(11) DEFAULT NULL, + `account` varchar(13) NOT NULL DEFAULT '0', + `date` int(11) NOT NULL DEFAULT '0', + `times` bigint(20) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) + ) ENGINE=MYISAM;" + ); + echo " + "; + break; + case 4: + include('../database.php'); + if (isset($_POST['submit'])) { + $sservername = $mysqli->real_escape_string(stripslashes($_POST['servername'])); + $sclient = $mysqli->real_escape_string(stripslashes($_POST['client'])); + $sserver = $mysqli->real_escape_string(stripslashes($_POST['setup'])); + $sforumurl = $mysqli->real_escape_string(stripslashes($_POST['forumurl'])); + $sexp = $mysqli->real_escape_string(stripslashes($_POST['exprate'])); + $smeso = $mysqli->real_escape_string(stripslashes($_POST['mesorate'])); + $sdrop = $mysqli->real_escape_string(stripslashes($_POST['droprate'])); + $sgmlevel = $mysqli->real_escape_string(stripslashes($_POST['gmlevel'])); + $ssiteurl = str_replace( + '/assets/config/install/install.php?install=4', + '', + $_SERVER["REQUEST_URI"] + ) . "/"; + $sversion = $mysqli->real_escape_string(stripslashes($_POST['version'])); + $sservertype = $mysqli->real_escape_string($_POST['servertype']); + $scolnx = $mysqli->real_escape_string(stripslashes($_POST['colnx'])); + $scolvp = $mysqli->real_escape_string(stripslashes($_POST['colvp'])); + $shashalgorithm = $mysqli->real_escape_string(stripslashes($_POST['hash-algorithm'])); + $continue = true; - if(empty($sservername)) { - echo '
Your server doesn't have a name?
'; - $continue = false; - }elseif(empty($sclient)) { - echo '
You need a client link.
'; - $continue = false; - } elseif(empty($sserver)) { - echo '
You need a server link.
'; - $continue = false; - } elseif(empty($sforumurl)) { - echo '
You need to enter a forum URL. If you don' have one, just put a '#' in the text box.
'; - $continue = false; - } elseif(empty($sexp)) { - echo '
Enter an exp rate. Don't put an x in the text box!
'; - $continue = false; - } elseif(empty($smeso)) { - echo '
Enter a meso rate. Don't put an x in the text box!
'; - $continue = false; - } elseif(empty($sdrop)) { - echo '
Enter an drop rate. Don't put an x in the text box!
'; - $continue = false; - } elseif(empty($sgmlevel)) { - echo '
Enter the level that you must be to be GM (Usually 1)
'; - $continue = false; - } elseif(!is_numeric($sversion)) { - echo '
Enter a numeric value for the server version
'; - $continue = false; - } elseif(empty($scolnx)) { - echo '
Please enter your NX column name.
'; - $continue = false; - } elseif(empty($scolvp)) { - echo '
Please enter your VP column name.
'; - $continue = false; - } - if(!$continue) { - echo "
"; - } else { - $mysqli->query("UPDATE ".$prefix."properties SET name='".$sservername."', type = '".$sservertype."', client='".$sclient."', server = '".$sserver."', version='".$sversion."', forumurl='".$sforumurl."', siteurl='".$ssiteurl."', exprate='".$sexp."', mesorate='".$smeso."', droprate='".$sdrop."', gmlevel = '".$sgmlevel."', flood='1', floodint='5', theme='bootstrap', nav='1', colnx = '".$scolnx."', colvp = '".$scolvp."', hash_algorithm = '".$shashalgorithm."'"); - echo "Working..."; - echo ""; - } - } else { - include('../properties.php'); - $url = $_SERVER["REQUEST_URI"]; - $url = str_replace('/assets/config/install/install.php?install=4','',$url) . "/"; - echo " -
Site Configuration

-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
-
- - - What column in the accounts table holds the NX value? -
-
- - - What column in the accounts table holds the Vote Points value? -
-
-
- - - What level GM should be allowed to access the GM panel? -
-
-
- - - What algorithm should be used to hash passwords? If you're not sure, choose SHA1. -
-
- -
- "; - } - break; - case 5: - echo '
Extra Steps

'; - if(isset($_POST['myself'])) { - echo ""; - } else { - echo " -
Registration
-

- For Registration to work, go to the Google reCAPTCHA page, register your domain, and then submit your private and public keys in the Admin Panel -> Site Settings -> Site Configuration page. -

-
Rankings
-

- For the rankings to work, you need the GD archive to be extracted. This can take some time. Go to assets/img/GD and extract the .zip archive. -

-
-
- -
"; - } - break; - case 6: - include('../database.php'); - echo '
Create Administrator Account

'; - if(!isset($_POST['submit'])) { - $_SESSION['flash'] = ""; - echo " -
-
- - - If you don't yet have an account, skip this step for now. Or, create a new account directly in your database and proceed. -
-
- Skip » - -
- "; - } else { - $name = $mysqli->real_escape_string($_POST['accname']); - $getaccount = $mysqli->query("SELECT * from accounts WHERE name = '".$name."'"); - $count = $getaccount->num_rows; - if($count == 1) { - $mysqli->query("UPDATE accounts SET webadmin = 1 WHERE name = '".$name."'"); - echo ""; - $_SESSION['flash'] = "
".$name." is now a web administrator
"; - } else { - echo "
Invalid account.

"; - } - } - break; - case "done": - echo "
Woohoo! You're done installing MapleBit!
- ".$_SESSION['flash']." -
-
- -
"; - $content = "Congratulations on completing your MapleBit Installation! Leave this file here, or delete it if you would like to reconfigure your website."; - $fp = fopen("installdone.txt","wb"); - fwrite($fp,$content); - fclose($fp); - session_destroy(); - break; - } -} -echo '
-'; -?> + if (empty($sservername)) { + echo '
Your server doesn't have a name?
'; + $continue = false; + } elseif (empty($sclient)) { + echo '
You need a client link.
'; + $continue = false; + } elseif (empty($sserver)) { + echo '
You need a server link.
'; + $continue = false; + } elseif (empty($sforumurl)) { + echo '
You need to enter a forum URL. If you don' have one, + just put a '#' in the text box.
'; + $continue = false; + } elseif (empty($sexp)) { + echo '
Enter an exp rate. Don't put an x in the text box! +
'; + $continue = false; + } elseif (empty($smeso)) { + echo '
Enter a meso rate. Don't put an x in the text box! +
'; + $continue = false; + } elseif (empty($sdrop)) { + echo '
Enter an drop rate. Don't put an x in the text box! +
'; + $continue = false; + } elseif (empty($sgmlevel)) { + echo '
Enter the level that you must be to be GM (Usually 1) +
'; + $continue = false; + } elseif (!is_numeric($sversion)) { + echo '
Enter a numeric value for the server version
'; + $continue = false; + } elseif (empty($scolnx)) { + echo '
Please enter your NX column name.
'; + $continue = false; + } elseif (empty($scolvp)) { + echo '
Please enter your VP column name.
'; + $continue = false; + } + if (!$continue) { + echo " +
"; + } else { + $mysqli->query("UPDATE " . $prefix . "properties SET name='" . $sservername . "', type = '" . + $sservertype . "', client='" . $sclient . "', server = '" . $sserver . "', version='" . + $sversion . "', forumurl='" . $sforumurl . "', siteurl='" . $ssiteurl . "', exprate='" . $sexp . + "', mesorate='" . $smeso . "', droprate='" . $sdrop . "', gmlevel = '" . $sgmlevel . "', + flood='1', floodint='5', theme='bootstrap', nav='1', colnx = '" . $scolnx . "', colvp = '" . + $scolvp . "', hash_algorithm = '" . $shashalgorithm . "'"); + echo "Working..."; + echo " + "; + } + } else { + include('../properties.php'); + $url = $_SERVER["REQUEST_URI"]; + $url = str_replace('/assets/config/install/install.php?install=4', '', $url) . "/"; + echo " +
Site Configuration
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ + + What column in the accounts + table holds the NX value? +
+
+ + + What column in the accounts + table holds the Vote Points value? +
+
+
+ + + What level GM should be + allowed to access the GM panel? +
+
+
+ + + What algorithm should be + used to hash passwords? If you're not sure, choose SHA1. +
+
+ +
+ "; + } + break; + case 5: + echo '
Extra Steps
+
'; + if (isset($_POST['myself'])) { + echo " + "; + } else { + echo " +
Registration
+

+ For Registration to work, go to the Google reCAPTCHA page, register + your domain, and then submit your private and public keys in the Admin Panel -> Site + Settings -> Site Configuration page. +

+
Rankings
+

+ For the rankings to work, you need the GD archive to be extracted. This can take some time. + Go to assets/img/GD and extract the .zip archive. +

+
+
+ +
"; + } + break; + case 6: + include('../database.php'); + echo '
Create Administrator Account
+
'; + if (!isset($_POST['submit'])) { + $_SESSION['flash'] = ""; + echo " +
+
+ + + If you don't yet have an + account, skip this step for now. Or, create a new account directly in your database + and proceed. +
+
+ Skip » + +
+ "; + } else { + $name = $mysqli->real_escape_string($_POST['accname']); + $getaccount = $mysqli->query("SELECT * from accounts WHERE name = '" . $name . "'"); + $count = $getaccount->num_rows; + if ($count == 1) { + $mysqli->query("UPDATE accounts SET webadmin = 1 WHERE name = '" . $name . "'"); + echo " + "; + $_SESSION['flash'] = "
" . $name . " is now a web + administrator
"; + } else { + echo "
Invalid account.
+
"; + } + } + break; + case "done": + echo "
Woohoo! You're done installing MapleBit!
+ " . $_SESSION['flash'] . " +
+
+ +
"; + $content = "Congratulations on completing your MapleBit Installation! Leave this file here, or + delete it if you would like to reconfigure your website."; + $fp = fopen("installdone.txt", "wb"); + fwrite($fp, $content); + fclose($fp); + session_destroy(); + break; + } + } + echo ' +
+
+
+
+ + + +'; diff --git a/assets/config/properties.php b/assets/config/properties.php index 35d26c3b..8c0d0cbb 100644 --- a/assets/config/properties.php +++ b/assets/config/properties.php @@ -1,67 +1,67 @@ query("SELECT * FROM ".$prefix."properties"); - if (!$properties) + /* Site Controls */ + $properties = $mysqli->query("SELECT * FROM ".$prefix."properties"); + if (!$properties) { throw new Exception($mysqli->error); - $prop = $properties->fetch_assoc(); - $themetype = "light"; - $nav = "navbar navbar-expand-lg navbar-light bg-light"; - $ipaddress = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; - - - /* Name of server */ - $servername = $prop['name']; - $siteurl = $prop['siteurl']; - $banner = $prop['banner']; - $background = $prop['background']; - $bgcolor = $prop['bgcolor']; - $bgrepeat = $prop['bgrepeat']; - $bgcenter = $prop['bgcenter']; - $bgfixed = $prop['bgfixed']; - $bgcover = $prop['bgcover']; - /* Download link for client */ - $client = $prop['client']; - $server = $prop['server']; - /* Server Version and Type*/ - $version = (float)$prop['version']; - $servertype = $prop['type']; - /* Forum url*/ - $forumurl = $prop['forumurl']; - /* Server Rates */ - $exprate = $prop['exprate']; - $mesorate = $prop['mesorate']; - $droprate = $prop['droprate']; - /* Flood Prevention */ - $baseflood = $prop['flood']; - /* Flood Interval */ - $basefloodint = $prop['floodint']; - /* Level for GMs and up */ - $gmlevel = $prop['gmlevel']; - /* Get Theme */ - $theme = $prop['theme']; - $getdarkhemes = array("cyborg", "slate", "superhero", "darkly"); - if (in_array($theme, $getdarkhemes)) { - $themetype = "dark"; - } - /*Get Vote Config*/ - $colnx = $prop['colnx']; - $colvp = $prop['colvp']; - - /* reCAPTCHA Keys */ - $recaptcha_public = ($prop['recaptcha_public'] ?: null); - $recaptcha_private = ($prop['recaptcha_private'] ?: null); + } + $prop = $properties->fetch_assoc(); + $themetype = "light"; + $nav = "navbar navbar-expand-lg navbar-light bg-light"; + $ipaddress = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; + + /* Name of server */ + $servername = $prop['name']; + $siteurl = $prop['siteurl']; + $domain = $prop['domain']; + $banner = $prop['banner']; + $background = $prop['background']; + $bgcolor = $prop['bgcolor']; + $bgrepeat = $prop['bgrepeat']; + $bgcenter = $prop['bgcenter']; + $bgfixed = $prop['bgfixed']; + $bgcover = $prop['bgcover']; + /* Download link for client */ + $client = $prop['client']; + $server = $prop['server']; + /* Server Version and Type*/ + $version = (float)$prop['version']; + $servertype = $prop['type']; + /* Forum url*/ + $forumurl = $prop['forumurl']; + /* Server Rates */ + $exprate = $prop['exprate']; + $mesorate = $prop['mesorate']; + $droprate = $prop['droprate']; + /* Flood Prevention */ + $baseflood = $prop['flood']; + /* Flood Interval */ + $basefloodint = $prop['floodint']; + /* Level for GMs and up */ + $gmlevel = $prop['gmlevel']; + /* Get Theme */ + $theme = $prop['theme']; + $getdarkhemes = array("cyborg", "slate", "superhero", "darkly"); + if (in_array($theme, $getdarkhemes)) { + $themetype = "dark"; + } + /*Get Vote Config*/ + $colnx = $prop['colnx']; + $colvp = $prop['colvp']; + + /* reCAPTCHA Keys */ + $recaptcha_public = ($prop['recaptcha_public'] ?: null); + $recaptcha_private = ($prop['recaptcha_private'] ?: null); - $hash_algorithm = ($prop['hash_algorithm']); - - if ($prop['nav']) { - $nav = "navbar navbar-expand-lg navbar-dark bg-dark"; - } -} catch(Exception $e) { - print("Unable to load MapleBit configuration. Perhaps MapleBit has not been installed yet.
To resolve this, delete assets/config/install/installdone.txt and reload this page."); - exit(); + $hash_algorithm = ($prop['hash_algorithm']); + + if ($prop['nav']) { + $nav = "navbar navbar-expand-lg navbar-dark bg-dark"; + } +} catch (Exception $e) { + print("Unable to load MapleBit configuration. Perhaps MapleBit has not been installed yet.
To resolve this, delete assets/config/install/installdone.txt and reload this page."); + exit(); } -?> \ No newline at end of file diff --git a/assets/config/recaptchalib.php b/assets/config/recaptchalib.php index 36519466..66efbfb9 100644 --- a/assets/config/recaptchalib.php +++ b/assets/config/recaptchalib.php @@ -44,14 +44,16 @@ * @param $data - array of string elements to be encoded * @return string - encoded request */ -function _recaptcha_qsencode ($data) { - $req = ""; - foreach ( $data as $key => $value ) - $req .= $key . '=' . urlencode( stripslashes($value) ) . '&'; - - // Cut the last '&' - $req=substr($req,0,strlen($req)-1); - return $req; +function _recaptcha_qsencode($data) +{ + $req = ""; + foreach ($data as $key => $value) { + $req .= $key . '=' . urlencode(stripslashes($value)) . '&'; + } + + // Cut the last '&' + $req=substr($req, 0, strlen($req)-1); + return $req; } @@ -64,31 +66,32 @@ function _recaptcha_qsencode ($data) { * @param int port * @return array response */ -function _recaptcha_http_post($host, $path, $data, $port = 80) { - - $req = _recaptcha_qsencode ($data); - - $http_request = "POST $path HTTP/1.0\r\n"; - $http_request .= "Host: $host\r\n"; - $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n"; - $http_request .= "Content-Length: " . strlen($req) . "\r\n"; - $http_request .= "User-Agent: reCAPTCHA/PHP\r\n"; - $http_request .= "\r\n"; - $http_request .= $req; - - $response = ''; - if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) { - die ('Could not open socket'); - } - - fwrite($fs, $http_request); - - while ( !feof($fs) ) - $response .= fgets($fs, 1160); // One TCP-IP packet - fclose($fs); - $response = explode("\r\n\r\n", $response, 2); - - return $response; +function _recaptcha_http_post($host, $path, $data, $port = 80) +{ + $req = _recaptcha_qsencode($data); + + $http_request = "POST $path HTTP/1.0\r\n"; + $http_request .= "Host: $host\r\n"; + $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n"; + $http_request .= "Content-Length: " . strlen($req) . "\r\n"; + $http_request .= "User-Agent: reCAPTCHA/PHP\r\n"; + $http_request .= "\r\n"; + $http_request .= $req; + + $response = ''; + if (false == ($fs = @fsockopen($host, $port, $errno, $errstr, 10))) { + die('Could not open socket'); + } + + fwrite($fs, $http_request); + + while (!feof($fs)) { + $response .= fgets($fs, 1160); + } // One TCP-IP packet + fclose($fs); + $response = explode("\r\n\r\n", $response, 2); + + return $response; } @@ -103,23 +106,23 @@ function _recaptcha_http_post($host, $path, $data, $port = 80) { * @return string - The HTML to be embedded in the user's form. */ -function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false) +function recaptcha_get_html($pubkey, $error = null, $use_ssl = false) { - if ($pubkey == null || $pubkey == '') { - die ("To use reCAPTCHA you must get an API key from http://recaptcha.net/api/getkey"); - } - - if ($use_ssl) { - $server = RECAPTCHA_API_SECURE_SERVER; - } else { - $server = RECAPTCHA_API_SERVER; - } - - $errorpart = ""; - if ($error) { - $errorpart = "&error=" . $error; - } - return ' + if ($pubkey == null || $pubkey == '') { + die("To use reCAPTCHA you must get an API key from http://recaptcha.net/api/getkey"); + } + + if ($use_ssl) { + $server = RECAPTCHA_API_SECURE_SERVER; + } else { + $server = RECAPTCHA_API_SERVER; + } + + $errorpart = ""; + if ($error) { + $errorpart = "&error=" . $error; + } + return '