Adult Rated Regions in jOpenSim? my Snippets here

7 years 6 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.112 seconds

Search

Donate jOpenSim

Please consider supporting our efforts.

Amount

Our Regions

Region: Loc X: Loc Y:
Agora 1000 998
Bay Sho… 997 1003
BoraBor… 1002 999
Canary … 997 999
Crystal… 1001 1000
DeepTho… 1005 998
FoToSan… 996 995
jCity 1001 997
jOpenWe… 1000 999
JuniorT… 1002 1001
Kanadah… 1002 1000
LindaKe… 1000 997
MonteSc… 1001 1001
Naos 999 999
Pangaea 1005 1003
RiverSi… 999 1000
Sakani 999 998
Snambin 1001 998
ViewerH… 1002 998
WaterWo… 1001 999
WilderK… 1000 1000