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
How to enable and disable friend requests (Help Please)
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="Hypothesis" data-source="post: 467722" data-attributes="member: 83881"><p>Your code runs fine, you were just missing semicolons after your echo statements. Although, I will say this isn't a very good way to update things in your database. Could be a security problem, recommended that you move this into your class.users.php and have it all update from there.</p><p>[CODE=php]<div class="content-box"></p><p> <div class="title">Friend Requests</div></p><p> <div class="box-content d-flex justify-content-center align-items-center"></p><p> <?php</p><p></p><p> if (isset($_POST['profileForm'])) {</p><p> </p><p> $efr = filter($_POST['friendRequestsAllowed']);</p><p> </p><p> if ($efr == 1) {</p><p> </p><p> echo '<div class="ml-3 mr-auto">You currently have friend requests <b>Disabled</b></div>';</p><p> </p><p> mysql_query("UPDATE users SET block_newfriends = '0' WHERE id = '" . $_SESSION['user']['id'] . "'");</p><p> }</p><p> else if ($efr == 0) {</p><p> </p><p> echo '<div class="ml-3 mr-auto">You currently have friend requests <b>Enabled</b></div>';</p><p> </p><p> mysql_query("UPDATE users SET block_newfriends = '1' WHERE id = '" . $_SESSION['user']['id'] . "'");</p><p> }</p><p> }</p><p></p><p>?></p><p> <div class="mr-3"></p><p> <form method="post" id="profileForm" class="form-block"></p><p> <input type="hidden" name="_token" value="4e26eaf44aedd954ff26441a92b2b42bbe4d1ada"></p><p> <input type="hidden" name="block_friend_requests" value="" value="true"></p><p> <?php</p><p></p><p> if (isset($_POST['profileForm'])) {</p><p> </p><p> $efr = filter($_POST['friendRequestsAllowed']);</p><p> </p><p> if ($efr == 1) {</p><p> </p><p> echo '<button type="submit" name="friendRequestsAllowed" class="button green">Disable</button>';</p><p> </p><p> mysql_query("UPDATE users SET block_newfriends = '0' WHERE id = '" . $_SESSION['user']['id'] . "'");</p><p> }</p><p> else if ($efr == 0) {</p><p> </p><p> echo '<button type="submit" name="friendRequestsAllowed" class="button green">Enabled</button>';</p><p> </p><p> mysql_query("UPDATE users SET block_newfriends = '1' WHERE id = '" . $_SESSION['user']['id'] . "'");</p><p> }</p><p> }</p><p></p><p>?></p><p></form>[/CODE]</p></blockquote><p></p>
[QUOTE="Hypothesis, post: 467722, member: 83881"] Your code runs fine, you were just missing semicolons after your echo statements. Although, I will say this isn't a very good way to update things in your database. Could be a security problem, recommended that you move this into your class.users.php and have it all update from there. [CODE=php]<div class="content-box"> <div class="title">Friend Requests</div> <div class="box-content d-flex justify-content-center align-items-center"> <?php if (isset($_POST['profileForm'])) { $efr = filter($_POST['friendRequestsAllowed']); if ($efr == 1) { echo '<div class="ml-3 mr-auto">You currently have friend requests <b>Disabled</b></div>'; mysql_query("UPDATE users SET block_newfriends = '0' WHERE id = '" . $_SESSION['user']['id'] . "'"); } else if ($efr == 0) { echo '<div class="ml-3 mr-auto">You currently have friend requests <b>Enabled</b></div>'; mysql_query("UPDATE users SET block_newfriends = '1' WHERE id = '" . $_SESSION['user']['id'] . "'"); } } ?> <div class="mr-3"> <form method="post" id="profileForm" class="form-block"> <input type="hidden" name="_token" value="4e26eaf44aedd954ff26441a92b2b42bbe4d1ada"> <input type="hidden" name="block_friend_requests" value="" value="true"> <?php if (isset($_POST['profileForm'])) { $efr = filter($_POST['friendRequestsAllowed']); if ($efr == 1) { echo '<button type="submit" name="friendRequestsAllowed" class="button green">Disable</button>'; mysql_query("UPDATE users SET block_newfriends = '0' WHERE id = '" . $_SESSION['user']['id'] . "'"); } else if ($efr == 0) { echo '<button type="submit" name="friendRequestsAllowed" class="button green">Enabled</button>'; mysql_query("UPDATE users SET block_newfriends = '1' WHERE id = '" . $_SESSION['user']['id'] . "'"); } } ?> </form>[/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
How to enable and disable friend requests (Help Please)
Top