|
cvs: pecl /apc apc.php: msg#00198php.pecl.cvs
beckerr Tue Jul 26 05:57:03 2005 EDT Modified files: /pecl/apc apc.php Log: authentication checking can be turned off now http://cvs.php.net/diff.php/pecl/apc/apc.php?r1=3.24&r2=3.25&ty=u Index: pecl/apc/apc.php diff -u pecl/apc/apc.php:3.24 pecl/apc/apc.php:3.25 --- pecl/apc/apc.php:3.24 Tue Jul 26 05:42:08 2005 +++ pecl/apc/apc.php Tue Jul 26 05:57:03 2005 @@ -21,12 +21,21 @@ */ -$VERSION='$Id: apc.php,v 3.24 2005/07/26 09:42:08 beckerr Exp $'; +$VERSION='$Id: apc.php,v 3.25 2005/07/26 09:57:03 beckerr Exp $'; ////////// BEGIN OF CONFIG AREA /////////////////////////////////////////////////////////// +define('USE_AUTHENTIFICATION',1); // Use (internal) authentification - best choice if + // no other authentification is available + // If set to 0: + // There will be no further authentification. You + // will have to handle this by yourself! + // If set to 1: + // You need to change ADMIN_PASSWORD to make + // this work! + define('ADMIN_USERNAME','apc'); // Admin Username define('ADMIN_PASSWORD','password'); // Admin Password - CHANGE THIS TO ENABLE!!! @@ -123,29 +132,31 @@ // authentication needed? // -$AUTHENTICATED=0; -if (ADMIN_PASSWORD!='password' && ($MYREQUEST['LO'] == 1 || isset($_SERVER['PHP_AUTH_USER']))) { - - if (!isset($_SERVER['PHP_AUTH_USER']) || - !isset($_SERVER['PHP_AUTH_PW']) || - $_SERVER['PHP_AUTH_USER'] != ADMIN_USERNAME || - $_SERVER['PHP_AUTH_PW'] != ADMIN_PASSWORD) { - Header("WWW-Authenticate: Basic realm=\"APC Login\""); - Header("HTTP/1.0 401 Unauthorized"); - - echo <<<EOB - <html><body> - <h1>Rejected!</h1> - <big>Wrong Username or Passwort!</big><br/> <br/> - <big><a href='$PHP_SELF?OB={$MYREQUEST['OB']}'>Continue...</a></big> - </body></html> +if (!USE_AUTHENTIFICATION) { + $AUTHENTICATED=1; +} else { + $AUTHENTICATED=0; + if (ADMIN_PASSWORD!='password' && ($MYREQUEST['LO'] == 1 || isset($_SERVER['PHP_AUTH_USER']))) { + + if (!isset($_SERVER['PHP_AUTH_USER']) || + !isset($_SERVER['PHP_AUTH_PW']) || + $_SERVER['PHP_AUTH_USER'] != ADMIN_USERNAME || + $_SERVER['PHP_AUTH_PW'] != ADMIN_PASSWORD) { + Header("WWW-Authenticate: Basic realm=\"APC Login\""); + Header("HTTP/1.0 401 Unauthorized"); + + echo <<<EOB + <html><body> + <h1>Rejected!</h1> + <big>Wrong Username or Passwort!</big><br/> <br/> + <big><a href='$PHP_SELF?OB={$MYREQUEST['OB']}'>Continue...</a></big> + </body></html> EOB; - exit; - - } - else - { - $AUTHENTICATED=1; + exit; + + } else { + $AUTHENTICATED=1; + } } } @@ -303,7 +314,9 @@ global $MY_SELF,$MYREQUEST,$AUTHENTICATED,$PHP_AUTH_USER; // need's ADMIN_PASSWORD to be changed! // - if (ADMIN_PASSWORD=='password') + if (!USE_AUTHENTIFICATION) { + return; + } else if (ADMIN_PASSWORD=='password') { print <<<EOB <a href="#" onClick="javascript:alert('You need to set a password at the top of apc.php before this will work!');return false";>$s</a> @@ -344,6 +357,7 @@ right: 1em; top: 1.2em; color:white; + width:6em; } div.head div.login a { position:absolute; @@ -498,7 +512,7 @@ span.red { background:#D06030; padding:0 0.5em 0 0.5em } div.authneeded { - background:rgb(238,238,238) + background:rgb(238,238,238); border:solid rgb(204,204,204) 1px; color:rgb(200,0,0); font-size:1.2em; @@ -700,19 +714,10 @@ $m=1-$m; } if($fieldkey=='info') { - if($AUTHENTICATED) { - echo "<tr class=tr-$m><td class=td-0>Stored Value</td><td class=td-last><pre>"; - $output = var_export(apc_fetch($entry[$fieldkey]),true); - echo htmlspecialchars($output); - echo "</pre></td></tr>\n"; - } else { - // this will never be reached.... we may remove it! (beckerr) - echo - "<tr class=tr-$m>", - "<td class=td-0>Stored Value</td>", - "<td class=td-last>Set your apc.php password to see the user values here</td>", - "</tr>\n"; - } + echo "<tr class=tr-$m><td class=td-0>Stored Value</td><td class=td-last><pre>"; + $output = var_export(apc_fetch($entry[$fieldkey]),true); + echo htmlspecialchars($output); + echo "</pre></td></tr>\n"; } break; } |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | cvs: pecl /apc apc.php: 00198, Ralf Becker |
|---|---|
| Next by Date: | cvs: pecl /apc apc.php: 00198, Ralf Becker |
| Previous by Thread: | cvs: pecl /apc apc.phpi: 00198, Ralf Becker |
| Next by Thread: | cvs: pecl /apc apc.php: 00198, Ralf Becker |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |