-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsettings.php
More file actions
134 lines (126 loc) · 4.99 KB
/
settings.php
File metadata and controls
134 lines (126 loc) · 4.99 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
131
132
133
<?php
session_start();
if(!isset($_SESSION['user_id']))
header("location: login.php");
if(!isset($_SESSION['selection']))
$_SESSION['selection'] = 'Weekend';
$con=mysql_connect("localhost","four","password");
if (!$con) {
die('Could not connect to MySQL: ' . mysql_error());
}
else{
if ( !mysql_select_db("477b"))
{
echo "Can't connect to 477b";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>TraffX - Settings</title>
<meta charset="utf-8">
<link href = style.css rel = "stylesheet">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
var setting = "b1";
$(document).ready(function(){
$("#map").click(function(){
window.open ('index.php','_self',false);
});
$("#settings").click(function(){
window.open ('settings.php','_self',false);
});
$("#matrix").click(function(){
window.open ('matrix.php','_self',false);
});
$("#logout").click(function(){
window.open ('scripts/logout.php','_self',false)
});
<?php
$check = mysql_query("SELECT name FROM runs WHERE user_id='".$_SESSION['user_id']."'");
while($row = mysql_fetch_row($check))
{
echo("$(\"#".$row[0]."\").click(function(){setting = \"".$row[0]."\";window.open (\"scripts/switch.php?selection=".$row[0]."&last=settings\",'_self',false);});");
}
?>
$("#go").click(function(){
document.adjust.submit();
});
});
</script>
</head>
<body>
<div id="nav">
<img src = "logo.gif" width = "250px" style="margin-left:50px;float:right;"/>
<div id ="buttons">
<div class="tabs" id="map">Map</div>
<div class="tabs" id = "settings">Settings</div>
<div class="tabs" id = "matrix">Matrix</div>
<div class="tabs" id = "logout">Log Out</div>
</div>
</div>
<div id="master">
<div id="content">
<form action = "scripts/update.php" method = "post" id = "adjust" name = "adjust">
<?php
$check = mysql_query("SELECT routing_type, max_freeway_speed, vehicle_is_truck_percent, vehicle_is_rideshare_percent, vehicle_use_mapping_software_percent FROM runs WHERE user_id='".$_SESSION['user_id']."' AND name = '".$_SESSION['selection']."'");
$row = mysql_fetch_row($check)
?>
<div width = "300px" style = "float:left;">
<table>
<tr>
<td>Algorithm Type:</td>
<td><select name="algorithm">
<?php
$lines = mysql_query("SELECT id, name FROM routing_types WHERE 1=1");
while($line = mysql_fetch_row($lines))
{
if($line[0] != $row[0])
echo("<option value=".$line[0].">".$line[1]."</option>");
else
echo("<option selected value=".$line[0].">".$line[1]."</option>");
}
?>
</select></td></tr>
<tr>
<td>Max Freeway Speed:</td>
<td><input type="text" size="3" name = "max_speed" value = <?php echo("'".$row[1]."'"); ?> </input>MPH</td></tr>
<tr>
<td>Using Map Percentage:<br></td>
<td><input type="text" size="3" name = "map" value = <?php echo("'".$row[4]."'");?>></input>%</td></tr>
</table>
</div>
<div width = "300px" style = "float:right;">
<table>
<tr>
<td>Truck Percentage:<br></td>
<td><input type="text" size="3" name = "truck" value = <?php echo("'".$row[2]."'");?>></input>%</td></tr>
<tr>
<td>Rideshare Percentage:<br></td>
<td><input type="text" size="3" name = "share" value = <?php echo("'".$row[3]."'");?>></input>%</td></tr>
</table>
</form>
</div>
<center>
<div id = "go">
SAVE
</div>
</center>
</div>
<div id ="sidebar">
<?php
$check = mysql_query("SELECT name FROM runs WHERE user_id='".$_SESSION['user_id']."'");
while($row = mysql_fetch_row($check))
{
if($row[0] != $_SESSION['selection'])
echo("<div class =\"config\" id=\"".$row[0]."\">".$row[0]."</div>");
else
echo("<div class =\"config\" id=\"".$row[0]."\"style = \"background-color:orange\">".$row[0]."</div>");
}
?>
</div>
<br>
</div>
</body>
</html>