-
Notifications
You must be signed in to change notification settings - Fork 3
/
home.php
139 lines (113 loc) · 3.51 KB
/
home.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
<?php
session_start();
require_once("config.php");
if ($_SESSION["USER"]=="") {
echo "please login first";
exit("Please login first");
}
$result="";
if(isset($_POST['rollno'])&& $_POST['rollno'] !='')
{
$yourRollno = $conn->real_escape_string($_POST['rollno']);
$forwhat = $conn->real_escape_string($_POST['for']);
$yourMoney = $conn->real_escape_string($_POST['rupees']);
$sql="INSERT INTO recordsh (fromw,rollno, forw, rupees) VALUES ('".$_SESSION["USER"]."','".$yourRollno."','".$forwhat."', '".$yourMoney."')";
if(!$result = $conn->query($sql)){
die('There was an error running the query [' . $conn->error . ']');
}
else{
$result="DUE HAS BEEN SUBMITTED AGAINST ".$yourRollno." ";
}
}
?>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
<br>
<?php
require_once("config.php");
$result2="";
if(isset($_POST['uploadBtn'])){
$filename=$_FILES['myFile']['name'];
$fileTmpName=$_FILES['myFile']['tmp_name'];
$handle= fopen($fileTmpName , 'r');
$fileExtension= pathinfo($filename,PATHINFO_EXTENSION);
while(($myData =fgetcsv($handle,1000,","))!==FALSE){
$fromw=$_SESSION["USER"];
$roll= $myData[0];
$for= $myData[1];
$rupees= $myData[2];
$sql= "insert into recordsh (fromw,rollno,forw,rupees)
values('".$fromw."','".$roll."','".$for."','".$rupees."') ";
$result2 = $conn->query($sql);
$result2="CSV uploaded successfully";
}
}
?>
<div class="container" >
<div class="row">
<div class="col-lg-6" align="left";>
<form action="account.php">
<button type="submit" class="btn btn-primary" name="account" value="account" id="submit_form">My account</button>
</form>
</div>
<div class="col-lg-6" align="right";>
<form action="logout.php">
<button type="submit" class="btn btn-primary" name="logout" value="logout" id="submit_form">Logout</button>
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-lg-4">
<img class="logoimg" style="width: 100px; height: 100px;" src="images/logo.gif" align="right">
</div>
<div class="col-lg-8">
<br>
<h2 >Indian Institute of Information Technology, Una</h2>
<h3 >Dues Management System.</h3>
</div>
</div>
</div>
<br><br>
<div class="container-fluid" style="width: 94%;" >
<div class="row">
<div class="col-sm-6" align="left">
<h2 >Submit due against someone.</h2>
<H4> <?= $result; ?> </H4>
<form name="contact-form" action="" method="post" id="contact-form">
<div class="form-group">
<label for="exampleInputEmail1">Roll number</label>
<input type="text" class="form-control" name="rollno" placeholder="roll number" required>
</div>
<div class="form-group">
<label for="reason">For what</label>
<input type="text" class="form-control" name="for" placeholder="for what" required>
</div>
<div class="form-group">
<label for="Phone">Money</label>
<input type="text" class="form-control" name="rupees" placeholder="rupees" required>
</div>
<button type="submit" class="btn btn-primary" name="submit" value="Submit" id="submit_form">Submit</button>
</form>
</div>
<div class="col-sm-6">
<br/><br/>
<form action="" method="post" enctype="multipart/form-data">
<h4><?= $result2;?></h4>
<div class="form-group">
<input type="file" name="myFile" class="form-control">
</div>
<div class="form-group">
<input type="submit" name="uploadBtn">
</div>
</form>
</div>
</div>
</div>
<br>
</body>
</html>