Hi,

Wednesday, December 4, 2002, 12:45:15 AM, you wrote:
cyc> Hi

cyc>     The script is not working.

cyc>    function authenticate($user,$pass) {
cyc>          $result = -1;
cyc>          $data = file("shadow"); /* permission every
cyc> one read */

cyc>          foreach($date as $line ) {
cyc>             $arr = explode(":",$line); 
cyc>              if($arr[0] == $user) {
cyc>               /* user name matching */
cyc>              if(crypt(trim($pass),$salt) == $arr[1])
cyc>                {  $result = 1;
cyc>                     break;
cyc>                 }
cyc>               else
cyc>                {
cyc>                    $result = 0;
cyc>                     break;
cyc>                 }
cyc>            }  /* end of for */
cyc>           return $result ;

cyc> }


cyc> The above programme always returs -1.

cyc> Any help would be appreciated.

cyc> regards
cyc> CVR


                            

cyc> __________________________________________________
cyc> Do you Yahoo!?
cyc> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
cyc> http://mailplus.yahoo.com


This line should probably be like

foreach($data as $line ) { //currently date

and you will have to extract $salt from the password field too

-- 
regards,
Tom


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to