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
Last revisionBoth sides next revision
cern:index [2023/09/28 16:18] iwncern:index [2023/10/04 16:10] 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 
 +//$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
   $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.txt · Last modified: 2023/10/04 16:10 by iwn