-
Notifications
You must be signed in to change notification settings - Fork 0
/
webDesign.php
143 lines (131 loc) · 4.68 KB
/
webDesign.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php
session_start();
$url = parse_url(getenv("CLEARDB_DATABASE_URL"));
$server = $url["host"];
$username = $url["user"];
$password = $url["pass"];
$db = substr($url["path"], 1);
$location = null;
$error = false;
try {
$database = new PDO("mysql:host=$server;dbname=$db", $username, $password);
// set the PDO error mode to exception
$database->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
if ($e -> getcode() == 23000) {
echo "The username has already exist.";
}
else {
print($e->getMessage());
}
}
//NUSNET connection API
require_once 'LightOpenID-master/openid.php';
$openid= new LightOpenID("https://cleeque.herokuapp.com/webDesign.php");
$openid->identity = 'https://openid.nus.edu.sg/';
$openid->required = array(
'contact/email',
'namePerson/friendly',
'namePerson');
$openid->returnUrl = 'https://cleeque.herokuapp.com/nusnetlogin.php';
if(isset($_POST['submit'])){
$errMessage='';
$username=trim($_POST['username']);
$password=trim($_POST['password']);
if($username==''){
$errMessage.='Name is not filled! ';
}
if($password==''){
$errMessage.='Password is not filled! ';
}
if($errMessage==''){
$records= $database->prepare('SELECT id, username, password, email FROM userid WHERE username=:username');
$records->bindParam(':username', $username);
$records->execute();
$results=$records->fetch(PDO::FETCH_ASSOC);
if(count($results)>0 && password_verify($password, $results['password'])){
$_SESSION['username']=$results['username'];
echo "<script> alert('Login successful!'); window.location.href='dashboard.php';</script>";
echo $_SESSION['username'];
} else {
$errMessage.="Username and Password are not found!<br>";
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script type="text/javascript" src="main.js"></script>
<title> CLEEQUE</title>
<link type="text/css" rel="stylesheet" href="style.css"></link>
<!---Fonts-->
<link href='https://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Roboto:300' rel='stylesheet' type='text/css'>
</head>
<body>
<div class="modal">
<div class="modal-content">
<div class="modalHeader">
<span class="close"> X </span>
<p id="modalCleeque">CLEEQUE</p>
</div>
<div class="modalBody">
<a href='<?php echo $openid->authUrl()?>' style="text-decoration:none;"><div class="nusnetLogin">
<p>Login with NUSNET</p>
</div></a>
<form method="post">
<input type="text" id="username" placeholder="Username"><br><br>
<input type="password" id="password" placeholder="Password"><br>
<p id="errorMessage" style="color:red"></p>
<input type="submit" name="submit" value="Sign In" id="loginButton">
</form>
<br id="account"> Don't have an account? <a href="signup.php" id="modalSignup">Sign up!</a>
</div>
</div>
</div>
<div class="navbar">
<img id="logo" src="http://i.imgur.com/NXXGa4e.png" height="45" width="45" style="float: left;"><p id= "cleeque" style="margin-top:0px;" > CLEEQUE</p>
<div class="menu" style="float:right;">
<div class="mainMenu">
<p >Home</p>
<p>About</p>
<p>Contact Us</p>
</div>
<p id="login">Sign In</p>
<p id="responsiveNavButton"> ☰ Menu</p>
</div>
</div>
<div class="main">
<div class="slider">
<div class="sliderController">
<p id="slideBack" style="font-size: 100px; color: white; float: left; left: 2%;cursor:pointer"><</p>
<p id="slideNext" style="font-size: 100px; color: white; float: right; right: 2%;cursor:pointer">></p>
</div>
<div class="navdot">
<ul>
<li id="dot1" class="active"></li>
<li id="dot2"></li>
</ul>
</div>
<div class="slide" id="first">
<p><span style="font-size: 150px" >CLEEQUE</span></p>
<p id="tagline">Arranging a meeting has never been this easy</p>
</div>
<div class="slide" style="background-color:grey;">
<p style="font-color: white">Connecting The Dots</p>
</div>
<div class="slide" id="first">
<p><span style="font-size: 150px" >CLEEQUE</span></p>
<p span id="tagline">Arranging a meeting has never been this easy</p>
</div>
</div>
</div>
<div class="footer">
<p style="text-align: left;"> © Cleeque 2016</p>
</div>
</body>
</html>