Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision |
cern:index [2023/09/29 17:29] – iwn | cern:index [2023/10/04 16:10] (current) – iwn |
---|
preg_match("|^(\w+)\.|",$_SERVER["SERVER_NAME"],$usr); // get username from hostname $USER.web.cern.ch | preg_match("|^(\w+)\.|",$_SERVER["SERVER_NAME"],$usr); // get username from hostname $USER.web.cern.ch |
$pwd = preg_replace("|^((\w)\w+)|","/eos/user/$2/$1/www/",$usr[1]); // get base path | $pwd = preg_replace("|^((\w)\w+)|","/eos/user/$2/$1/www/",$usr[1]); // get base path |
$pwd = $pwd.preg_replace("|^(?:\/$usr[1]\/)?([^\?]*)(?:\?.*)?$|","$1",$_SERVER["REQUEST_URI"]); // get subdirectory | $pwd = $pwd.preg_replace("|^\/(?:$usr[1]\/)?([^\?]*)(?:\?.*)?$|","$1",$_SERVER["REQUEST_URI"]); // get subdirectory |
//$pwd = $pwd.preg_replace("|(?<=\/)\?.*|","",$_SERVER["REQUEST_URI"]); // remove question mark | |
$pwdshort = preg_replace("(.*www\/)","$usr[1]/",$pwd); | $pwdshort = preg_replace("(.*www\/)","$usr[1]/",$pwd); |
if(!chdir($pwd)) { // try to go to directory | if(!chdir($pwd)) { // try to go to directory |