-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIndex1.php
More file actions
115 lines (101 loc) · 3.84 KB
/
Copy pathIndex1.php
File metadata and controls
115 lines (101 loc) · 3.84 KB
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>myJourney</title>
<link href="login.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style2 {font-size: 14px}
.style3 {font-size: 12px}
-->
</style>
</head>
<?php
include("head2.php");
session_start();
$username="";
include('dbpreparedconn.php');
$error = false;
$dberror = false;
// run this only, once the user has hit the "Go" button
if (isset($_POST['go'])) {
// assign form inputs
$username = $_POST['username'];
$password = $_POST['password'];
// validate inputs
if ( !empty($username) && !empty($password) ) {
// validate the user from database
if($query->prepare("SELECT password FROM user where uname=?")){
$query->bind_param("s",$username);
$query->execute() or die('i am dead');
$query->bind_result($pass);
$query->fetch();
$query->close();
if($pass!=$password || empty($pass)){
//echo "pass not true";
$dberror=true;
//exit;
}
else{
//echo "everythings fine";
$_SESSION['username']=$username;
Header("Location: profile.php?username=$username");
exit;
}
//echo "disconnected";
}//end if query->prepare
else {
$dberror=true;
}//end of query->prepare else, if the query fails
}//end of !$username and !$password
else {
//echo "input failed";
$error = true; // input validation failed
}
}//end of if $GO
?>
<script src="jquery-1.7.2.js"></script>
<!--<script>
$("#head2 ul").hide();
$("#menu .settings").hide();
$("#menu .signout").hide();
$("#Layer1").hide();
</script>
-->
<body>
<form method="post" style="width:300px;height:300px;" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<table width="314" height="250" border="0" cellpadding="5" cellspacing="5" style="margin-top:0px; margin-left:10 px;">
<tr> <td height="32"><div align="left"><span style="color:#06BACE; font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 18px;">Login to myJourney</span></div></td>
</tr>
<tr>
<td width="308" height="78" style="padding-left::15px;"> <span class="style2" style="padding:5px;color:#06BACE;font-family: Geneva, Arial, Helvetica, sans-serif;">User name:</span><span class="style2"><br />
<input name="username" type="text" value="<?php echo $username; ?>" style="margin-left:5px; height: 30px; width: 200px;"/>
<?php
if ( $error && empty($username) ) {
echo '<br/><span style="color:red">Error! Please enter a user name.</span><br>',"\n";
}?>
</span></td>
</tr>
<tr>
<td height="96" style="padding-left::5px;"><span style="padding:5px;color:#06BACE;font-family: Geneva, Arial, Helvetica, sans-serif;"><span class="style2">Password</span>:</span><br />
<input name="password" type="password" style="margin-left:5px; height: 30px; width: 200px;"/>
<?php
if ( $error && empty($password) ) {
echo '<br/><span style="color:red">Error! Please enter a password.</span><br>',"\n";
}?>
<br /><br />
<input name="go" class="signin" type="submit" value="Sign In" style="padding-left:5px; margin-left:5px; color:#FFFBF0; background-color:#464646;border-style:none; border:thin;"/>
<br />
<?php
if ($dberror) {
echo '<span style="color:red">Invalid username or password.</span><br>',"\n";
}?>
<br />
<a href="signup.php" class="style3" style="color:#06BACE;font-family: Geneva, Arial, Helvetica, sans-serif; "> Create an account </a> </td>
</tr>
</table>
</form>
<div id="loginpic"><img src="images/a.jpeg" width=" 800" height="500"/></div>
</body>
</html>