Send user into a room depending on url, url/client?room=X

Yorick

Member
Aug 10, 2016
39
3
In plus EMU R2, and may other emulators you can use in your event alert:
Code:
event:navigator/goto/x
that then will send you to the specified room, when you hit the button where the event is placed on.
So you would say its also possible with the url, just got to eget the ID with some php, but then
you need to echo a link or?

Would really like to know how to do this :?
 

Yorick

Member
Aug 10, 2016
39
3
When they go to the webpage /hotel?room=X i want them when they connect to go to room X and not any set homeroom as they normally would go.
To have a user go to a room, you got that event from Eventalert go to button
 

Berk

berkibap#4233
Developer
Oct 17, 2015
863
190
Try this:
PHP:
<?php
if(isset($_GET['room']))
{
    $roomid = mysql_real_escape_string($_GET['room']);
    mysql_query("UPDATE users SET home_room = '". $roomid ."' WHERE id = '".$_SESSION['user']['id']."'");
    // optional, uncomment if you wish.
    //echo "<script>alert('Forwarded you to room ' + ". $roomid .")</script>";
}
?>
Add this to your client.php
Note: I've done this for rev, if you want you can edit the $_SESSION['user']['id'] part corresponding to your session variable.
Note 2: This might be vulnerable to injection, use PDO instead.
 

Yorick

Member
Aug 10, 2016
39
3
Try this:
PHP:
<?php
if(isset($_GET['room']))
{
    $roomid = mysql_real_escape_string($_GET['room']);
    mysql_query("UPDATE users SET home_room = '". $roomid ."' WHERE id = '".$_SESSION['user']['id']."'");
    // optional, uncomment if you wish.
    //echo "<script>alert('Forwarded you to room ' + ". $roomid .")</script>";
}
?>
Add this to your client.php
Note: I've done this for rev, if you want you can edit the $_SESSION['user']['id'] part corresponding to your session variable.
Note 2: This might be vulnerable to injection, use PDO instead.

Seems like a good solution but it would set the home room and not just do a quick send, you could set it back but then you would need to wait and x amount of time before you can do that because other wise it would still be useless....
 

Whatever

New Member
Oct 10, 2017
4
2
The above examples may work, but in parts. The correct way to do this is by adding this to your client.php:
"forward.type" : "2",
"forward.id" : ID ROOM,

forward.id will be the id of the room that will access
forward.type by default, leave 2
 

Users who are viewing this thread

Top