rendered paste body<?php/* roll_call.php **************** * - if log-in * - take user-name/passphrase * - verify with database * - set session 'logged-in' state * - if log-out * - unset session 'logged-in' state * - if register * - take user-name / e-mail address / passphrase * - store uname/email/crypt(pass) * - mail authorization string to e-mail address * - store auth string to user record * - take auth=... string * - verify it * - auth the user record **/session_start();$logged_in = ( isset( $_SESSION[ 'LOGGED_IN' ] ) ) ? 'true' : 'false';echo "<div>LOGGED_IN: " . $logged_in . "</div>\n";// show the logIn formshowInOutForm( 0 );// show the logOut formshowInOutForm( 1 );// test logIn submitif ( isset( $_POST[ 'logIn' ] ) ) { if ( isset( $_POST[ 'uname' ] ) && isset( $_POST[ 'upass' ] ) ) { // try log-in# logIn( $_POST[ 'uname' ], $_POST[ 'upass' ] ); $_SESSION[ 'LOGGED_IN' ] = 1; }}// test logOut submitif ( isset( $_POST[ 'logOut' ] ) ) { // unset session logged-in state unset( $_SESSION[ 'LOGGED_IN' ] );}/******************************************************************************/function showInOutForm( $bit ){ $submit = 'Log-out'; $button = 'logOut';?><div id="rollCall"> <form action="" method="POST"><?php if ( !$bit ) {?> <div><label for="uname">uname</label> <input type="text" name="uname" id="uname" value="" /></div> <div><label for="upass">upass</label> <input type="password" name="upass" id="upass" value="" /></div><?php $submit = 'Log-in'; $button = 'logIn'; } // !$bit?> <div><input type="submit" name="<?php echo $button; ?>" id="<?php echo $button; ?>" value="<?php echo $submit; ?>" /></div> </form></div><?php} // showInOutForm(){}?>