brainonastick Posted June 26, 2016 Posted June 26, 2016 The following course is now full and when users search on our website they end up here: http://www.acwa.asn.au/Pages/coursedetailswl.php?recid=8897 However some staff paste the basic course detail URL into promotional flyers etc like this: http://www.acwa.asn.au/Pages/coursedetails.php?recid=8897 There is code (below) which redirects the user to the first URL if the course is full 9and to some other pages for other reasons) The below code used to work fine but is breaking now for some reason. I need any user who accesses the second link above to be redirected to the first. <?php //ini_set('display_errors', 1); //var_dump($user_data); //error_reporting(E_ALL); //exit(); //ini_set('display_errors', 'On'); //print_r($errors); //define('DEBUG', true); //print_r($_POST); include_once('FX/FX.php'); include_once('FX/server_data.php'); $recid = $_REQUEST['recid']; $coursecapacity = $_REQUEST['coursecapacity']; $groupSize='1'; $show_found_course=new FX($serverIP,$webCompanionPort,$dataSourceType); $show_found_course->SetDBData('Course Information','Course Information', $groupSize); $show_found_course->SetDBPassword($webPW,$webUN); $show_found_course->AddDBParam('-recid', $recid); $show_found_courseResult=$show_found_course->FMFind(); //echo $show_found_courseResult['errorCode']; foreach($show_found_courseResult['data'] as $key=>$show_found_courseData); if($show_found_courseData['Course_Capacity'][0] != "Space Available" && $show_found_courseData['Course_Capacity'][0] != "Filling Fast" && $show_found_courseData['Course_Capacity'][0] != "Course Capacity Not Applicable" && $coursecapacity != "Spac" && $coursecapacity != "Fill" && $coursecapacity != "Cour" ){ $currentRecord = $recid; $course_URL = ""; if ($Course_SearchData['Course_Capacity'][0] == 'Course Finished') $course_URL = "coursedetailsonly.php?recid=$currentRecord"; else if ($Course_SearchData['Course_Capacity'][0] == 'Course Has Started') $course_URL = "coursedetailsonly.php?recid=$currentRecord"; else if ($coursecapacity == 'Cour') $course_URL = "coursedetailsonly.php?recid=$currentRecord"; else if ($Course_SearchData['Cancelled'][0] == 'X') $course_URL = "coursedetailsonly.php?recid=$currentRecord"; else if ($Course_SearchData['Cancelled'][0] == 'X') $course_URL = "coursedetailsonly.php?recid=$currentRecord"; else if ($Course_SearchData['Rescheduled'][0] == 'X') $course_URL = "coursedetailsrs.php?recid=$currentRecord"; else if ($coursecapacity == 'Full') $course_URL = "coursedetailswl.php?recid=$currentRecord"; else if ($Course_SearchData['Course_Capacity'][0] == 'Full/Join Waiting List') $course_URL = "coursedetailswl.php?recid=$currentRecord"; else if ($Course_SearchData['Registration_Code'][0] == 'PAYFREE') $course_URL = "coursedetailspof.php?recid=$currentRecord"; else if ($Course_SearchData['Registration_Code'][0] == 'PAYFTNFREE') $course_URL = "coursedetailsptf.php?recid=$currentRecord"; else if ($Course_SearchData['Registration_Code'][0] == 'ALLFREE') $course_URL = "coursedetailsfree.php?recid=$currentRecord"; else if ($Course_SearchData['Special_Course_1'][0] == 'FORUM1') $course_URL = "coursedetailsforum.php?recid=$currentRecord"; else if ($Course_SearchData['Special_Course_1'][0] == 'FORUM2') $course_URL = "oursedetailsforum.php?recid=$currentRecord"; else if ($Course_SearchData['Special_Course_1'][0] == 'YSD') $course_URL = "coursedetailsonly.php?recid=$currentRecord"; header("Location: {$course_URL}"); exit(); } if ($show_found_courseData['Special_Times'][0] != '') { $times = $show_found_courseData['Special_Times'][0]; } else if ($show_found_courseData['Special_Times'][0] == '') { $times = $show_found_courseData['Starting_Time'][0] . ' to ' . $show_found_courseData['Finishing_Time'][0]; } ?>
webko Posted June 26, 2016 Posted June 26, 2016 Well, a quick glance tells me the only data set created is called $show_found_courseData But in your first 6 comparisons, 3 of them look for the (non-existent) $coursecapacity - as you searching for != this passes (as nothing will be equal to a non-existent variable) And then once that is passed, the comparisons are to the data set $Course_SearchData or $coursecapacity - which hasn't been created as far as I can tell... So $course_URL is empty at the redirect.
brainonastick Posted June 26, 2016 Author Posted June 26, 2016 Thanks Webko - remind me to get new glasses asap.
Recommended Posts
This topic is 3140 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now