User Tools

Site Tools


cern:index

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
cern:index [2023/09/28 16:18] iwncern:index [2023/10/04 16:10] (current) iwn
Line 2: Line 2:
  
 <file bash index.php> <file bash index.php>
-<?php 
 <?php <?php
 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]\/)?|","",$_SERVER["REQUEST_URI"]); // get subdirectory+$pwd = $pwd.preg_replace("|^\/(?:$usr[1]\/)?([^\?]*)(?:\?.*)?$|","$1",$_SERVER["REQUEST_URI"]); // get subdirectory
 $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
   $msg = "Could not find ".$_SERVER["REQUEST_URI"]."...";   $msg = "Could not find ".$_SERVER["REQUEST_URI"]."...";
 +  $msg .= "Could not find $pwd...";
 +  print_r($_SERVER);
   echo $msg; throw new Exception($msg);   echo $msg; throw new Exception($msg);
 } }
cern/index.1695910737.txt.gz · Last modified: 2023/09/28 16:18 by iwn