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 Releases
CMS Releases
[REV] Staff Client PIN System
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="Seriosk" data-source="post: 388224" data-attributes="member: 72056"><p>Hello, since everyone seems to be releasing staff pin systems at the moment I thought I would release my own I coded a few weeks back, the code is still up to date and works really well in my opinion, anyway here we go... Didn't really take my time with this so its pretty rusty, should of actually created a proper system for this instead of just dumping it in client.php</p><p></p><p>First, you need to execute this query to add a 'client_pin_code' column to your database.</p><p>[CODE]</p><p>ALTER TABLE `users` ADD `client_pin_code` INT(4) NOT NULL DEFAULT '1234';</p><p>[/CODE]</p><p></p><p>Now, here is the PHP code, just put it before anything in your client.php file.</p><p>[CODE]</p><p><?php</p><p>$minRank = 4; // Minimum rank to require pin.</p><p></p><p>if ($_SESSION['user']['rank'] >= $minRank)</p><p>{</p><p> if ($_SESSION['user']['client_pin_code'] == '1234')</p><p> {</p><p> header("location: set_client_pin"); // default pin...</p><p> exit();</p><p> }</p><p> </p><p> if (!$_SESSION['user']['unlocked_client'])</p><p> {</p><p> header("location: enter_client_pin");</p><p> exit();</p><p> }</p><p>}</p><p>?></p><p>[/CODE]</p><p></p><p>set_client_pin.php:</p><p>[CODE]</p><p><?php</p><p>if ($_SESSION['user']['client_pin_code'] != '1234')</p><p>{</p><p> header("location: client");</p><p> exit();</p><p>}</p><p></p><p>if (isset($_POST['set_pin_form_submit']))</p><p>{</p><p> $pin = isset($_POST['pin_code']) ? $_POST['pin_code'] : '';</p><p> </p><p> if (strlen($pin) != 4 || !is_int($pin))</p><p> {</p><p> $error = 'You have entered an incorrect PIN code, try again.';</p><p> }</p><p> </p><p> if ($pin == '1234')</p><p> {</p><p> $error = 'You can\'t use 1234 as your pin, its too obvious...';</p><p> }</p><p>}</p><p>?></p><p><!DOCTYPE html></p><p><html lang="en-gb"></p><p><head></p><p><title>{hotelName} - Pin Setup</title></p><p></head></p><p><body></p><p><?php</p><p>if (isset($error))</p><p>{</p><p> echo '<font color="red">' . $error . '</font>';</p><p>}</p><p>else</p><p>{</p><p> mysql_query("UPDATE `users` SET `client_pin_code` = '" . mysql_real_escape_string($pin) . "' WHERE `id` = '" . mysql_real_escape_string($_SESSION['user']['id']) . "' LIMIT 1");</p><p> </p><p> header("location: client");</p><p> exit();</p><p>}</p><p>?></p><p></p><p><form name="set_pin_form" method="post"></p><p><input type="text" name="pin_code" placeholder="Enter your pin"></p><p><input type="submit" name="set_pin_form_submit" value="Set PIN"></p><p></form></p><p></body></p><p></html></p><p>[/CODE]</p><p></p><p>enter_client_pin:</p><p>[CODE]</p><p><?php</p><p>if (isset($_POST['set_pin_form_submit']) && $_SESSION['user']['client_pin_code'] != $_POST['pin_code'])</p><p>{</p><p> $error = 'Incorrect pin';</p><p>}</p><p>?></p><p><!DOCTYPE html></p><p><html lang="en-gb"></p><p><head></p><p><title>{hotelName} - Enter PIN</title></p><p></head></p><p><body></p><p><?php</p><p>if (isset($error))</p><p>{</p><p> echo '<font color="red">' . $error . '</font>';</p><p>}</p><p>else</p><p>{</p><p> $_SESSION['user']['client_unlocked'] = true;</p><p> header("location: client");</p><p> exit();</p><p>}</p><p>?></p><p></p><p><form name="enter_pin_form" method="post"></p><p><input type="text" name="pin_code" placeholder="Enter your pin"></p><p><input type="submit" name="enter_pin_form_submit" value="Enter"></p><p></form></p><p></body></p><p></html></p><p>[/CODE]</p><p></p><p>So ye, that is the full code.. I could of done it a lot better by coding it with functions and all in one page but it was at a time where I just dint have the motivation to do that, if it doesn't work let me know its literally need sat in my CDN folder for weeks and I haven't even tested it, but if there are any issues I'll modify the post with fixed code. <img src="/styles/default/xenforo/smilies/emojione/biggrin.png" class="smilie" loading="lazy" alt=":D" title="Big Grin :D" data-shortname=":D" /></p><p></p><p><strong>No design?</strong></p><p>Couldn't be bothered to code css for it so ye, sorry but I might add some css or a design for it later, heading off.</p><p></p><p>You might have to load client_pin_code column from class.users.php depending on what version of rev your on, some "SELECT *" shit but ye, your welcome.</p><p></p><p>Might do a 2.0 of this with ajax and no reloading if this gets support, let me know if you want that <img src="/styles/default/xenforo/smilies/emojione/thumbsup.png" class="smilie" loading="lazy" alt=":up:" title="Thumbs Up :up:" data-shortname=":up:" /></p></blockquote><p></p>
[QUOTE="Seriosk, post: 388224, member: 72056"] Hello, since everyone seems to be releasing staff pin systems at the moment I thought I would release my own I coded a few weeks back, the code is still up to date and works really well in my opinion, anyway here we go... Didn't really take my time with this so its pretty rusty, should of actually created a proper system for this instead of just dumping it in client.php First, you need to execute this query to add a 'client_pin_code' column to your database. [CODE] ALTER TABLE `users` ADD `client_pin_code` INT(4) NOT NULL DEFAULT '1234'; [/CODE] Now, here is the PHP code, just put it before anything in your client.php file. [CODE] <?php $minRank = 4; // Minimum rank to require pin. if ($_SESSION['user']['rank'] >= $minRank) { if ($_SESSION['user']['client_pin_code'] == '1234') { header("location: set_client_pin"); // default pin... exit(); } if (!$_SESSION['user']['unlocked_client']) { header("location: enter_client_pin"); exit(); } } ?> [/CODE] set_client_pin.php: [CODE] <?php if ($_SESSION['user']['client_pin_code'] != '1234') { header("location: client"); exit(); } if (isset($_POST['set_pin_form_submit'])) { $pin = isset($_POST['pin_code']) ? $_POST['pin_code'] : ''; if (strlen($pin) != 4 || !is_int($pin)) { $error = 'You have entered an incorrect PIN code, try again.'; } if ($pin == '1234') { $error = 'You can\'t use 1234 as your pin, its too obvious...'; } } ?> <!DOCTYPE html> <html lang="en-gb"> <head> <title>{hotelName} - Pin Setup</title> </head> <body> <?php if (isset($error)) { echo '<font color="red">' . $error . '</font>'; } else { mysql_query("UPDATE `users` SET `client_pin_code` = '" . mysql_real_escape_string($pin) . "' WHERE `id` = '" . mysql_real_escape_string($_SESSION['user']['id']) . "' LIMIT 1"); header("location: client"); exit(); } ?> <form name="set_pin_form" method="post"> <input type="text" name="pin_code" placeholder="Enter your pin"> <input type="submit" name="set_pin_form_submit" value="Set PIN"> </form> </body> </html> [/CODE] enter_client_pin: [CODE] <?php if (isset($_POST['set_pin_form_submit']) && $_SESSION['user']['client_pin_code'] != $_POST['pin_code']) { $error = 'Incorrect pin'; } ?> <!DOCTYPE html> <html lang="en-gb"> <head> <title>{hotelName} - Enter PIN</title> </head> <body> <?php if (isset($error)) { echo '<font color="red">' . $error . '</font>'; } else { $_SESSION['user']['client_unlocked'] = true; header("location: client"); exit(); } ?> <form name="enter_pin_form" method="post"> <input type="text" name="pin_code" placeholder="Enter your pin"> <input type="submit" name="enter_pin_form_submit" value="Enter"> </form> </body> </html> [/CODE] So ye, that is the full code.. I could of done it a lot better by coding it with functions and all in one page but it was at a time where I just dint have the motivation to do that, if it doesn't work let me know its literally need sat in my CDN folder for weeks and I haven't even tested it, but if there are any issues I'll modify the post with fixed code. :D [B]No design?[/B] Couldn't be bothered to code css for it so ye, sorry but I might add some css or a design for it later, heading off. You might have to load client_pin_code column from class.users.php depending on what version of rev your on, some "SELECT *" shit but ye, your welcome. Might do a 2.0 of this with ajax and no reloading if this gets support, let me know if you want that :up: [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Releases
CMS Releases
[REV] Staff Client PIN System
Top