first commit
This commit is contained in:
@@ -0,0 +1,208 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Auth extends Start_Controller {
|
||||
|
||||
public function index() {
|
||||
$login_done = false;
|
||||
$data = array();
|
||||
$username = '';
|
||||
$password = '';
|
||||
$error_message = '';
|
||||
$valid_entry = false;
|
||||
$valid_login = false;
|
||||
$out = [];
|
||||
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
|
||||
|
||||
$this->testLoginInput($username, $password, $error_message, $valid_entry);
|
||||
|
||||
if (true == $valid_entry) {
|
||||
if ($username != '' && $password != '') {
|
||||
|
||||
$data["page_title"] = "";
|
||||
$data["username"] = $username; //"auxsupport";
|
||||
$data["password"] = $password;
|
||||
$data["sessionid"] = "12345678901234567890";
|
||||
$out = [];
|
||||
$this->coregrade_webapi(COREGRADE_ACCOUNT_LOGIN, $data, $out);
|
||||
//print_r( $data );
|
||||
//print_r( $out );
|
||||
if (count($out) > 0 && isset($out["sessionid"]) && isset($out["member_id"]) && $out["member_id"] > 0) {
|
||||
// print_r($out);
|
||||
//$this->getSessionData($out[0], $session_data); // just for testing
|
||||
|
||||
$this->buildUserSession(PHP_API_OK, $out);
|
||||
$valid_login = true;
|
||||
$this->session->set_flashdata('in', $out);
|
||||
redirect("member/index");
|
||||
$login_done = true;
|
||||
} else {
|
||||
$error_message = "Invalid Username/Password";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// $this->renderMemberPages('view_dash', $data);
|
||||
// $login_done = true;
|
||||
// exit();
|
||||
}
|
||||
// echo 'hhhh jjjj';
|
||||
//$this->coregrade_webapi(100, $data, $out);
|
||||
// print_r($out);
|
||||
|
||||
if (false == $login_done) {
|
||||
$this->renderAuthPages('view_login', $data);
|
||||
}
|
||||
}
|
||||
|
||||
public function newuser() {
|
||||
//$this->load->view('home/home');
|
||||
$data["firstname"] = $data["lastname"] = $data["password"] = $data["email"] = "";
|
||||
$valid_entry = true;
|
||||
$valid_login = false;
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
|
||||
$data['firstname'] = trim($this->input->post('firstname'));
|
||||
$data['lastname'] = trim($this->input->post('lastname'));
|
||||
$data['username'] = trim($this->input->post('username'));
|
||||
$data['password'] = trim($this->input->post('pass1'));
|
||||
$data['email'] = $data['username'];
|
||||
|
||||
if (true == $valid_entry) {
|
||||
if ($data['username'] != '' && $data['password'] != '') {
|
||||
$out = [];
|
||||
$this->coregrade_webapi(COREGRADE_ACCOUNT_PENDING, $data, $out);
|
||||
|
||||
//print_r( $data );
|
||||
// print_r($out);
|
||||
if (count($out) > 0 && isset($out["pending_id"]) && $out["pending_id"] > 0) {
|
||||
//print_r($out);
|
||||
//$this->getSessionData($out[0], $session_data); // just for testing
|
||||
|
||||
$this->renderAuthPages('view_pending', $data);
|
||||
$login_done = true;
|
||||
// redirect("page/index");
|
||||
} else {
|
||||
$error_message = "Invalid Username/Password";
|
||||
}
|
||||
}
|
||||
}
|
||||
// exit();
|
||||
}
|
||||
|
||||
|
||||
$this->load->view('auth/view_head');
|
||||
$this->load->view('auth/view_register');
|
||||
$this->load->view('auth/view_foot');
|
||||
}
|
||||
|
||||
public function resetpass() {
|
||||
$data = array();
|
||||
$out = array();
|
||||
$data["next_page"] = 50;
|
||||
$data["error_message"] = "";
|
||||
if ($_POST) {
|
||||
$data['username'] = trim($this->input->post('username'));
|
||||
$data["mode"] = RESET_START;
|
||||
if ($data['username'] != '') {
|
||||
$this->coregrade_webapi(COREGRADE_START_RESET_PASSWORD, $data, $out);
|
||||
$data["next_page"] = 100;
|
||||
} else {
|
||||
$data["error_message"] = "Please enter a valis username to continue";
|
||||
}
|
||||
}
|
||||
|
||||
$this->load->view('auth/view_head');
|
||||
$this->load->view('auth/view_reset_password', $data);
|
||||
$this->load->view('auth/view_foot');
|
||||
}
|
||||
|
||||
public function logout() {
|
||||
$this->index();
|
||||
}
|
||||
|
||||
public function passreset() {
|
||||
$data = array();
|
||||
$out = array();
|
||||
$data["next_page"] = 0;
|
||||
$data["error_message"] = '';
|
||||
|
||||
if ($_GET) {
|
||||
$data['reset_key'] = trim($this->input->get('rlink'));
|
||||
$data["mode"] = RESET_CONFIRM;
|
||||
if ($data['reset_key'] != '') {
|
||||
$this->coregrade_webapi(COREGRADE_START_RESET_PASSWORD, $data, $out);
|
||||
|
||||
// print_r($out);
|
||||
if (isset($out["reset_id"]) && isset($out["reset_id"]) > 0) {
|
||||
|
||||
$data["next_page"] = 5500;
|
||||
$data["reset_id"] = $out["reset_id"];
|
||||
$data["username"] = $out["username"];
|
||||
}
|
||||
} else {
|
||||
$data["error_message"] = "Please enter a valis username to continue";
|
||||
}
|
||||
}
|
||||
|
||||
$this->load->view('auth/view_head');
|
||||
$this->load->view('auth/view_reset_password', $data);
|
||||
$this->load->view('auth/view_foot');
|
||||
}
|
||||
|
||||
public function completereset() {
|
||||
|
||||
$data = array();
|
||||
$out = array();
|
||||
$data["next_page"] = 5500;
|
||||
$data["error_message"] = '';
|
||||
|
||||
if ($_POST) {
|
||||
$data['reset_key'] = trim($this->input->post('reset_key'));
|
||||
$data['reset_id'] = trim($this->input->post('reset_id'));
|
||||
$data['username'] = trim($this->input->post('username'));
|
||||
|
||||
$data['pass1'] = trim($this->input->post('pass1'));
|
||||
$data['pass2'] = trim($this->input->post('pass2'));
|
||||
|
||||
$allow_next = false;
|
||||
|
||||
if ( strlen($data['pass1']) >7 && $data['pass1'] == $data['pass2']){
|
||||
$allow_next = true;
|
||||
$data["new_pass"] = $data['pass1'];
|
||||
}
|
||||
else{
|
||||
$data["error_message"] = "Please enter a valid password to continue";
|
||||
}
|
||||
|
||||
//print_r( $data );
|
||||
$data["mode"] = RESET_COMPLETE;
|
||||
if ($data['reset_key'] != '' && isset($data["reset_id"]) && isset($data["reset_id"]) > 0 && $allow_next == true) {
|
||||
$this->coregrade_webapi(COREGRADE_START_RESET_PASSWORD, $data, $out);
|
||||
|
||||
// print_r($out);
|
||||
if (0) {
|
||||
|
||||
$data["next_page"] = 5500;
|
||||
$data["reset_id"] = $out["reset_id"];
|
||||
$data["username"] = $out["username"];
|
||||
}
|
||||
} else {
|
||||
$data["error_message"] = "Please enter a valid username to continue";
|
||||
}
|
||||
}
|
||||
|
||||
$this->load->view('auth/view_head');
|
||||
$this->load->view('auth/view_reset_password', $data);
|
||||
$this->load->view('auth/view_foot');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Home extends Start_Controller {
|
||||
|
||||
public function index() {
|
||||
$data = [];
|
||||
$this->viewHomePages("view_reset_password", $data);
|
||||
}
|
||||
|
||||
public function security() {
|
||||
$data = [];
|
||||
$this->viewHomePages("view_security", $data);
|
||||
}
|
||||
|
||||
public function howitworks() {
|
||||
|
||||
$data = [];
|
||||
$this->viewHomePages("view_howitworks", $data);
|
||||
// $this->load->view('auth/view_howitworks', $data);
|
||||
}
|
||||
|
||||
public function privacy() {
|
||||
$data = [];
|
||||
$this->viewHomePages("view_privacy", $data);
|
||||
}
|
||||
|
||||
public function faq() {
|
||||
$data = [];
|
||||
$this->viewHomePages("view_faq", $data);
|
||||
}
|
||||
|
||||
public function terms() {
|
||||
$data = [];
|
||||
$this->viewHomePages("view_terms", $data);
|
||||
}
|
||||
|
||||
public function contactus() {
|
||||
$data = [];
|
||||
$this->viewHomePages("view_contatus", $data);
|
||||
}
|
||||
|
||||
public function aboutus() {
|
||||
$data = [];
|
||||
$this->viewHomePages("view_aboutus", $data);
|
||||
}
|
||||
|
||||
private function viewHomePages($page_name, $data) {
|
||||
//$this->load->view('home/home');
|
||||
//echo "START RESET 1";
|
||||
$this->load->view('auth/view_head');
|
||||
$this->load->view('auth/' . $page_name, $data);
|
||||
$this->load->view('auth/view_foot');
|
||||
}
|
||||
|
||||
public function school() {
|
||||
echo "Here School";
|
||||
}
|
||||
|
||||
public function myhome() {
|
||||
echo "Here MyHome";
|
||||
}
|
||||
|
||||
public function cp() {
|
||||
echo "Here CP";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,550 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Member extends Member_Controller {
|
||||
|
||||
public function index() {
|
||||
|
||||
$data = array();
|
||||
|
||||
$mysql = "SELECT * FROM members_pages WHERE member_id = " . $_SESSION["member_id"] . " AND status = 1";
|
||||
$r = $this->db->query($mysql);
|
||||
$data["page_card"] = $r->result();
|
||||
|
||||
|
||||
|
||||
$this->renderMemberPages('view_dash', $data);
|
||||
}
|
||||
|
||||
public function page() {
|
||||
|
||||
|
||||
$data = array();
|
||||
|
||||
|
||||
$page_items = array(
|
||||
['NOTECARD', 'Note Card', 'btn-primary'],
|
||||
['VIDEOCARD', 'Video Content', 'btn-danger'],
|
||||
['ACTIONITEM', 'Action Item', 'btn-secondary'],
|
||||
['FORUMITEM', 'Forum Item', 'btn-success'],
|
||||
['TASKCARD', 'Task', 'btn-danger'],
|
||||
['RESOURCES', 'Resources', 'btn-light'],
|
||||
['RESEARCH', 'Research', 'btn-info']
|
||||
);
|
||||
|
||||
$data['page_items'] = $page_items;
|
||||
|
||||
$page_toindex = true;
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
|
||||
|
||||
$page_key = $this->input->get('pgname');
|
||||
$data["page_key"] = $page_key;
|
||||
$member_id = $_SESSION["member_id"];
|
||||
if ($member_id > 0 && $page_key != '') {
|
||||
//echo 'yes';
|
||||
$mysql = "SELECT id AS page_id, * FROM members_pages WHERE member_id = " . $_SESSION["member_id"] . " AND page_key='$page_key'";
|
||||
$r = $this->db->query($mysql);
|
||||
$drow = $r->row();
|
||||
|
||||
if (isset($drow)) {
|
||||
$data['title'] = $drow->title;
|
||||
$data['description'] = $drow->description;
|
||||
$data['what_page'] = $drow->page_mode;
|
||||
$data['page_id'] = $drow->page_id;
|
||||
// now let us get the items for the page
|
||||
|
||||
|
||||
|
||||
$mysql = "SELECT * FROM members_page_item WHERE member_id = " . $_SESSION["member_id"] . " AND page_id = " . $data['page_id'];
|
||||
$r = $this->db->query($mysql);
|
||||
$data["page_card_items"] = $r->result();
|
||||
|
||||
$this->renderMemberPages('view_mypage', $data);
|
||||
$page_toindex = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (true == $page_toindex) {
|
||||
$this->index();
|
||||
}
|
||||
}
|
||||
|
||||
public function viewCardAddAction() {
|
||||
///member/viewCardAddAction?proc=PROCESS&action_name="+action_name+"&member_id=" + member_id + "&limit=" + limit + "&offset=" + offset
|
||||
$data = [];
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
|
||||
|
||||
$action_name = $this->input->get('action_name');
|
||||
$member_id = $_SESSION["member_id"];
|
||||
$data["page_id"] = $this->input->get('page_id');
|
||||
$data["page_key"] = $this->input->get('page_key');
|
||||
|
||||
/* if ($member_id > 0 && $page_key != '') {
|
||||
//echo 'yes';
|
||||
$mysql = "SELECT * FROM members_pages WHERE member_id = " . $_SESSION["member_id"] . " AND page_key='$page_key'";
|
||||
$r = $this->db->query($mysql);
|
||||
$drow = $r->row();
|
||||
|
||||
if (isset($drow)) {
|
||||
$data['title'] = $drow->title;
|
||||
$data['description'] = $drow->description;
|
||||
$data['what_page'] = $drow->page_mode;
|
||||
$this->renderMemberPages('view_mypage', $data);
|
||||
$page_toindex = false;
|
||||
}
|
||||
}
|
||||
*/
|
||||
$this->load->view('member/addpages/' . $action_name, $data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// echo "Yes i got to the controller";
|
||||
}
|
||||
|
||||
public function myprofile() {
|
||||
$data = [];
|
||||
$this->renderMemberPages('view_myprofile', $data);
|
||||
}
|
||||
|
||||
public function configure() {
|
||||
// echo 'yes'; view_mypage
|
||||
|
||||
$data = array();
|
||||
$this->load->model('combo_model');
|
||||
$this->combo_model->defaultComboMessage = "Select Start Template [Optional]";
|
||||
$data["page_template"] = $this->combo_model->getPageTemplate("page_template", '');
|
||||
|
||||
|
||||
|
||||
|
||||
$mysql = "SELECT * FROM members_pages WHERE member_id = " . $_SESSION["member_id"] . " AND status = 1";
|
||||
$r = $this->db->query($mysql);
|
||||
$data["page_card"] = $r->result();
|
||||
|
||||
|
||||
//$mysql = "SELECT * FROM members_pages WHERE member_id = " . $_SESSION["member_id"];
|
||||
// $r = $this->db->query($mysql);
|
||||
// $data["page_card"] = $r->result();
|
||||
$this->renderMemberPages('view_configure', $data);
|
||||
}
|
||||
|
||||
public function addcard() {
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
|
||||
$data['description'] = trim($this->input->post('description'));
|
||||
$data['title'] = trim($this->input->post('title'));
|
||||
$data['member_id'] = $_SESSION["member_id"];
|
||||
$data['session'] = $_SESSION["sessionid"];
|
||||
$data['page_id'] = trim($this->input->post('page_id'));
|
||||
|
||||
|
||||
if ($data['description'] != '' && $data['title'] != '') {
|
||||
$out = [];
|
||||
$this->coregrade_webapi(COREGRADE_ACCOUNT_ADDCARD, $data, $out);
|
||||
}
|
||||
|
||||
// exit();
|
||||
}
|
||||
$this->configure();
|
||||
}
|
||||
|
||||
public function viewSharePage() {
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
|
||||
|
||||
$data['member_id'] = $_SESSION["member_id"];
|
||||
$data['session'] = $_SESSION["sessionid"];
|
||||
$data['page_id'] = trim($this->input->get('page_id'));
|
||||
|
||||
|
||||
if ($data['page_id'] != '' && $data['member_id'] != '') {
|
||||
|
||||
$mysql = "SELECT * FROM members_pages WHERE member_id = " . $_SESSION["member_id"] . " AND id = " . $data['page_id'];
|
||||
$r = $this->db->query($mysql);
|
||||
$data["pagei"] = $r->result()[0];
|
||||
|
||||
// print_r($data);
|
||||
|
||||
$this->load->view('member/pages/manage_share', $data);
|
||||
|
||||
// $out = [];
|
||||
// $this->coregrade_webapi(COREGRADE_ACCOUNT_ADDCARD, $data, $out);
|
||||
}
|
||||
// exit();
|
||||
}
|
||||
}
|
||||
|
||||
public function deletePageAction() {
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
|
||||
|
||||
$data['member_id'] = $_SESSION["member_id"];
|
||||
$data['session'] = $_SESSION["sessionid"];
|
||||
$data['page_id'] = trim($this->input->get('page_id'));
|
||||
|
||||
|
||||
if ($data['page_id'] != '' && $data['member_id'] != '') {
|
||||
$mysql = "UPDATE members_pages SET status = 0 WHERE status = 1 AND member_id =" . $data['member_id'] . " AND id=" . $data['page_id'];
|
||||
$this->db->query($mysql);
|
||||
echo "Deleted";
|
||||
}
|
||||
// exit();
|
||||
}
|
||||
}
|
||||
|
||||
public function addPageCards() {
|
||||
$data = array();
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
|
||||
$action_name = "VIDEOCARD";
|
||||
$member_id = $_SESSION["member_id"];
|
||||
$data["page_id"] = $this->input->get('page_id');
|
||||
$data["page_key"] = $this->input->get('page_key');
|
||||
|
||||
/* if ($member_id > 0 && $page_key != '') {
|
||||
//echo 'yes';
|
||||
$mysql = "SELECT * FROM members_pages WHERE member_id = " . $_SESSION["member_id"] . " AND page_key='$page_key'";
|
||||
$r = $this->db->query($mysql);
|
||||
$drow = $r->row();
|
||||
|
||||
if (isset($drow)) {
|
||||
$data['title'] = $drow->title;
|
||||
$data['description'] = $drow->description;
|
||||
$data['what_page'] = $drow->page_mode;
|
||||
$this->renderMemberPages('view_mypage', $data);
|
||||
$page_toindex = false;
|
||||
}
|
||||
}
|
||||
*/
|
||||
// echo "HERETTTT";
|
||||
$data["start_page"] = 200;
|
||||
$page_string = $this->load->view('member/addpages/' . $action_name, $data, TRUE);
|
||||
echo $page_string;
|
||||
}
|
||||
}
|
||||
|
||||
public function addNotecard() {
|
||||
$data = array();
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
|
||||
$data['title'] = trim($this->input->post('title'));
|
||||
$data['detail'] = trim($this->input->post('detail'));
|
||||
$data['member_id'] = $_SESSION["member_id"];
|
||||
$data['session'] = $_SESSION["sessionid"];
|
||||
$data['sessionid'] = $_SESSION["sessionid"];
|
||||
$data['item_type'] = 'NOTECARD';
|
||||
$data['page_id'] = trim($this->input->post('page_id'));
|
||||
|
||||
//define('COREGRADE_ACCOUNT_ADDPAGECARD', 11029);
|
||||
if ($data['detail'] != '' && $data['title'] != '') {
|
||||
$out = [];
|
||||
$this->coregrade_webapi(COREGRADE_ACCOUNT_ADDPAGECARD, $data, $out);
|
||||
}
|
||||
|
||||
|
||||
// exit();
|
||||
}
|
||||
|
||||
|
||||
// $this->renderMemberPages('view_mycalendar', $data);
|
||||
}
|
||||
|
||||
public function upload() {
|
||||
|
||||
// echo "HERE -----------------------------" . rand(1, 10000000);
|
||||
$files = false;
|
||||
//upload.php
|
||||
$uploadFileDir = '/home/uploads/' . $_SESSION['myfolder'];
|
||||
|
||||
if (!is_dir($uploadFileDir)) {
|
||||
mkdir($uploadFileDir, 0777);
|
||||
}
|
||||
|
||||
$uploadFileDir = '/home/uploads/' . $_SESSION['myfolder'] . "/page";
|
||||
if (!is_dir($uploadFileDir)) {
|
||||
mkdir($uploadFileDir, 0777);
|
||||
}
|
||||
|
||||
|
||||
$folder_name = $uploadFileDir . '/';
|
||||
|
||||
if (!empty($_FILES)) {
|
||||
|
||||
$temp_file = $_FILES['file']['tmp_name'];
|
||||
$location = $folder_name . $_FILES['file']['name'];
|
||||
move_uploaded_file($temp_file, $location);
|
||||
}
|
||||
|
||||
if (isset($_POST["name"])) {
|
||||
$filename = $folder_name . $_POST["name"];
|
||||
unlink($filename);
|
||||
}
|
||||
|
||||
$result = array();
|
||||
|
||||
$files = scandir('upload');
|
||||
/*
|
||||
$output = '<div class="row">';
|
||||
|
||||
if (false !== $files) {
|
||||
foreach ($files as $file) {
|
||||
if ('.' != $file && '..' != $file) {
|
||||
$output .= '
|
||||
<div class="col-md-2">
|
||||
<img src="' . $folder_name . $file . '" class="img-thumbnail" width="175" height="175" style="height:175px;" />
|
||||
<button type="button" class="btn btn-link remove_image" id="' . $file . '">Remove</button>
|
||||
</div>
|
||||
';
|
||||
}
|
||||
}
|
||||
}
|
||||
$output .= '</div>';
|
||||
* /
|
||||
*
|
||||
*/
|
||||
$output = "Completed";
|
||||
echo $output;
|
||||
}
|
||||
|
||||
public function upload_old() {
|
||||
set_time_limit(5000);
|
||||
|
||||
$page_item_id = 0;
|
||||
$data = [];
|
||||
$page_key = "";
|
||||
if (isset($_POST['uploadBtn']) && $_POST['uploadBtn'] == 'Upload') {
|
||||
|
||||
$page_key = $data['page_key'] = trim($this->input->post('page_key'));
|
||||
|
||||
$data['title'] = "This s the ttitle" . rand(100, 9999);
|
||||
$data['detail'] = "This s the ttitle, This s the ttitle" . rand(100, 9999);
|
||||
$data['member_id'] = $_SESSION["member_id"];
|
||||
$data['session'] = $_SESSION["sessionid"];
|
||||
$data['sessionid'] = $_SESSION["sessionid"];
|
||||
$data['item_type'] = 'VIDEOCARD';
|
||||
$data['page_id'] = trim($this->input->post('page_id'));
|
||||
if ($data['detail'] != '' && $data['title'] != '') {
|
||||
$out = [];
|
||||
$this->coregrade_webapi(COREGRADE_ACCOUNT_ADDPAGECARD, $data, $out);
|
||||
$page_item_id = $out["page_item_id"];
|
||||
}
|
||||
// print_r($data);
|
||||
if (isset($_FILES['uploadedFile']) && $_FILES['uploadedFile']['error'] === UPLOAD_ERR_OK) {
|
||||
|
||||
// get details of the uploaded file
|
||||
$fileTmpPath = $_FILES['uploadedFile']['tmp_name'];
|
||||
$fileName = $_FILES['uploadedFile']['name'];
|
||||
$fileSize = $_FILES['uploadedFile']['size'];
|
||||
$fileType = $_FILES['uploadedFile']['type'];
|
||||
$fileNameCmps = explode(".", $fileName);
|
||||
$fileExtension = strtolower(end($fileNameCmps));
|
||||
|
||||
$newFileName = md5(time() . $fileName) . '.' . $fileExtension;
|
||||
$allowedfileExtensions = array('jpg', 'gif', 'png', 'mp4');
|
||||
if (in_array($fileExtension, $allowedfileExtensions)) {
|
||||
|
||||
// directory in which the uploaded file will be moved
|
||||
$uploadFileDir = '/home/uploads/' . $_SESSION['myfolder']; // str_pad($_SESSION["member_id"], 10, "0", STR_PAD_LEFT);
|
||||
|
||||
if (!is_dir($uploadFileDir)) {
|
||||
mkdir($uploadFileDir, 0777);
|
||||
}
|
||||
|
||||
$uploadFileDir = '/home/uploads/' . $_SESSION['myfolder'] . "/page";
|
||||
if (!is_dir($uploadFileDir)) {
|
||||
mkdir($uploadFileDir, 0777);
|
||||
}
|
||||
|
||||
|
||||
$mypath = "testdir/subdir/test";
|
||||
mkdir($mypath, 0777, TRUE);
|
||||
|
||||
|
||||
|
||||
$dest_path = $uploadFileDir . "/" . $newFileName;
|
||||
|
||||
if (move_uploaded_file($fileTmpPath, $dest_path)) {
|
||||
$message = 'File is successfully uploaded.';
|
||||
$x = [];
|
||||
$x["filename"] = $fileName;
|
||||
$x["filesize"] = $fileSize;
|
||||
$x["filetype"] = $fileType;
|
||||
$x["ext"] = $fileExtension;
|
||||
$x["page_item_id"] = $page_item_id;
|
||||
$x["page_id"] = $data['page_id'];
|
||||
$x['member_id'] = $_SESSION["member_id"];
|
||||
$x['session'] = $_SESSION["sessionid"];
|
||||
$x['sessionid'] = $_SESSION["sessionid"];
|
||||
} else {
|
||||
$message = 'There was some error moving the file to upload directory. Please make sure the upload directory is writable by web server.';
|
||||
}
|
||||
}
|
||||
// print_r($_FILES);
|
||||
// echo $message;
|
||||
// echo base_url("images/icons/edit.png");
|
||||
}
|
||||
}
|
||||
|
||||
redirect("/member/page?pgname=$page_key", 'refresh');
|
||||
}
|
||||
|
||||
public function mycalendar() {
|
||||
$data = array();
|
||||
$this->renderMemberPages('view_mycalendar', $data);
|
||||
}
|
||||
|
||||
public function classroom() {
|
||||
// echo 'yes'; view_mypage
|
||||
|
||||
$data = array();
|
||||
$this->load->model('combo_model');
|
||||
$this->combo_model->defaultComboMessage = "Select Start Template [Optional]";
|
||||
$data["page_template"] = $this->combo_model->getPageTemplate("page_template", '');
|
||||
|
||||
|
||||
|
||||
|
||||
$mysql = "SELECT * FROM members_pages WHERE member_id = " . $_SESSION["member_id"] . " AND status = 1";
|
||||
$r = $this->db->query($mysql);
|
||||
$data["page_card"] = $r->result();
|
||||
|
||||
|
||||
//$mysql = "SELECT * FROM members_pages WHERE member_id = " . $_SESSION["member_id"];
|
||||
// $r = $this->db->query($mysql);
|
||||
// $data["page_card"] = $r->result();
|
||||
$this->renderMemberPages('view_classroom', $data);
|
||||
}
|
||||
|
||||
public function viewRoom() {
|
||||
if ($_GET) {
|
||||
|
||||
$page_id = $data['page_id'] = trim($this->input->get('page_id'));
|
||||
switch ($page_id) {
|
||||
case "student":
|
||||
$this->studentPage();
|
||||
break;
|
||||
case "room":
|
||||
$this->roomPage();
|
||||
break;
|
||||
case "grading":
|
||||
$this->roomGrading();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function studentPage() {
|
||||
$data = [];
|
||||
$mysql = "SELECT * FROM members_subscribers WHERE member_id = " . $_SESSION["member_id"];
|
||||
|
||||
$query = $this->db->query($mysql);
|
||||
$data['subscriber_data'] = $query->result_array();
|
||||
|
||||
$this->load->view('member/rooms/view_student', $data);
|
||||
}
|
||||
|
||||
private function roomPage() {
|
||||
$this->load->library('table');
|
||||
$this->table->set_template($this->template);
|
||||
$data = [];
|
||||
$member_id = $_SESSION["member_id"];
|
||||
|
||||
$q = "SELECT room_name,'<button type=\"button\" onclick=\"ViewRoom('||id||', '||room_id||');\" class=\"btn btn-primary btn-sm\">View</button>' AS action FROM members_rooms WHERE member_id = " . $_SESSION["member_id"] . " AND status = 1 ORDER by id DESC";
|
||||
$query = $this->db->query($q);
|
||||
$this->table->set_heading('Room Name', array('data' => '', 'style' => 'width:90px'));
|
||||
$data['room_table'] = $this->table->generate($query);
|
||||
|
||||
$mysql = "SELECT * FROM members_subscribers WHERE member_id = " . $_SESSION["member_id"];
|
||||
$query = $this->db->query($mysql);
|
||||
$data['subscriber_data'] = $query->result_array();
|
||||
|
||||
|
||||
// $data = $this->getMemberSubscribersReport($member_id, $data);
|
||||
$this->load->view('member/rooms/view_rooms', $data);
|
||||
}
|
||||
|
||||
private function roomGrading() {
|
||||
$data = [];
|
||||
$member_id = $_SESSION["member_id"];
|
||||
$data = $this->getMemberSubscribersReport($member_id, $data);
|
||||
$this->load->view('member/rooms/view_grading', $data);
|
||||
}
|
||||
|
||||
private function getMemberSubscribersReport($member_id, &$data) {
|
||||
|
||||
$this->load->library('table');
|
||||
$this->table->set_template($this->template);
|
||||
|
||||
$mysql = "SELECT * FROM members_subscribers WHERE member_id=" . $member_id;
|
||||
|
||||
$query = $this->db->query($mysql);
|
||||
$data['bank_table'] = $this->table->generate($query);
|
||||
$data["page_title"] = "Account Banks";
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function addNewSubscriber() {
|
||||
|
||||
if ($_GET) {
|
||||
$firstname = $data['firstname'] = trim($this->input->get('firstname'));
|
||||
$lastname = $data['lastname'] = trim($this->input->get('lastname'));
|
||||
$email = $data['email'] = trim($this->input->get('email'));
|
||||
// echo "Ameye Here " . rand(100, 888) . $firstname;
|
||||
$sub_id = rand(100000000, 9999999999);
|
||||
$values = [
|
||||
"member_id" => "" . $_SESSION["member_id"] . "",
|
||||
"firstname" => pg_escape_string($firstname),
|
||||
"lastname" => pg_escape_string($lastname),
|
||||
"email" => pg_escape_string($email),
|
||||
"username" => pg_escape_string($email),
|
||||
"sub_id" => $sub_id,
|
||||
"status" => "1"
|
||||
];
|
||||
|
||||
if ($firstname != '' && $lastname != '' && $email != '') {
|
||||
|
||||
$values = array_filter($values, 'strlen');
|
||||
$q = "INSERT INTO members_subscribers ";
|
||||
$q .= " (" . implode(", ", array_keys($values)) . ")";
|
||||
$q .= " VALUES ('" . implode("', '", $values) . "') ";
|
||||
$this->db->query($q);
|
||||
} else {
|
||||
echo "All fields ar required";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function addNewRoom() {
|
||||
|
||||
if ($_GET) {
|
||||
$room_name = $data['room_name'] = trim($this->input->get('room_name'));
|
||||
|
||||
$room_id = rand(100000000, 9999999999);
|
||||
$values = [
|
||||
"member_id" => "" . $_SESSION["member_id"] . "",
|
||||
"room_name" => pg_escape_string($room_name),
|
||||
"room_id" => $room_id,
|
||||
"status" => "1"
|
||||
];
|
||||
|
||||
if ($room_name != '') {
|
||||
|
||||
$values = array_filter($values, 'strlen');
|
||||
$q = "INSERT INTO members_rooms ";
|
||||
$q .= " (" . implode(", ", array_keys($values)) . ")";
|
||||
$q .= " VALUES ('" . implode("', '", $values) . "') ";
|
||||
|
||||
$this->db->query($q);
|
||||
echo "Room Added";
|
||||
} else {
|
||||
echo "All fields are required";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Tools extends CI_Controller {
|
||||
|
||||
/**
|
||||
* Index Page for this controller.
|
||||
*
|
||||
* Maps to the following URL
|
||||
* http://example.com/index.php/welcome
|
||||
* - or -
|
||||
* http://example.com/index.php/welcome/index
|
||||
* - or -
|
||||
* Since this controller is set as the default controller in
|
||||
* config/routes.php, it's displayed at http://example.com/
|
||||
*
|
||||
* So any other public methods not prefixed with an underscore will
|
||||
* map to /index.php/welcome/<method_name>
|
||||
* @see https://codeigniter.com/user_guide/general/urls.html
|
||||
*/
|
||||
public function index() {
|
||||
$this->load->view('tools/view_equations');
|
||||
// redirect("auth/index");
|
||||
}
|
||||
|
||||
public function basic1() {
|
||||
$this->load->view('tools/view_basic1');
|
||||
// redirect("auth/index");
|
||||
}
|
||||
|
||||
public function grace() {
|
||||
$this->load->view('tools/view_quad1');
|
||||
// redirect("auth/index");
|
||||
}
|
||||
|
||||
public function simul1() {
|
||||
$this->load->view('tools/view_simul1');
|
||||
$this->load->view('tools/tools_footer');
|
||||
}
|
||||
|
||||
|
||||
public function math1() {
|
||||
$this->load->view('tools/view_math1');
|
||||
$this->load->view('tools/tools_footer');
|
||||
// redirect("auth/index");
|
||||
}
|
||||
|
||||
public function math0() {
|
||||
$this->load->view('tools/view_math0');
|
||||
$this->load->view('tools/tools_footer');
|
||||
// redirect("auth/index");
|
||||
}
|
||||
public function math3() {
|
||||
$this->load->view('tools/view_math3');
|
||||
$this->load->view('tools/tools_footer');
|
||||
// redirect("auth/index");
|
||||
}
|
||||
public function exp1() {
|
||||
$this->load->view('tools/view_exp1');
|
||||
$this->load->view('tools/tools_footer');
|
||||
// redirect("auth/index");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Vemail extends Start_Controller {
|
||||
|
||||
public function index() {
|
||||
//$this->load->view('home/home');
|
||||
$valid_entry = true;
|
||||
$valid_login = false;
|
||||
$data = [];
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
|
||||
|
||||
$data['verify_link'] = trim($this->input->get('vlnk'));
|
||||
|
||||
if (true == $valid_entry) {
|
||||
if ($data['verify_link'] != '') {
|
||||
$out = [];
|
||||
$this->coregrade_webapi(COREGRADE_ACCOUNT_CREATEACC, $data, $out);
|
||||
//print_r( $data );
|
||||
//print_r( $out );
|
||||
if (count($out) > 0 && isset($out["member_id"]) && $out["member_id"] > 0) {
|
||||
// $this->renderAuthPages('view_login', $data);
|
||||
|
||||
|
||||
|
||||
// redirect("page/index");
|
||||
} else {
|
||||
$error_message = "Invalid Username/Password";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// exit();
|
||||
}
|
||||
|
||||
|
||||
$this->renderAuthPages('view_login', $data);
|
||||
}
|
||||
|
||||
public function resetpass() {
|
||||
//$this->load->view('home/home');
|
||||
//echo "START RESET 1";
|
||||
$this->load->view('auth/view_head');
|
||||
$this->load->view('auth/view_reset_password');
|
||||
$this->load->view('auth/view_foot');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Welcome extends CI_Controller {
|
||||
|
||||
/**
|
||||
* Index Page for this controller.
|
||||
*
|
||||
* Maps to the following URL
|
||||
* http://example.com/index.php/welcome
|
||||
* - or -
|
||||
* http://example.com/index.php/welcome/index
|
||||
* - or -
|
||||
* Since this controller is set as the default controller in
|
||||
* config/routes.php, it's displayed at http://example.com/
|
||||
*
|
||||
* So any other public methods not prefixed with an underscore will
|
||||
* map to /index.php/welcome/<method_name>
|
||||
* @see https://codeigniter.com/user_guide/general/urls.html
|
||||
*/
|
||||
public function index() {
|
||||
$this->load->view('home/home');
|
||||
// redirect("auth/index");
|
||||
}
|
||||
|
||||
public function viewLogin() {
|
||||
echo "Ameye";
|
||||
redirect("auth/index");
|
||||
exit();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user