-
Notifications
You must be signed in to change notification settings - Fork 18
/
default.php
100 lines (86 loc) · 2.44 KB
/
default.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
<?php
session_start();
session_destroy();
session_start();
$_SESSION['authuser']=1;
if(isset($_POST['save_btn']))
{
//write some of your code here, if necessary
$connect = mysql_connect("localhost", "root", "") or die ("check your server connection");
$uname= $_GET['myusername'];
$upass= $_GET['mypassword'];
$_SESSION['username']=$uname;
$_SESSION['pass']=$upass;
mysql_select_db ("2008b4a5723p");
$query="SELECT * FROM members WHERE username='$uname' and password='$upass'";
$results=mysql_query($query) or die(mysql_error());
if($row = mysql_fetch_array($results))
{
echo'<script> window.location="SchoolDB/result.php"; </script> ';
}
else{
echo"LOGIN FAILED(INVALID USERNAME OR PASSWORD)";
exit();
}
}
?>
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#ADD8E6">
<tr>
<form name="form1" method="get" action="result.php" onsubmit="return validate(this);">
<td>
<table width="100%" border="0" cellpadding="7" cellspacing="1" bgcolor="#ADD8E6">
<tr>
<td colspan="3"><strong><center><h2>Student Login</h2></center></strong></td>
</tr>
<tr>
<td></td>
<td><center><input name="myusername" placeholder="USERNAME" type="text" id="myusername"></center></td>
</tr>
<tr>
<td></td>
<center><td><center><input name="mypassword" placeholder="PASSWORD" type="password" id="mypassword"></center></td></center>
</tr>
<tr>
<td> </td>
<td><input type="submit" class="myButton" name="Submit" value="LOGIN"></td>
</form>
<form name="form2" method="post" action="newreg.php">
<td><input type="submit" class="myButton" name="newreg" value="SIGN UP"></td>
</form>
<td> </td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
<form name="form1" method="post" action="admin_page.php" style="float:left">
<input type="submit" class="myButton" name="Submit" value="Admin Login">
</form>
<html>
<head>
<script type="text/javascript">
function validate(form){
var userName = form.myusername.value;
var password = form.mypassword.value;
if (userName.length === 0) {
alert("You must enter a username.");
return false;
}
if (password.length === 0) {
alert("You must enter a password.");
return false;
}
return true;
}
</script>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="div1"></div>
<footer>
<a href="default.aspx" style="color: white;">Back to home</a>
© 2013 Gaikwad Company, Inc. Course Registration System
</footer>
</body>
</html>