-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAddProject.php
168 lines (148 loc) · 4.76 KB
/
AddProject.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--Developers:
Priyanka Nag (12030142001)
Raman -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="http://fonts.googleapis.com/css?family=Oswald" rel="stylesheet" type="text/css" />
<link href="default.css" rel="stylesheet" type="text/css" media="all" />
<style type="text/css">
<!--
.style4 {
color: #FFFFFF;
font-weight: bold;
font-size: 19px;
}
.style9 {color: #000000; font-size: 14px; }
.style11 {color: #000000}
.style12 {color: #FF0000}
-->
</style>
</head>
<body>
<div id="wrapper">
<div id="header">
<div id="logo">
<h1><a href="index.html"> <?php
$lines=file("config.inc");
echo $lines[0];
?></a></h1>
<pre class="clearfix style4"><em>A way to track and manage your projects </em></pre>
</div>
<div id="menu">
<ul>
<li><a href="ProjectDisplay.php">Home</a></li>
<li><a href="AddProject.php">Add a Project</a></li>
</ul>
</div>
</div>
<div id="page">
<div id="content">
<h2 class="title style11">Add new project </h2>
<h3>Enter details against the new project to be added</h3> <br />
<div class="entry"></div>
</div>
<div class="post">
<!--Login info-->
<fieldset><?php
error_reporting(0);
if($_POST["projectname"]!=null && $_POST["projectdescription"]!=null && $_POST["projectmanager"]!=null && $_POST["projectdeveloper"]!=null && $_POST["projecttargetdate"]!=null && $_POST["projectresources"]!=null)
{
$lines=file("config.inc");
$uname=trim(str_rot13($lines[2]));
$pwd=trim(str_rot13($lines[3]));
$projectname=$_POST["projectname"];
$projectdescription=$_POST["projectdescription"];
$projectmanager=$_POST["projectmanager"];
$projectdeveloper=$_POST["projectdeveloper"];
$projecttargetdate=$_POST["projecttargetdate"];
$projectresources=$_POST["projectresources"];
$con = mysql_connect($lines[5],$uname,$pwd);
if(!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db(trim(str_rot13($lines[1])));
$sql = "INSERT INTO ProjectInfo(projectID,projectname,projectdescription,projectmanager,projectdeveloper,targetdate,resources)
VALUES (NULL ,'$projectname', '$projectdescription', '$projectmanager', '$projectdeveloper', '$projecttargetdate', '$projectresources'
);";
if(mysql_query($sql,$con))
{
echo "<h3>Project added successfully</h3>";
}
else
{
echo "<h3>Project addition failed</h3>";
}
mysql_close($con);
}
?>
<form action="AddProject.php" method="POST">
<table cellspacing="4px" width="735">
<tr>
<td>Name of Project:</td>
<td width="504"><input type="text" name="projectname" /></td></tr>
<tr>
<td width="213">Description:</td>
<td width="504"><input type="text" name="projectdescription" /></td>
</tr>
<tr>
<td>Project Manager: </td>
<td width="504"><select name="projectmanager"><?php
$lines=file("config.inc");
$uname=trim(str_rot13($lines[2]));
$pwd=trim(str_rot13($lines[3]));
$con = mysql_connect($lines[5],$uname,$pwd);
if(!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db(trim(str_rot13($lines[1])));
$sql = "SELECT username FROM USERS where designation='Man'";
$retval = mysql_query( $sql, $con);
while($row = mysql_fetch_array($retval))
{
echo "<option value='{$row['username']}'>{$row['username']}</option>";
}
?> </select></td></tr>
<tr>
<td>Project Developer: </td>
<td width="504"><select name="projectdeveloper">
<?php
$sql = "SELECT username FROM USERS where designation='Dev'";
$retval = mysql_query( $sql, $con);
while($row = mysql_fetch_array($retval))
{
echo "<option value='{$row['username']}'>{$row['username']}</option>";
}
mysql_close($con);
?></select></td></tr>
<tr>
<td>
Target Date:<span class="style12">*</span></td>
<td><input name="projecttargetdate" type="text" size="25" placeholder="YYYY-MM-DD">
</td>
</tr>
<tr>
<td>Resources to be used:</td>
<td><input type="text" name="projectresources" /></td>
</tr>
<tr>
<td width="213"><input type="submit" value="Create Project"/> <input type="reset" value="Reset"/> </td>
</tr>
</table>
</fieldset>
</form>
</div>
</div>
</div>
<div id="footer">
<p>Designed and developed by Msc.CA (SICSR)</p>
</div>
</div>
</body>
</html>