Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentes Révision précédente | |||
| info:myphp:identification [2018/07/18 09:45] – ↷ Page déplacée de info:git:homepage:myphp:identification à info:myphp:identification radeff | info:myphp:identification [2026/03/05 09:51] (Version actuelle) – radeff | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | identification.php | + | ====== PHP authentification / authentication / identification |
| + | ===== identification-fake-apache-authentication ===== | ||
| + | |||
| + | |||
| + | < | ||
| + | <?php | ||
| + | /* fake htaccess authentication | ||
| + | Fred Radeff (aka FR), radeff@akademia.ch, | ||
| + | adapted from: http:// | ||
| + | |||
| + | note: | ||
| + | if you want to keep a trace of the logins, put a file login.txt | ||
| + | in the same directory, which will be writable by the webserver or chmod 777 | ||
| + | and uncomment lines after "// | ||
| + | */ | ||
| + | |||
| + | / | ||
| + | $liste=array( | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | ); | ||
| + | #create table from array $liste | ||
| + | for ($i=0; | ||
| + | $l=explode("/", | ||
| + | $user[$i]=$l[0]; | ||
| + | $pass[$i]=$l[1]; | ||
| + | } | ||
| + | $nbusers=count($liste); | ||
| + | //check ID | ||
| + | $ok=-1; //start with no ID | ||
| + | for ($i=0; | ||
| + | if (($_SERVER[' | ||
| + | //USER ok, keep id | ||
| + | $ok=$i; | ||
| + | } | ||
| + | } | ||
| + | //if check KO, $ok is still -1 | ||
| + | //ask login+password | ||
| + | if ($ok==-1) { | ||
| + | header(" | ||
| + | print("< | ||
| + | exit; | ||
| + | } | ||
| + | // | ||
| + | //uncomment if you want to keep a trace | ||
| + | / | ||
| + | if (!$handle = fopen($filename, | ||
| + | echo " | ||
| + | | ||
| + | } | ||
| + | $somecontent = $_SERVER[' | ||
| + | fwrite($handle, | ||
| + | fclose($handle); | ||
| + | */ | ||
| + | /*OK end authentication */ | ||
| + | |||
| + | ?> | ||
| + | </ | ||
| + | |||
| + | ===== identification ===== | ||
| < | < | ||
| <? | <? | ||