Re: Changing passwords

From: Date: Wed, 10 Jan 2001 16:58:33 +0000
Subject: Re: Changing passwords
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-33703@lists.php.net to get a copy of this message
That's quite a big request :) here are a few tips you might allready know. changin the passwd for a user to view a site isnt that hard, just store the username and password in a db, this is the file I use, nb. fetch_db_value() replace with your own sql functions <? function mtime() { $mtime = microtime(); $mtime = ereg_replace('\.', '', $mtime); $mtime = explode(' ', $mtime); $mtime = $mtime[1] . $mtime[0]; return($mtime); } function bad_passwd() { echo "You have entered an invalid password.<br>\n"; exit(); } session_start(); if (!isset($SessionID)) { $SessionID = mtime(); session_register("SessionID"); } if ( isset($PHP_AUTH_USER) AND isset($PHP_AUTH_PW) AND $peop_r = fetch_db_value('people_manager', "WHERE username = '$PHP_AUTH_USER' AND password = '$PHP_AUTH_PW' ") ) $SessionID = $peop_r['peopleID']; else { Header("WWW-Authenticate: Basic realm='$SERVER_NAME' "); Header("HTTP/1.0 401 Unauthorized"); bad_passwd(); } ?> just include this file on the top of every page you want passwd protected, change the passwd in the db and this script will confirm the passwd allways. Now for changing the passwd for a mailserver ona remote box, well there aint no easy way todo this. so I wont even try. I have idea's about setting some small http server on that box, passwd protect it, and build a small php page on THAT server to handel the passwd changes, using exec() ? maybe modifying /etc/passwd using the builting crypt() functions, I dont have any experience when it somes to that. Im unsure when you say the old passwd still has to be valid because of someone being away from the computer? when the passwd is changed the old passwd would be invalid, thats the point of changing a passwd :) are multiple users going to login with one username / passwd ? thats not such a good idea, with individual username passwds individuals can have their access restricted, alot easier to maintain. also with multiple users single passwd systems, who decided to change the passwd? your opening up the door to piss people off, some jerk decideds hes going to change the passwd and not tell anyone. real nice. haha Chris Lee Mediawaveonline.com ""A.D. Vijverberg"" <dvijverberg@lync.nl> wrote in message news:002301c07b4d$da653d20$cd64a8c0@milaan... > Hello, > > i have got a question I can't find the answer to. I want to enable my users > to change their password for a intranet and their mail account (different > machine than the Intranet). i want my users to do this throug a web > interface on the intranet. Can anyone tell me how I can make an app to do > this in PHP. If a password chang request is made, the old password has to be > validated to prevent others to change the password while the computer is > logged on to the intranet but the person of that system is away for some > reason. > > And how can I change the password on the standalone mailserver (using the > same concept as above) which is an other machine as the machine my Intranet > runs on. > > The machine for the Intranet is a suse 7.0 machine and the mailserver is a > normal pc running Sun Solaris 2.6 intel. > > Thanx in advance. > > Kind regards, > > A.D. Vijverberg > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#33703) next »