-
Notifications
You must be signed in to change notification settings - Fork 0
/
robotAttrConf6217.php
112 lines (108 loc) · 3.17 KB
/
robotAttrConf6217.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
<html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Scouting App</title>
<link rel="stylesheet" type="text/css" href="Style/scoutingStyle.css">
<body>
<h1><center>Bomb Botz Scouting App</center></h1>
</body>
<p></p>
<?php
$serverName = getenv("ScoutAppDatabaseServerName");
$database = getenv("Database");
$userName = getenv("DatabaseUserName");
$password = getenv("DatabasePassword");
$connectionOptions = array(
"Database" => "$database",
"Uid" => "$userName",
"PWD" => "$password"
);
//Establishes the connection
$conn = sqlsrv_connect($serverName, $connectionOptions);
// Get posted variables
$teamId = $_POST['teamId'];
$loginEmailAddress = getenv("DefaultLoginEmailAddress");
$tsql = "select scoutGUID from Scout where emailAddress = '$loginEmailAddress'";
$getResults = sqlsrv_query($conn, $tsql);
if ($getResults == FALSE)
if( ($errors = sqlsrv_errors() ) != null) {
foreach( $errors as $error ) {
echo "SQLSTATE: ".$error[ 'SQLSTATE']."<br />";
echo "code: ".$error[ 'code']."<br />";
echo "message: ".$error[ 'message']."<br />";
}
}
$row = sqlsrv_fetch_array($getResults, SQLSRV_FETCH_ASSOC);
$loginGUID = $row['scoutGUID'];
$value1 = $_POST['value1'];
$value2 = $_POST['value2'];
$value3 = $_POST['value3'];
$value4 = $_POST['value4'];
$value5 = $_POST['value5'];
$value6 = $_POST['value6'];
$value7 = $_POST['value7'];
$value8 = $_POST['value8'];
$value9 = $_POST['value9'];
$value10 = $_POST['value10'];
$value11 = $_POST['value11'];
$value12 = $_POST['value12'];
$value13 = $_POST['value13'];
$value14 = $_POST['value14'];
$value15 = $_POST['value15'];
?>
<p></p>
<h2>
<center><a id="buttons" class="clickme danger" href="index6217.php">Home</a>
<a id="buttons" class="clickme danger" href="robotAttrList6217.php">Scout Robot</a></center>
</h2>
<p></p>
<?php
$tsql = "sp_ins_scoutRobot $teamId, '$loginGUID', '$value1'";
if (isset($value2))
$tsql .= ", '$value2'";
if (isset($value3))
$tsql .= ", '$value3'";
if (isset($value4))
$tsql .= ", '$value4'";
if (isset($value5))
$tsql .= ", '$value5'";
if (isset($value6))
$tsql .= ", '$value6'";
if (isset($value7))
$tsql .= ", '$value7'";
if (isset($value8))
$tsql .= ", '$value8'";
if (isset($value9))
$tsql .= ", '$value9'";
if (isset($value10))
$tsql .= ", '$value10'";
if (isset($value11))
$tsql .= ", '$value11'";
if (isset($value12))
$tsql .= ", '$value12'";
if (isset($value13))
$tsql .= ", '$value13'";
if (isset($value14))
$tsql .= ", '$value14'";
if (isset($value15))
$tsql .= ", '$value15'";
$results = sqlsrv_query($conn, $tsql);
if($results)
echo "<p></p><center>Submission Succeeded!</center>";
if(!$results)
{
echo "It is not working!<br />";
if( ($errors = sqlsrv_errors() ) != null) {
foreach( $errors as $error ) {
echo "SQLSTATE: ".$error[ 'SQLSTATE']."<br />";
echo "code: ".$error[ 'code']."<br />";
echo "message: ".$error[ 'message']."<br />";
}
}
}
sqlsrv_free_stmt($getResults);
sqlsrv_close($conn);
if (isset($_FILES['robotphoto'])) {
$tmpName = $_FILES['robotphoto']['tmp_name'];
}
?>
</html>