-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmultipleusers.php
More file actions
131 lines (100 loc) · 2.64 KB
/
multipleusers.php
File metadata and controls
131 lines (100 loc) · 2.64 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?php
if( $_FILES['file']['name'] != "" )
{
//code for file upload
echo $_FILES['file']['name'];
move_uploaded_file($_FILES["file"]["tmp_name"],"upload/" . $_FILES["file"]["name"]) or die( "Could not copy file!");
//code to insert into mysql
$conn=mysql_connect("http://mysql15.000webhost.com","a8380572_oesek","sfh1234") or die (mysql_error());
mysql_select_db("a8380572_oesdb") or die (mysql_error());
$filename = "upload/" . $_FILES["file"]["name"];
echo $filename;
$fileh = fopen($filename, "r");
while (($Data = fgetcsv($fileh, 100, ",")) !== FALSE)
{
print_r($Data);
$sql = "INSERT into users(username,password,utype,college)
values('$Data[1]','md5($Data[2])','$Data[3]','$Data[4]')";
mysql_query($sql);
echo "Users Created";
echo "$Data[1] md5($Data[2]) $Data[3]";
}
fclose($fileh);
//mysql_close($con);
}
else
{
die("No file specified!");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Online Examination</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="style3"></div><div class="style_2"><span class="style3">
<a href="#" title="Online Exam"><strong>For Adroid</strong></a></span>
</div>
<div id="wrap">
<div id="topbar">
<h1 id="sitename"><a href="#">Online Examination </a></h1>
<div id="menus">
<ul id="topmenu">
<li class="active"><a href="#">Home</a>
</li>
<li><a href="createmultipleusers.html">Create Users</a>
</li>
<li><a href="createTest.html">Create Test</a>
</li>
<li><a href="UploadQuestions.html">Upload Questions</a>
</li>
</ul>
</div>
</div>
<div id="header">
</div>
<div id="content">
<div id="mainpage">
<?php
session_start();
if($_SESSION['myusername'] == "" | $_SESSION['myusername'] == null)
{
header("location: index.php");
}
?>
<h2>Questions are Loaded for test <?php echo $tid; ?></h2>
<h2>Uploaded File Info:</h2>
<ul>
<li>Sent file: <?php echo $_FILES['file']['name']; ?>
<li>File size: <?php echo $_FILES['file']['size']; ?> bytes
<li>File type: <?php echo $_FILES['file']['type']; ?>
</ul>
</div>
<div id="sidebar">
</div>
<div id="sidebarcontents">
<ul id="menu">
<li>
<h2>Admin Controll</h2>
</li>
<li>
<ul><li><a href="createmultipleusers.html">Create User</a></li>
<li><a href="createTest.html">Create Test</a></li>
<li><a href="UploadQuestions.html">Upload Questions</a></li>
</ul>
</li>
</ul>
</div>
<div id="sidebarbottom"></div>
</div>
<div class="clear"></div>
</div>
</div>
<div id="footer">
<p>Copyright © 2013 | Online Examination For Android Devices.</p>
</div>
</body>
</html>