note 76652 added to features.http-auth

From: Date: Tue, 24 Jul 2007 20:27:35 +0000
Subject: note 76652 added to features.http-auth
Groups: php.notes 
Request: Send a blank email to php-notes+get-128892@lists.php.net to get a copy of this message
Here is my attempt to create a digest authentication class that will log the user in and out without using a cookie,session,db,or file. At the core is this simple code to parse the digest string into variables works for several browsers. <?php // explode the digest with multibrowser support by Tony Wyatt 21jun07 public function explodethedigest($instring) { $quote = '"'; $equal = '='; $comma = ','; $space = ' '; $a = explode( $comma, $instring); $ax = explode($space, $a[0]); $b = explode( $equal, $ax[1], 2); $c = explode( $equal, $a[1], 2); $d = explode( $equal, $a[2], 2); $e = explode( $equal, $a[3], 2); $f = explode( $equal, $a[4], 2); $g = explode( $equal, $a[5], 2); $h = explode( $equal, $a[6], 2); $i = explode( $equal, $a[7], 2); $j = explode( $equal, $a[8], 2); $k = explode( $equal, $a[9], 2); $l = explode( $equal, $a[10], 2); $parts = array(trim($b[0])=>trim($b[1], '"'), trim($c[0])=>trim($c[1], '"'), trim($d[0])=>trim($d[1], '"'), trim($e[0])=>trim($e[1], '"'), trim($f[0])=>trim($f[1], '"'), trim($g[0])=>trim($g[1], '"'), trim($h[0])=>trim($h[1], '"'), trim($i[0])=>trim($i[1], '"'), trim($j[0])=>trim($j[1], '"'), trim($k[0])=>trim($k[1], '"'), trim($l[0])=>trim($l[1], '"')); return $parts; } ?> Give it a try at http://tokko.kicks-ass.net/tests/ta1.php Log in with user test password pass or user guest password guest. Go to page two for links to the code. Comments, ideas, suggestions, or critique welcome. ---- Server IP: 69.147.83.197 Probable Submitter: 66.110.220.73 ---- Manual Page -- http://www.php.net/manual/en/features.http-auth.php Edit -- https://master.php.net/note/edit/76652 Del: integrated -- https://master.php.net/note/delete/76652/integrated Del: useless -- https://master.php.net/note/delete/76652/useless Del: bad code -- https://master.php.net/note/delete/76652/bad+code Del: spam -- https://master.php.net/note/delete/76652/spam Del: non-english -- https://master.php.net/note/delete/76652/non-english Del: in docs -- https://master.php.net/note/delete/76652/in+docs Del: other reasons-- https://master.php.net/note/delete/76652 Reject -- https://master.php.net/note/reject/76652 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#128892) next »