/lenasys/0.1

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

« back to all changes in this revision

Viewing changes to DuggaSys/quizAjax/checkStudentCourseOccasion.php

  • Committer: Erik Wikström
  • Date: 2013-03-28 07:43:18 UTC
  • mto: This revision was merged to the branch mainline in revision 7.
  • Revision ID: wikxen@gmail.com-20130328074318-9v6krijkyap59nct
Removed trunk folder and moved its contents to the root

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
////Checks if student is registered for a course occasion
3
 
////Parameters: loginName, password, courseName, semester (e.g. HT), year (e.g. 12), period (e.g. 1,2,3,4 or 5)
4
 
////Returns true if student login name is registered for selected course and correct password was given
5
 
 
6
 
//Prevents browsers (IE) from caching the response
7
 
header('Cache-Control: no-cache, must-revalidate');
8
 
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
9
 
header('Content-type: application/json; charset=utf-8'); 
10
 
 
11
 
include "../../php/dbconnect.php";
12
 
 
13
 
$queryString="SELECT COUNT(*) 
14
 
                          FROM Student, StudentCourseRegistration
15
 
                          WHERE Student.loginName=:SLOGINNAME 
16
 
                                AND Student.passw=:PASSW
17
 
                            AND Student.ssn=StudentCourseRegistration.studentSsn 
18
 
                                AND StudentCourseRegistration.courseName=:CNAME 
19
 
                                AND StudentCourseRegistration.courseOccasion=:COCCASION;";
20
 
$stmt = $pdo->prepare($queryString);
21
 
$stmt->bindParam(':SLOGINNAME', $_POST['loginName']);
22
 
$stmt->bindParam(':PASSW', $_POST['password']);
23
 
$stmt->bindParam(':CNAME', $_POST['courseName']);
24
 
$occation=$_POST['semester']."-".$_POST['year']." LP".$_POST['period'];
25
 
$stmt->bindParam(':COCCASION', $occation);
26
 
$stmt->execute();
27
 
 
28
 
$count=$stmt->fetchColumn();
29
 
 
30
 
if($count==1) {
31
 
        echo json_encode(array('loginSuccess' => 'true'));
32
 
} else {
33
 
        echo json_encode(array('loginSuccess' => 'false'));
34
 
}
35
 
 
36
 
?>
 
 
b'\\ No newline at end of file'