1 | <?php |
---|
2 | |
---|
3 | /* |
---|
4 | source : |
---|
5 | /usr/home/fplod/incas/bibnemo/src/bibnemomaf/select_form.php sur aedon.locean-ipsl.upmc.fr |
---|
6 | |
---|
7 | update : |
---|
8 | ++ |
---|
9 | fplod 2007-04-18T15:20:58Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
10 | creation |
---|
11 | d'après /usr/home/jv/WWW/Cirene/diary.php |
---|
12 | /usr/home/opatlod/NEMO/users/visu_nemo_users.php |
---|
13 | */ |
---|
14 | |
---|
15 | /* |
---|
16 | Définit le fuseau horaire par défaut à utiliser. Disponible depuis PHP 5.1 |
---|
17 | date_default_timezone_set('UTC'); ++ |
---|
18 | */ |
---|
19 | /* ++ à décommenter |
---|
20 | */ |
---|
21 | error_reporting(E_ALL); |
---|
22 | |
---|
23 | /* |
---|
24 | retrieve global information |
---|
25 | */ |
---|
26 | $DATE_ISO8601_mod = 'Y-m-d\TH:i:s\Z'; /* +Z - fraction seconde */ |
---|
27 | |
---|
28 | /* ++ str_split n'existe pas en 4.4. */ |
---|
29 | if(!function_exists('str_split')){ |
---|
30 | function str_split($str, $l=1) { |
---|
31 | do {$ret[]=substr($str,0,$l); $str=substr($str,$l); } |
---|
32 | while($str != ""); |
---|
33 | return $ret; |
---|
34 | } |
---|
35 | } |
---|
36 | |
---|
37 | $author_id = ''; |
---|
38 | /* |
---|
39 | retrieve form data |
---|
40 | */ |
---|
41 | |
---|
42 | $personal_surname=$_POST['personal_surname']; |
---|
43 | $personal_firstname=$_POST['personal_firstname']; |
---|
44 | |
---|
45 | /* |
---|
46 | handle form data |
---|
47 | if personal_surname and personal_firstname are empty, go on error ++ |
---|
48 | if personal_surname and personal_firstname are not empty we have to build |
---|
49 | an id (SURNAME_f), check if the file SURNAME_f.html exists. |
---|
50 | |
---|
51 | $tr_low_letters = str_split('abcdefghijklmnopqrstuvwxyz éèçàùëöñó'); |
---|
52 | $tr_up_letters = str_split('ABCDEFGHIJKLMNOPQRSTUVWXYZ_EECAUEONO'); |
---|
53 | |
---|
54 | $personal_surname_flat=str_replace($tr_low_letters, $tr_up_letters, $personal_surname); |
---|
55 | $personal_firstname_flat=str_replace($tr_up_letters, $tr_low_letters, $personal_firstname); |
---|
56 | |
---|
57 | $personal_surname_upper=strtoupper($personal_surname_flat); |
---|
58 | $personal_firstname_lower = strtolower($personal_firstname_flat); |
---|
59 | $personal_firstname_lower1 = substr($personal_firstname_lower,0,1); |
---|
60 | |
---|
61 | $author_id = $personal_surname_upper . '_' . $personal_firstname_lower1; |
---|
62 | echo ' author_id : ' . $author_id; |
---|
63 | |
---|
64 | $filename='../en/many/bibnemomaf04/' ; |
---|
65 | $filename='../en/many/bibnemomaf04/' . $author_id; |
---|
66 | $filename='../en/many/bibnemomaf04/' . $author_id . 'php'; |
---|
67 | $filename='../en/many/bibnemomaf04/' . $author_id . '.php'; |
---|
68 | $filename='../en/many/bibnemomaf04/' . $author_id . '\.php'; |
---|
69 | echo 'filename' . $filename; |
---|
70 | |
---|
71 | if (!file_exists($filename)) { |
---|
72 | $template='../en/many/bibnemomaf04/new.php'; |
---|
73 | header('Location: ' . $template); |
---|
74 | } |
---|
75 | else |
---|
76 | { |
---|
77 | header('Location: '. $filename); |
---|
78 | } |
---|
79 | |
---|
80 | /* si pb il faut afficher toutes les information succeptibles de comprendre |
---|
81 | et suggéré à l'utilisateur de nous les envoyer par mail |
---|
82 | */ |
---|
83 | echo 'date : ' . date($DATE_ISO8601_mod); |
---|
84 | echo ' author_id : ' . $author_id; |
---|
85 | echo $_SERVER['HTTP_USER_AGENT']; |
---|
86 | echo 'phpverion : ' . phpversion(); |
---|
87 | echo $_POST['personal_surname']; |
---|
88 | echo "<p>personal_surname : $personal_surname</p>"; |
---|
89 | echo 'personal_surname_upper : ' . $personal_surname_upper; |
---|
90 | echo 'personal_firstname : ' . $personal_firstname; |
---|
91 | echo "<p>personal_firstname_lower : $personal_firstname_lower</p>"; |
---|
92 | echo "<p>personal_firstname_lower1 : $personal_firstname_lower1</p>"; |
---|
93 | echo "<p>author_id : $author_id</p>"; |
---|
94 | echo "<a href='$filename'>$filename</a>"; |
---|
95 | |
---|
96 | ?> |
---|