jOpenSimWorld

Grid Status: Online
Total Regions: 23
Visitors (30 Days): 9
Total Residents: 490
Online Now: 0
Hypergriders online: 0

Adult Rated Regions in jOpenSim? my Snippets here

10 years 9 months ago #2092 by rico87
Just wanted to ask if jOpenSim could get age verification for inworld regions?

i successfully managed to do this without any additional Modules, i post them here maybe they are of use to jOpenSim?
<?php
$test = mysql_connect("localhost","xxx","xxx");
$data = mysql_select_db("xxx");
$check = "SELECT UserID,LastRegionID FROM GridUser WHERE Online='True'";
$prepare = mysql_query($check);
while($result = mysql_fetch_array($prepare))
{
$user = mysql_fetch_array(mysql_query("SELECT FirstName,LastName FROM UserAccounts WHERE PrincipalID='$result[0]'"));
$age = mysql_fetch_array(mysql_query("SELECT age FROM agecheck WHERE UUID='$result[0]'"));
$rating = mysql_fetch_array(mysql_query("SELECT maturity FROM regionsettings WHERE regionUUID='$result[1]'"));
if ($rating[0] == "2" && (int)$age[0] < 18)
{
echo exec("sudo /opt/open/bin/test.sh $user[0] $user[1]");
}
}

?>
this is the PHP

now comes the bash
#!/bin/sh
screen -S open -p 0 -X stuff "`printf "change region root\r"`";
screen -S open -p 0 -X stuff "`printf "alert-user $1 $2 Sorry $1 $2 this Region is Adult Rated and you are not Age Verified\r"`";
sleep 5s;
screen -S open -p 0 -X stuff "`printf "teleport user $1 $2 Welcome/128/128/21\r"`";

and the cronjob (i use a 5 seconds loop but not all servers can handle this so the workaround is a 1 minute cronjob)
*/1 * * * * php /var/www/agecheck.php
and last but not least the SQL
CREATE TABLE IF NOT EXISTS `agecheck` (
  `UUID` varchar(255) NOT NULL,
  `age` varchar(255) NOT NULL,
  UNIQUE KEY `UUID` (`UUID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

right now this is not comparing birthdate to current date, however thats probably the best solution, also giving apache sudo rights is not a good idea, however in my setup only my server ip has access to port 80

Please Log in or Create an account to join the conversation.

Time to create page: 0.071 seconds