Skip to content
Snippets Groups Projects
Commit a4c88a8f authored by nathaniacalista01's avatar nathaniacalista01
Browse files

switch ways

parent 5eb2b90b
Branches
No related merge requests found
...@@ -19,12 +19,12 @@ ...@@ -19,12 +19,12 @@
$middleware = $this->middleware("LoginMiddleware"); $middleware = $this->middleware("LoginMiddleware");
$middleware->hasLoggedIn(); $middleware->hasLoggedIn();
$user_model = new User(); $user_model = new User();
$enrolled_courses = $user_model->getAllCoursesEnrolled();
$result = $course->single_course($params); $result = $course->single_course($params);
if(!$result){ if(!$result){
header("Location: /notfound"); header("Location: /notfound");
}else{ }else{
if(!in_array($result,$enrolled_courses)){ $enrolled = $user_model->check_enroll($result["course_id"]);
if(!$enrolled){
$_SESSION["error"] = "You have to enrolled this course first!"; $_SESSION["error"] = "You have to enrolled this course first!";
header("Location: /"); header("Location: /");
}else{ }else{
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment