Ecommerce web host - session_start(); $_SESSION[ user_id ] = mysql_insert_id($conn); $_SESSION[ access_lvl ] = 1; $_SESSION[ name ]

session_start(); $_SESSION[ user_id ] = mysql_insert_id($conn); $_SESSION[ access_lvl ] = 1; $_SESSION[ name ] = $_POST[ name ]; } redirect( index.php ); break; When an account is modified, all of the fields must have data. As long as they do, the user s account is updated in the database, and the user is redirected to the admin.php page: case Modify Account : if (isset($_POST[ name ]) and isset($_POST[ email ]) and isset($_POST[ accesslvl ]) and isset($_POST[ userid ])) { $sql = UPDATE cms_users . SET email= . $_POST[ email ] . , name= . $_POST[ name ] . , access_lvl= . $_POST[ accesslvl ] . . WHERE user_id= . $_POST[ userid ]; mysql_query($sql, $conn) or die( Could not update user account; . mysql_error()); } redirect( admin.php ); break; It s time to revisit the mail() function we introduced in Chapter 11. This will be a simple e-mail, but there is no reason you can t take your wealth of knowledge from Chapter 11 and send an HTML-enabled e-mail to your users. It s not necessary, of course, but it s your application. Do what you will! case Send my reminder! : if (isset($_POST[ email ])) { $sql = SELECT passwd FROM cms_users . WHERE email= . $_POST[ email ] . ; $result = mysql_query($sql,$conn) or die( Could not look up password; . mysql_error()); If you find a record, you get it, create a subject and body for your e-mail message (including the long lost password), and send it on its merry way. if (mysql_num_rows($result)) { $row = mysql_fetch_array($result); $subject = Comic site password reminder ; $body = Just a reminder, your password for the . Comicbook appreciation site is: . $row[ passwd ] . nnYou can use this to log in at http:// . $_SERVER[ HTTP_HOST ] . dirname($_SERVER[ PHP_SELF ]) . / ; 436 Chapter 13
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.

Leave a Reply