lwb5-in-2025/scripts/game/main/library.inc

37 lines
618 B
PHP

<?php
class main_library {
var $index = array(
'getTick',
'getTicks',
'isGameRunning',
'preJoin',
'requestGenPlanets',
'sendMail'
);
function __construct($lib) {
$this->lib = $lib;
$this->db = $this->lib->game->db;
}
function isValidAddress($mAddr) {
return preg_match(
'/^[A-Za-z0-9_\.\-\+]+@([A-Za-z0-9_\.\-\+]+)+\.[A-Za-z]{2,6}/',
$mAddr
);
}
function isValidName($uName) {
$test = array('/[^A-Za-z0-9_\.\-\+@\/'."'".' ]/', '/\s\s+/', '/^\s/', '/\s$/');
$r = true;
for ($i=0;$r&&$i<count($test);$i++) {
$r &= !preg_match($test[$i], $uName);
}
return $r;
}
}
?>