Jump to content
Larry Ullman's Book Forums

Gary

Members
  • Posts

    3
  • Joined

  • Last visited

Gary's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I've been struggling the past couple days to create the routine that Larry mentions on page 575 of Chapter 13 to set up Site Administration. I added the "administrator" column as an unsigned TINYINT and assigned the users I want as administrators with 1 and 0 for all common users. This is the code I've tried in the footer.html: <?php # Script 13.2 - footer.html // This page completes the HTML template // Display links based upon the login status. // Show LOGIN links if this is the LOGOUT page. if (isset($_SESSION['user_id']) AND ($_GET['administrator'] == 1) AND (substr($_SERVER['PHP_SELF'], -10) != 'logout.php')) { echo '<a href="logout.php">Logout</a><br /> <a href="change_password.php">Change Password</a><br /> <a href="view_users.php"</a><br /> '; } elseif (isset($_SESSION['user_id']) AND ($_GET['administrator'] == 0) AND (substr($_SERVER['PHP_SELF'], -10) != 'logout.php')) { echo '<a href="logout.php">Logout</a><br /> <a href="change_password.php">Change Password</a><br /> '; } else { // Not logged in. echo '<a href="register.php">Register</a><br /> <a href="login.php">Login</a><br /> <a href="forgot_password.php">Forgot Password</a><br /> '; } ?> From a syntax perspective, I don't see any errors, but obviously it doesn't work. I get an "undefined index: administrator" error. I want the administrators to see view_users.php and edit_user.php, etc.
  2. Thanks matthaus. I have part of it figured out. Took another look and now it's sending to two out of three emails. May actually be my email client. I'll check.
  3. I have been spending several hours trying to troubleshoot the code in Script 13.6 - register.php and can't seem to find the solution. The script won't send the email using the following code: // Send the email. $body = "Thank you for registering at the User Registration site. To activate your account, please click on this link:\n\n"; $body .= "http://www.mywebsite.com/dispatch/activate.php" .mysql_insert_id() . "&y=$a"; mail($_POST['email'], 'Registration Confirmation', $body, 'From: admin@mywebsite.com'); // Finish the page. echo '<h3>Thank you for registering! A confirmation email has been sent to your address. Please click on the link in that email in order to activate your account.</h3>'; include ('./includes/footer.html'); // Include the HTML footer. exit(); } else { // If it did not run OK. echo '<p><font color="red" size="+1">You could not be registered due to a system error. We apologize for any inconvenience.</font></p>'; Can anyone help with ideas on what might be wrong? Thanks.
×
×
  • Create New...