-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinsertdivision.php
More file actions
37 lines (28 loc) · 895 Bytes
/
insertdivision.php
File metadata and controls
37 lines (28 loc) · 895 Bytes
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
<?php
if (isset($_COOKIE["username"])) {
$username = $_COOKIE["username"];
$password = $_COOKIE["password"];
$servername = "17carson.cs.uleth.ca";
$dbname = "zhas3660";
$conn = mysql_connect("17carson.cs.uleth.ca",$username,$password) or
die(mysql_error());
mysql_select_db($username,$conn) or die(mysql_error());
$sql = "insert into DIVISION(level,start,end) values ('$_POST[level]','$_POST[start]','$_POST[end]')";
if(mysql_query($sql,$conn))
{
echo "<h3> Division has been added</h3>";
echo "<p> Thanks for adding </p>";
} else {
$err = mysql_errno();
if($err == 1062)
{
echo "<p> Division $_POST[level] already in place </p>";
} else {
echo "<p>MySQL error code $err </p>";
}
}
echo "<a href=\"insert_division.php\">Return</a> to Previous Page.";
} else {
echo "<h3>not logged in</h3><p> <a href=\"index.php\">Login First</a></p>";
}
?>