/lenasys/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/trunk

« back to all changes in this revision

Viewing changes to codeigniter/application/controllers/ajax.php

  • Committer: Gustav Hatvigsson
  • Date: 2013-05-17 11:35:28 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20130517113528-j91o0iq4t7mzeas7
Fixed the loginview

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 
2
 
 
3
        class Ajax extends CI_Controller {
 
4
                /*
 
5
                 *      Constructor
 
6
                 */
 
7
                function __construct() {
 
8
                        parent::__construct();
 
9
                        
 
10
                        //Load required library
 
11
                        $this->load->model('user', '', TRUE);
 
12
                }
 
13
                
 
14
                
 
15
                /*
 
16
                 *      This function outputs data: user password hint.
 
17
                 */
 
18
                public function pwdhint() {
 
19
                $user = $this->input->post('hintPwd');
 
20
                        $data = array(
 
21
                                'hint' => $this->user->getPasswordHint($user)
 
22
                        );
 
23
                        
 
24
                        //Output JSON data
 
25
                        echo json_encode($data);
 
26
                }
 
27
 
 
28
                /*
 
29
                 *      This function outputs data: user password hint.
 
30
                 */
 
31
                public function ladok() {
 
32
                        $string = $this->input->post('data');
 
33
                        
 
34
                        $parsedArray = $this->user->parseLadok($string);
 
35
                        
 
36
                        if ($parsedArray === FALSE) {
 
37
                                $data = array('status' => FALSE);                               
 
38
                        } else {
 
39
                                //Add users to database
 
40
                                foreach ($parsedArray as $key => $value) {
 
41
                                        $this->user->addUser($parsedArray[$key]['username'], $parsedArray[$key]['firstname'] . ' ' . $parsedArray[$key]['lastname'], $parsedArray[$key]['ssn'], $parsedArray[$key]['ssn'], 'Student', 'Default', $parsedArray[$key]['email']);
 
42
                                }
 
43
                        
 
44
                                $data = array('status' => TRUE);                        
 
45
                        }
 
46
                        
 
47
                        //Output JSON data
 
48
                        echo json_encode($data);
 
49
                }
 
50
                
 
51
                /*
 
52
                 *      This function outputs data: user password hint.
 
53
                 */
 
54
                public function pwdchange() {
 
55
                        $pwdOld = $this->input->post('currentPwd');
 
56
                        $pwdNew = $this->input->post('newPwd');
 
57
                        $pwdHint = $this->input->post('hintPwd');
 
58
                
 
59
                        $data = array(
 
60
                                'status' => $this->user->changePassword($pwdOld, $pwdNew, $pwdHint)
 
61
                        );
 
62
                        
 
63
                        //Output JSON data
 
64
                        echo json_encode($data);
 
65
                }
 
66
                
 
67
                public function categoryOrderDecrease(){
 
68
                        $pwdOld = $this->input->post('currentPwd');
 
69
                        $pwdNew = $this->input->post('newPwd');
 
70
                }
 
71
        }
 
72
?>
 
 
b'\\ No newline at end of file'