include("inc/head.php");
print<< You do not seem to have a valid license to take this course. If you believe you should, please contact us. You are already registered for this course. You can access the course by visiting the courses page. You are now enrolled in the course. Click here to start the course! The following error(s) occured while trying to process your request. Please review your errors, make your corrections and click "Submit" to continue. The licenses have been assigned. Click here to assign more licenses. To assign the below course license(s), fill in the full name and email address of the person or people who will be taking the course. If you are taking this course yourself, click "Register for this course".
";
include("inc/foot.php");
exit;
}
$courseLicense_id = $user->assignCourseLicense($_POST);
print<<
eof;
require_once($config["htmlRootDir"]."/lib/aStudent.php");
$student = new aStudent($db,$config);
$user = new user($db,$config,"");
switch($action){
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//registeronline
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
case"registeronline":
//make sure we've got a license..
if($db->getOne("SELECT licenseCount FROM courseLicenses WHERE course_id='$get->course_id' AND user_id='$session->sUser_id'")==0){
print<<
";
}
if ($post->emailAddress!=$post->confirmEmailAddress){
$errors++;
$msg.="The email addresses you entered did not match
";
}
if($post->firstname==""){
$errors++;
$msg.="You must enter a first name.
";
}
if ($post->lastname==""){
$errors++;
$msg.="You must enter a last name.
";
}
if ($errors!=0){
print<<
$msg
Below is a list of your course licenses. You can choose to use these licenses to take courses yourself, or you can assign them to another user.
eof; $res=$db->query("SELECT courses.*, courseLicenses.* FROM courseLicenses LEFT JOIN courses USING(course_id) WHERE courseLicenses.user_id='$session->sUser_id' ORDER BY courses.course_id ASC"); if($res->numRows()==0){ print<<You have $row->licenseCount license(s) for $row->courseName
Click here to assign the license(s) or to take the course yourself. eof; } $res->free(); break; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //editprofile //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// case"editprofile": print<<Use the form below to edit your profile. Fill in all required fields, and click "Save Profile" to continue.
eof; $user = new user($db,$config,"user"); $row = $user->fetchUserInfo($session->sUser_id); $address=$user->fetchPrimaryAddress($session->sUser_id); $newaction="saveprofile"; include("forms/profileForm.php"); break; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //saveprofile //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// case"saveprofile": $errors = 0; $msg=""; if ($post->emailAddress==""){ $errors++; $msg.="You must enter your email addressWe already have an account associated with that email address and it doesn't appear to be you.
eof; include("inc/foot.php"); exit; } } if ($post->userFirstname==""){ $errors++; $msg.="You must enter your first nameThe following error(s) occured while trying to process your request. Please review your errors, make your corrections and click "Submit" to continue.
$msg
Your profile has been saved.
eof; $user->printUserInfo($post->user_id,"Y"); break; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //addaddress //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// case"addaddress": print<<Use the form below to add an address to your profile. Fill in all required fields and click "Save Address" to continue.
eof; $user = new user($db,$config,"user"); $user->setUser($session->sUser_id); $row->addressFirstname=$user->userFirstname; $row->addressMiddlename=$user->userMiddlename; $row->addressLastname = $user->userLastname; $newaction="saveaddress"; include("forms/addressForm.php"); break; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //addaddress //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// case"viewaddresses": print<<Below are your saved addresses. Click "Edit" to edit and "Delete" to delete.
eof; $user = new user($db,$config,"user"); print<<The following error(s) occured while trying to process your request. Please review your errors, make your corrections and click "Submit" to continue.
$msg
Your address has been saved.
eof; break; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //editaddressl //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// case"editaddress": print<<Use the form below to edit this address. Fill in all required fields and click "Save Address" to continue.
eof; $user = new user($db,$config,"user"); $row=$user->fetchAddress($session->sUser_id,$get->address_id); if($row->user_id!=$session->sUser_id){ print<<The address id supplied does not appear to belong to you or there was a system error.
eof; }else{ $db->query("DELETE FROM addresses WHERE address_id='$get->address_id'"); print<<Your address has been deleted.
eof; } }else{ if($session->sUser_id!=$db->getOne("SELECT user_id FROM addresses WHERE address_id='$get->address_id'")){ print<<The address id supplied does not appear to belong to you or there was a system error.
eof; }else{ if($db->getOne("SELECT addressType FROM addresses WHERE address_id='$get->address_id'")=="Primary"){ print<<You cannot delete your primary address.
eof; }else{ print<<You are about to delete this address. Are you sure you want to do that?
eof; } } } break; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //changepass //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// case"changepass": print<<Use the form below to change your password. Fill in both fields and click "Save Password" to continue.
eof; $row = $user->fetchUserInfo($session->sUser_id); $newaction="savepass"; include("forms/passwordForm.php"); break; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //savepass //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// case"savepass": $errorArray = array(); if($post->password==""){ array_push($errorArray,"You must enter a password"); } if($post->password!=$post->confirmPassword){ array_push($errorArray,"The passwords you entered did not match"); } if(count($errorArray)>0){ print<<The following errors occured while trying to process your request. Please review your error(s), make your corrections and click "Save Password" to continue.
The password has been saved and we've sent you an email reminder.
eof; break; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //vieworders //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// case"vieworders": $res = $db->query("SELECT * FROM orders WHERE user_id='{$_SESSION[sUser_id]}' ORDER BY order_id DESC"); if ($res->numRows()==0){ print<<You have no orders on file with us. Why not go shopping.
eof; include("inc/foot.php"); exit; } print<<| Order ID | Date | Total | Status | View/Print | $row->order_id | $orderDate | $$row->orderTotal | $row->orderStatus | View/Print | eof; $printed++; } print"
You are currently a wholesale customer.
eof; }else{ print<<You are not currently a wholesale customer.
If you would like to become a wholesale customer at {$config["siteShortURL"]}, you can apply by completing the form below.
eof; include("forms/wholesaleForm.php"); } break; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //default //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// default: $user = new user($db,$config,"user"); $row = $user->fetchUserInfo($session->sUser_id); print<<Welcome to the {$config["siteShortURL"]} member's section. From here you can edit your profile, manage your addresses, change your password, and enter student mode.
eof; if($student->isStudent($session->sUser_id)){ print<<Click here to change into student mode.
eof; } $time = new timeConversion(); $threadCount = $db->getOne("SELECT COUNT(*) FROM forumThreads WHERE user_id='{$session->sUser_id}'"); $postCount = $db->getOne("SELECT COUNT(*) FROM forumPosts WHERE user_id='{$session->sUser_id}'"); if(($forumCount>0)||($postCount>0)){ print<<You have started $threadCount forum threads and have $postCount forum posts.
Your Posts
eof;
$res = $db->query("SELECT forumThreads.thread_id, forumPosts.* FROM forumPosts LEFT JOIN forumThreads USING (thread_id) WHERE forumPosts.user_id='{$session->sUser_id}' ORDER BY forumPosts.thread_id, forumPosts.modified DESC");
while($res->fetchInto($row)){
$time->dbdate= $db->getOne("SELECT modified FROM forumPosts WHERE thread_id='$row->thread_id' ORDER BY modified DESC LIMIT 1");
$updateDate = $time->timestamp2long();
print<<