Exemplo n.º 1
0
 public function register()
 {
     check_if_already_logged_in();
     $data["page"] = "register";
     if (isset($_POST['btnRegister'])) {
         $input = array("username" => $_POST['username'], "password" => $_POST['password'], "confirmpass" => $_POST['password_confirm'], "firstname" => $_POST['firstname'], "middlename" => $_POST['middlename'], "lastname" => $_POST['lastname'], "email" => $_POST['email'], "gender" => isset($_POST['gender']) ? $_POST['gender'] : "", "occupation" => $_POST['occupation'], "otherinfo" => $_POST['otherinfo']);
         $data["error"] = verify_data($input);
         if ($data["error"]["count"] == 0) {
             $salt = generate_salt();
             $userdata["username"] = $input["username"];
             $userdata["salt"] = encrypt_salt($salt, 'enElpiPUP1516');
             $userdata["password"] = hash_password($input["password"], $salt);
             $userdata["type"] = "member";
             $other["first_name"] = $input["firstname"];
             $other["middle_name"] = $input["middlename"];
             $other["last_name"] = $input["lastname"];
             $other["email"] = $input["email"];
             $other["gender"] = $input["gender"];
             $other["occupation"] = $input["occupation"];
             $other["about"] = $input["otherinfo"];
             $user = $this->Users_model->insert($userdata, $other);
             header('Location: register');
         }
     }
     $this->load->view('templates/header');
     $this->load->view('users/register', $data);
     $this->load->view('templates/footer');
 }
Exemplo n.º 2
0
 public function add()
 {
     check_if_admin();
     $data;
     if (isset($_POST['btnAdd'])) {
         $input = array("title" => $_POST['title'], "author" => $_POST['author'], "year" => $_POST['year'], "url" => $_POST['url']);
         $data["error"] = verify_data($input);
         if ($data["error"]["count"] == 0) {
             $pubdetails["title"] = $input["title"];
             $pubdetails["author"] = $input["author"];
             $pubdetails["year"] = $input["year"];
             $pubdetails["url"] = $input["url"];
             $pub = $this->publication_model->insert($pubdetails);
             header('Location: new');
         }
     }
     $this->load->view('templates/header');
     if (empty($data)) {
         $this->load->view('publication/new');
     } else {
         $this->load->view('publication/new', $data);
     }
     $this->load->view('templates/footer');
 }
Exemplo n.º 3
0
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}
if (count($_GET) == 1) {
    require_once 'include/configpage.php';
    require_once 'include/emaillib.php';
    setCss();
    headerSet();
    $code = $_GET['code'] or die('<p class="message">Error');
    check_code($code) or die('<p class="message">Ooops');
    if (verify_data($code) == "pending") {
        $username = read_data($code);
        //print $username;
        if ($username != "Error") {
            if (gen_pass_mail($code, $username)) {
                print '<p class="message">Your password has been changed and sent, please check your email';
            }
        } else {
            die('<p class="message">Error, can\'t get your email, please contact the Administrator');
        }
    } else {
        die('<p class="message">Error, invalid code, please contact the Administrator');
    }
} else {
    die('<p class="message">Error, invalid parameters, please contact the Administrator');
}
Exemplo n.º 4
0
 public function add()
 {
     check_if_admin();
     $data["page"] = "upload";
     $data;
     if (isset($_POST['btnUpload'])) {
         $input = array("title" => $_POST['title'], "abstract" => $_POST['abstract'], "author" => $_POST['author'], "year" => $_POST['year'], "file" => $_FILES['fileToUpload']["name"], "version" => $_POST['version']);
         $data["error"] = verify_data($input);
         if ($data["error"]["count"] == 0) {
             $toolsdata["name"] = $input["title"];
             $toolsdata["abstract"] = $input["abstract"];
             $toolsdata["authors"] = $input["author"];
             $toolsdata["year"] = $input["year"];
             $otherinfo["version"] = $input["version"];
             $otherinfo["file"] = $input["file"];
             $user = $this->Tools_model->insert($toolsdata, $otherinfo);
             $config['hostname'] = 'localhost';
             $config['username'] = '******';
             $config['password'] = '******';
             $config['port'] = 21;
             $config['debug'] = TRUE;
             $this->ftp->connect($config);
             $this->ftp->upload($_FILES['fileToUpload']['tmp_name'], '/public/tools/' . $_FILES['fileToUpload']['name'], 'auto');
             $this->ftp->close();
             header('Location: new');
         }
     }
     $this->load->view('templates/header');
     if (empty($data)) {
         $this->load->view('tools/new');
     } else {
         $this->load->view('tools/new', $data);
     }
     $this->load->view('templates/footer');
 }