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
[Release] Staff Pin System for the client
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="Zodiak" data-source="post: 380479" data-attributes="member: 9300"><p>Cleaned/Edited the PHP code, just preference in-case anybody wants to use it.</p><p>(Haven't tested, quickly did this in notepad without even saving it + I'm tired af so yolo)</p><p></p><p>Bottom of client.php:</p><p>[PHP]</p><p><?php</p><p> if(isset($_SESSION['user']['id'])) {</p><p> $database_connection = null;</p><p> try {</p><p> $database_connection = new MySQLi("localhost", "root", "my sql password", "database name");</p><p> </p><p> $getUser = $database_connection->query("SELECT `rank` FROM `users` WHERE `id` = '".$database_connection->real_escape_string($_SESSION['user']['id'])."' LIMIT 1"); </p><p> if($getUser->num_rows >= 1) {</p><p> $userRow = $getUser->fetch_object();</p><p> </p><p> if(($userRow->rank >= 2) && (!isset($_SESSION["correct_key"]))) { ?></p><p> <form action='spk' method='post'></p><p> <select name='first'></p><p> <option value='0'>0</option></p><p> <option value='1'>1</option></p><p> <option value='2'>2</option></p><p> <option value='3'>3</option></p><p> <option value='4'>4</option></p><p> <option value='5'>5</option></p><p> <option value='6'>6</option></p><p> <option value='7'>7</option></p><p> <option value='8'>8</option></p><p> <option value='9'>9</option></p><p> </select></p><p> <select name='second'></p><p> <option value='0'>0</option></p><p> <option value='1'>1</option></p><p> <option value='2'>2</option></p><p> <option value='3'>3</option></p><p> <option value='4'>4</option></p><p> <option value='5'>5</option></p><p> <option value='6'>6</option></p><p> <option value='7'>7</option></p><p> <option value='8'>8</option></p><p> <option value='9'>9</option></p><p> </select></p><p> <select name='third'></p><p> <option value='0'>0</option></p><p> <option value='1'>1</option></p><p> <option value='2'>2</option></p><p> <option value='3'>3</option></p><p> <option value='4'>4</option></p><p> <option value='5'>5</option></p><p> <option value='6'>6</option></p><p> <option value='7'>7</option></p><p> <option value='8'>8</option></p><p> <option value='9'>9</option></p><p> </select></p><p> <select name='fourth'></p><p> <option value='0'>0</option></p><p> <option value='1'>1</option></p><p> <option value='2'>2</option></p><p> <option value='3'>3</option></p><p> <option value='4'>4</option></p><p> <option value='5'>5</option></p><p> <option value='6'>6</option></p><p> <option value='7'>7</option></p><p> <option value='8'>8</option></p><p> <option value='9'>9</option></p><p> </select></p><p> <br /></p><p> <input type='submit' name='staff_key' value='Go' /></p><p> </form></p><p> <?php</p><p> exit;</p><p> }</p><p> } else {</p><p> echo "Sorry, something went wrong with your account, apparently you do not exist, please try logging in.";</p><p> exit;</p><p> }</p><p> } catch(Exception $e) {</p><p> echo "Error connecting to database!<br />";</p><p> echo "Error: " . $e->getMessage();</p><p> exit;</p><p> }</p><p> } else {</p><p> echo "Sorry, something went wrong with your account, apparently you do not exist, please try logging in.";</p><p> exit;</p><p> }</p><p>?></p><p></p><p>[/PHP]</p><p></p><p>spk.php:</p><p>[PHP]</p><p><?php</p><p> session_start();</p><p> $database_connection = null;</p><p> </p><p> function filter($str) {</p><p> if(isset($database_connection) && ($database_connection != null))</p><p> return strip_tags(stripslashes($database_connection->real_escape_string($str)));</p><p> </p><p> return strip_tags(stripslashes($str));</p><p> }</p><p> </p><p> if((isset($_POST['first'])) && (isset($_POST['second'])) && (isset($_POST['third'])) && (isset($_POST['fourth']))) {</p><p> if(isset($_SESSION['user']['id'])) {</p><p> try {</p><p> try {</p><p> $database_connection = new MySQLi("localhost", "root", "$wqoiwqwqs", "db name");</p><p> } catch(Exception $e) {</p><p> throw $e;</p><p> }</p><p> </p><p> $key = filter($_POST["first"]).filter($_POST["second"]).filter($_POST["third"]).filter($_POST["fourth"]);</p><p> </p><p> if((isset($key)) && ((strlen($key) == 4) && (ctype_digit($key)))) {</p><p> $getUser = $database_connection->query("SELECT `staff_pin` FROM `users` WHERE `id` = '".filter($_SESSION['user']['id'])."' LIMIT 1");</p><p> if($getUser->num_rows >= 1) {</p><p> $row = $query->fetch_object();</p><p> if($key === $row->staff_pin) {</p><p> session_start();</p><p> $_SESSION["correct_key"] = $key;</p><p> } else {</p><p> throw new Exception("Incorrect Key!");</p><p> }</p><p> } else {</p><p> throw new Exception("You don't exist.");</p><p> }</p><p> } else {</p><p> throw new Exception("Key must be 4 numbers...");</p><p> }</p><p> } catch(Exception $e) {</p><p> echo $e->getMessage();</p><p> exit;</p><p> }</p><p> }</p><p> }</p><p>?></p><p>[/PHP]</p></blockquote><p></p>
[QUOTE="Zodiak, post: 380479, member: 9300"] Cleaned/Edited the PHP code, just preference in-case anybody wants to use it. (Haven't tested, quickly did this in notepad without even saving it + I'm tired af so yolo) Bottom of client.php: [PHP] <?php if(isset($_SESSION['user']['id'])) { $database_connection = null; try { $database_connection = new MySQLi("localhost", "root", "my sql password", "database name"); $getUser = $database_connection->query("SELECT `rank` FROM `users` WHERE `id` = '".$database_connection->real_escape_string($_SESSION['user']['id'])."' LIMIT 1"); if($getUser->num_rows >= 1) { $userRow = $getUser->fetch_object(); if(($userRow->rank >= 2) && (!isset($_SESSION["correct_key"]))) { ?> <form action='spk' method='post'> <select name='first'> <option value='0'>0</option> <option value='1'>1</option> <option value='2'>2</option> <option value='3'>3</option> <option value='4'>4</option> <option value='5'>5</option> <option value='6'>6</option> <option value='7'>7</option> <option value='8'>8</option> <option value='9'>9</option> </select> <select name='second'> <option value='0'>0</option> <option value='1'>1</option> <option value='2'>2</option> <option value='3'>3</option> <option value='4'>4</option> <option value='5'>5</option> <option value='6'>6</option> <option value='7'>7</option> <option value='8'>8</option> <option value='9'>9</option> </select> <select name='third'> <option value='0'>0</option> <option value='1'>1</option> <option value='2'>2</option> <option value='3'>3</option> <option value='4'>4</option> <option value='5'>5</option> <option value='6'>6</option> <option value='7'>7</option> <option value='8'>8</option> <option value='9'>9</option> </select> <select name='fourth'> <option value='0'>0</option> <option value='1'>1</option> <option value='2'>2</option> <option value='3'>3</option> <option value='4'>4</option> <option value='5'>5</option> <option value='6'>6</option> <option value='7'>7</option> <option value='8'>8</option> <option value='9'>9</option> </select> <br /> <input type='submit' name='staff_key' value='Go' /> </form> <?php exit; } } else { echo "Sorry, something went wrong with your account, apparently you do not exist, please try logging in."; exit; } } catch(Exception $e) { echo "Error connecting to database!<br />"; echo "Error: " . $e->getMessage(); exit; } } else { echo "Sorry, something went wrong with your account, apparently you do not exist, please try logging in."; exit; } ?> [/PHP] spk.php: [PHP] <?php session_start(); $database_connection = null; function filter($str) { if(isset($database_connection) && ($database_connection != null)) return strip_tags(stripslashes($database_connection->real_escape_string($str))); return strip_tags(stripslashes($str)); } if((isset($_POST['first'])) && (isset($_POST['second'])) && (isset($_POST['third'])) && (isset($_POST['fourth']))) { if(isset($_SESSION['user']['id'])) { try { try { $database_connection = new MySQLi("localhost", "root", "$wqoiwqwqs", "db name"); } catch(Exception $e) { throw $e; } $key = filter($_POST["first"]).filter($_POST["second"]).filter($_POST["third"]).filter($_POST["fourth"]); if((isset($key)) && ((strlen($key) == 4) && (ctype_digit($key)))) { $getUser = $database_connection->query("SELECT `staff_pin` FROM `users` WHERE `id` = '".filter($_SESSION['user']['id'])."' LIMIT 1"); if($getUser->num_rows >= 1) { $row = $query->fetch_object(); if($key === $row->staff_pin) { session_start(); $_SESSION["correct_key"] = $key; } else { throw new Exception("Incorrect Key!"); } } else { throw new Exception("You don't exist."); } } else { throw new Exception("Key must be 4 numbers..."); } } catch(Exception $e) { echo $e->getMessage(); exit; } } } ?> [/PHP] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Releases
CMS Releases
[Release] Staff Pin System for the client
Top