Web hosting service - , name= . $_POST[ name ] . .
, name= . $_POST[ name ] . . WHERE user_id= . $_SESSION[ user_id ]; mysql_query($sql, $conn) or die( Could not update user account; . mysql_error()); } redirect( cpanel.php ); break; } } ?> How It Works The application needs to access the database and to redirect users to various pages after completing transactions. You take care of the former with conn.php, and the latter with http.php. Because transaction pages don t display anything on the screen, you don t need to include the header.php, footer.php, or outputFunctions.php files. require_once conn.php ; require_once http.php ; The $_REQUEST[ action ] variable contains either the name of the button you clicked on the previous page, or a GET request in the URL (such as ?action=delete). If $_REQUEST[ action ] is empty, then you don t do any transactions, and simply redirect the user to the index.php page: if (isset($_REQUEST[ action ])) { You use switch() in what follows because of its flexibility. If you expand the functionality of this application, you could end up adding many more actions. In this transact-user.php page, it is a simple matter of adding a new case condition. You could certainly use if/else statements instead of switch, but in the long run they can be cumbersome to work with. switch ($_REQUEST[ action ]) { The e-mail and password are what you use to log in. If both are not passed, the user will not be logged in. case Login : if (isset($_POST[ email ]) and isset($_POST[ passwd ])) { This gets the user s information. If a row is returned, it verifies that the login e-mail address and password supplied are correct. $sql = SELECT user_id, access_lvl,name . FROM cms_users . WHERE email= . $_POST[ email ] . . AND passwd= . $_POST[ passwd ] . ; $result = mysql_query($sql, $conn) or die( Could not lookup user information; . mysql_error()); if ($row = mysql_fetch_array($result)) { 434 Chapter 13
Please visit Domain Name Hosting services for high quality webhost to host and run your jsp applications.