1
I'm already trying to find a module and hack for such a long time that I now urgently need a solution to my problem.
There are some things to be done:
1) the website field in the registration should be checked if excists. It should be unique, so I thought about this:
function ls_a($wh,$url){
$occupied=0;
if ($handle = opendir($wh)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." ) {
if($file == $url){
$bezet = 1;
}
}
}
closedir($handle);
}
return $occupied;
}
$restriction = '/[^A-z0-9_]/';
if ($submit){
$bezet=ls_a('../',$url);
if (!eregi(" ", $url)){
if (!preg_match($restriction,$url)){
if ($bezet == 0){
$doorgaan ='true';
}
else{
$stop = "The sitename already excists
";
$continue ='false';
}
}
else{
$stop = "Please do not use spaces or special characters in your sitename";
$continue ='false';
}
}
else{
$stop = "Please do not use spaces in your sitename
";
$continue ='false';
}
}
?>
The executemkdir.php:
$site =strtolower($url);
function cp($wf, $wto){
mkdir($wto,0777);
$arr=ls_a($wf);
foreach ($arr as $fn){
if($fn){
$fl="$wf/$fn";
$flto="$wto/$fn";
if(is_dir($fl)) cp($fl,$flto);
else copy($fl,$flto);
}
}
}
function ls_a($wh){
if ($handle = opendir($wh)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." ) {
if(!$files) $files="$file";
else $files="$filen$files";
}
}
closedir($handle);
}
$arr=explode("n",$files);
return $arr;
}
$oldname = "../" . $keuze . "/";
$newname = "../" . $site . "/";
cp($oldname, $newname) ;
$bestand = '../' . $site . '/settings.php';
include $bestand;
$admin_email = $email;
$title = $site;
$jt = fopen( $bestand, 'w+' );
fwrite( $jt, stripslashes("$title='$title';?>$meta_name_keywords='$meta_name_keywords';?>$meta_name_description='$meta_name_description';?>$username='$username';?>$password='$password';?>$admin_email='$admin_email';?>$url_img='$url_img';?>$path_img='$path_img';?>$body_bg_color='$body_bg_color';?>$header_bg_color='$header_bg_color';?>$content_bg_color='$content_bg_color';?>$menu_bg_color='$menu_bg_color';?>$footer_bg_color='$footer_bg_color';?>$table_width='$table_width';?>$table_height='$table_height';?>$cell_padding='$cell_padding';?>$url='$url';?>$boodschap='$boodschap';?>" ) );
fclose( $jt );
?>
Ok, this is rough, but the idea is that after I approved registration a subdir with the $url should be created. It already works (I tried to translate some vars because they were in dutch)
The question is: can I put the first snippet in the register.php of xoops, and where?