Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
[R63 RP] Beta code
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Jaden" data-source="post: 341413" data-attributes="member: 51705"><p>Heres my code, Runs with Regular RevCMS.</p><p>[PHP]</p><p><?php</p><p>$_messages = [];</p><p></p><p>function generateBetaKey($k = 0) {</p><p> global $engine;</p><p></p><p> if ($k == 0) {</p><p> $k = rand(1000, 9999);</p><p> $engine->query("INSERT INTO `beta_keys` (key, used) VALUES('".$k."', '0');");</p><p> </p><p> $_messages['beta_success'] = 'Successfully generated a random beta key ('.$k.').';</p><p> return;</p><p> }</p><p></p><p> $engine->query("INSERT INTO `beta_keys` (key, used) VALUES('".$k."', '0');");</p><p> $messages['beta_success'] = 'Successfully generated the beta key ('.$k.').';</p><p> return;</p><p>}</p><p></p><p>function checkBetaKey($key) {</p><p> global $engine;</p><p></p><p> if ($engine->num_rows("SELECT null FROM `beta_keys` WHERE `key` = '".$key."' AND `used` = '0' LIMIT 1;") > 0) {</p><p> return true;</p><p> }</p><p></p><p> return false;</p><p>}</p><p></p><p>if (isset($_POST['beta_submit'])) {</p><p> if (isset($_POST['beta_key'])) {</p><p> </p><p> $k = $_POST['beta_key'];</p><p> </p><p> if ($k < 4) {</p><p> $_messages['submit-error'] = 'Your beta key must be atleast 4 numbers!';</p><p> return;</p><p> }</p><p> else {</p><p> if (checkBetaKey($k)) {</p><p> $engine->query("UPDATE `users` SET `beta` = '1' WHERE `id` = '".$_SESSION['user_id']."' LIMIT 1;");</p><p> $engine->query("UPDATE `beta_keys` SET `used` = '1' WHERE `key` = '".$k."' LIMIT 1;");</p><p> $_messages['beta_success'] = "You've successfully registered as a BETA user.";</p><p> return;</p><p> }</p><p> else {</p><p> $_messages['submit-error'] = "You've entered an invalid beta key!";</p><p> return;</p><p> }</p><p> }</p><p> }</p><p> else if (isset($_POST['beta_create'])) {</p><p> </p><p> $k = $_POST['beta_key'];</p><p> </p><p> if ($k < 4) {</p><p> $_messages['submit-error'] = 'Your beta key must be atleast 4 numbers!';</p><p> return;</p><p> }</p><p> else {</p><p> generateBetaKey($k);</p><p> return;</p><p> }</p><p> }</p><p> else {</p><p> $_messages['submit-error'] = 'Please enter a valid key!';</p><p> return;</p><p> }</p><p>}</p><p>?></p><p>[/PHP]</p><p>You can just hit me up for the HTML form, that's for your page where you enter your beta codes.</p><p>Also added a special feature which allows you to generate a new beta key if you're staff.</p><p>[PHP]<?php</p><p>global $engine;</p><p></p><p>if ($engine->num_rows("SELECT null FROM `users` WHERE `beta` = '1' AND `id` = '".$_SESSION['user_id']."' LIMIT 1;") <= 0) {</p><p> echo("You don't have beta access.");</p><p> exit;</p><p>}</p><p>?>[/PHP]</p><p>For the pages restricted to BETA testers (Add to the very TOP of the page).</p><p>[PHP]<?php</p><p>if (isset($_messages['beta_success'])) {</p><p> echo '<div clas="some-custom-css">'.$_messages['beta_success'].'</div>';</p><p>}</p><p>?>[/PHP]</p><p>And that's how the message system works...</p><p>Again, let me know if you need the HTML... Sorry for the messy code I was in a rush!</p></blockquote><p></p>
[QUOTE="Jaden, post: 341413, member: 51705"] Heres my code, Runs with Regular RevCMS. [PHP] <?php $_messages = []; function generateBetaKey($k = 0) { global $engine; if ($k == 0) { $k = rand(1000, 9999); $engine->query("INSERT INTO `beta_keys` (key, used) VALUES('".$k."', '0');"); $_messages['beta_success'] = 'Successfully generated a random beta key ('.$k.').'; return; } $engine->query("INSERT INTO `beta_keys` (key, used) VALUES('".$k."', '0');"); $messages['beta_success'] = 'Successfully generated the beta key ('.$k.').'; return; } function checkBetaKey($key) { global $engine; if ($engine->num_rows("SELECT null FROM `beta_keys` WHERE `key` = '".$key."' AND `used` = '0' LIMIT 1;") > 0) { return true; } return false; } if (isset($_POST['beta_submit'])) { if (isset($_POST['beta_key'])) { $k = $_POST['beta_key']; if ($k < 4) { $_messages['submit-error'] = 'Your beta key must be atleast 4 numbers!'; return; } else { if (checkBetaKey($k)) { $engine->query("UPDATE `users` SET `beta` = '1' WHERE `id` = '".$_SESSION['user_id']."' LIMIT 1;"); $engine->query("UPDATE `beta_keys` SET `used` = '1' WHERE `key` = '".$k."' LIMIT 1;"); $_messages['beta_success'] = "You've successfully registered as a BETA user."; return; } else { $_messages['submit-error'] = "You've entered an invalid beta key!"; return; } } } else if (isset($_POST['beta_create'])) { $k = $_POST['beta_key']; if ($k < 4) { $_messages['submit-error'] = 'Your beta key must be atleast 4 numbers!'; return; } else { generateBetaKey($k); return; } } else { $_messages['submit-error'] = 'Please enter a valid key!'; return; } } ?> [/PHP] You can just hit me up for the HTML form, that's for your page where you enter your beta codes. Also added a special feature which allows you to generate a new beta key if you're staff. [PHP]<?php global $engine; if ($engine->num_rows("SELECT null FROM `users` WHERE `beta` = '1' AND `id` = '".$_SESSION['user_id']."' LIMIT 1;") <= 0) { echo("You don't have beta access."); exit; } ?>[/PHP] For the pages restricted to BETA testers (Add to the very TOP of the page). [PHP]<?php if (isset($_messages['beta_success'])) { echo '<div clas="some-custom-css">'.$_messages['beta_success'].'</div>'; } ?>[/PHP] And that's how the message system works... Again, let me know if you need the HTML... Sorry for the messy code I was in a rush! [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
[R63 RP] Beta code
Top