|
reSIProcate/repro
9694
|
00001 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 00002 00003 <!-- 00004 System: Repro 00005 File: activateaccount.php 00006 Purpose: Accepts a username and an activation code. If that user exists, 00007 is in unverified state, and the activationcode matches, then the 00008 account is activated. 00009 00010 If any of those things are not true, an appropriate error message 00011 is shown. 00012 Author: S. Chanin 00013 --> 00014 00015 <?php 00016 00017 require('reprofunctions.php'); 00018 00019 $msgHeading = ""; 00020 $msgBody = ""; 00021 00022 // check if username and activationCode were passed in as GET params 00023 // and are non-empty 00024 00025 if ((isset($_GET['user'])) && (!empty($_GET['user'])) && 00026 (isset($_GET['code'])) && (!empty($_GET['code']))) { 00027 $username = $_GET['user']; 00028 $activationCode = $_GET['code']; 00029 00030 // let's lookup the activation state of the user 00031 $state = getUserState($username,$activationCode); 00032 00033 if ("A" == $state) { 00034 // active user ... shouldn't be activated a second time 00035 $msgHeading = "Duplicate activation request"; 00036 $msgBody = "This account is already active. It cannot be activated a second time. Please log in from the Welcome Page."; 00037 } else if ("U" == $state) { 00038 // unverified user ... so we'll activate 00039 if (activateUser($username,$activationCode)) { 00040 $msgHeading = "Congratulations $username."; 00041 $msgBody = "Your account is now active. Please follow the link below back to the Welcome Page to log in."; 00042 } else { 00043 // activation failed 00044 $msgHeading = "Error while activating your account."; 00045 $msgBody = "An error occurred while activating your account. Please contact an administrator for assistance."; 00046 } 00047 } else if ("D" == $state) { 00048 // disabled user ... shouldn't be activated. should be handled by 00049 // the administrator 00050 $msgHeading = "Request to activate a disabled account"; 00051 $msgBody = "This account has been disabled. It cannot be reactivated without action by the administrators. Please contact an administrator for assistance."; 00052 } else if ("N" == $state) { 00053 // no match (either user is unknown or activationCode is wrong) 00054 $msgHeading = "Invalid activation information"; 00055 $msgBody = "The parameters that were passed in are incorrect. Please recheck the link in your email. If you see this error again, please try manually cutting and pasting the link into your browser."; 00056 } else { 00057 // internal error ... state should always be one of the previous 00058 // four values. 00059 $msgHeading = "Internal error during activation"; 00060 $msgBody = "An error occurred while attempting to activate your account. Please contact an administrator for assistance."; 00061 } 00062 } else { 00063 // bad parameters 00064 $msgHeading = "Invalid activation information"; 00065 $msgBody = "The parameters that were passed in are incorrect. Please recheck the link in your email. If you see this error again, please try manually cutting and pasting the link into your browser."; 00066 } 00067 ?> 00068 00069 <html> 00070 <head> 00071 <link rel="stylesheet" type="text/css" href="repro_style.css" /> 00072 <title>Account Activated</title> 00073 </head> 00074 00075 <body> 00076 <h1 class="title">Repro</h1> 00077 <h1><?php echo $msgHeading ?></h1> 00078 <hr /> 00079 <p><?php echo $msgBody ?></p> 00080 00081 <br /><hr /> 00082 <a href="index.php">Return to Welcome Page</a> 00083 <br /> 00084 00085 </body> 00086 </html>
1.7.5.1