Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
zekena
/
Unit-calculator
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
afb01805
authored
May 14, 2019
by
zekena
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugs
parent
50a1bd7b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
109 additions
and
71 deletions
categories/area.php
categories/length.php
categories/speed.php
categories/temperature.php
categories/volume.php
categories/weight.php
contact_data.csv
categories/area.php
View file @
afb01805
...
@@ -75,17 +75,17 @@ if ($_POST['submit']) {
...
@@ -75,17 +75,17 @@ if ($_POST['submit']) {
</nav>
</nav>
<div
id=
"side-menu"
class=
"side-nav"
>
<div
id=
"side-menu"
class=
"side-nav"
>
<a
href=
"#"
class=
"btn-close"
onclick=
"closeSlideMenu()"
>
×
</a>
<a
href=
"#"
class=
"btn-close"
onclick=
"closeSlideMenu()"
>
×
</a>
<a
href=
"
categories/
length.php"
>
Length
</a>
<a
href=
"length.php"
>
Length
</a>
<a
href=
"
categories/
temperature.php"
>
Temperature
</a>
<a
href=
"temperature.php"
>
Temperature
</a>
<a
href=
"
categories/
area.php"
>
Area
</a>
<a
href=
"area.php"
>
Area
</a>
<a
href=
"
categories/
volume.php"
>
Volume
</a>
<a
href=
"volume.php"
>
Volume
</a>
<a
href=
"
categories/
weight.php"
>
Weight
</a>
<a
href=
"weight.php"
>
Weight
</a>
<a
href=
"
categories/
speed.php"
>
Speed
</a>
<a
href=
"speed.php"
>
Speed
</a>
<a
href=
"login/login.php"
>
Log in
</a>
<a
href=
"
../
login/login.php"
>
Log in
</a>
</div>
</div>
<script
src=
"../js/
sl
ide.js"
></script>
<script
src=
"../js/
frontS
ide.js"
></script>
<div
id=
"title"
>
<div
id=
"title"
>
<h1>
Area
</h1>
<h1>
Area
</h1>
</div>
</div>
...
...
categories/length.php
View file @
afb01805
...
@@ -133,16 +133,16 @@ function length_options(){
...
@@ -133,16 +133,16 @@ function length_options(){
</nav>
</nav>
<div
id=
"side-menu"
class=
"side-nav"
>
<div
id=
"side-menu"
class=
"side-nav"
>
<a
href=
"#"
class=
"btn-close"
onclick=
"closeSlideMenu()"
>
×
</a>
<a
href=
"#"
class=
"btn-close"
onclick=
"closeSlideMenu()"
>
×
</a>
<a
href=
"
categories/
length.php"
>
Length
</a>
<a
href=
"length.php"
>
Length
</a>
<a
href=
"categories/
temperature.php"
>
Temperature
</a>
<a
href=
"
temperature.php"
>
Temperature
</a>
<a
href=
"categories/
area.php"
>
Area
</a>
<a
href=
"
area.php"
>
Area
</a>
<a
href=
"categories/
volume.php"
>
Volume
</a>
<a
href=
"
volume.php"
>
Volume
</a>
<a
href=
"categories/
weight.php"
>
Weight
</a>
<a
href=
"
weight.php"
>
Weight
</a>
<a
href=
"categories/
speed.php"
>
Speed
</a>
<a
href=
"
speed.php"
>
Speed
</a>
<a
href=
"
login/login.php"
>
Log in
</a>
<a
href=
"../
login/login.php"
>
Log in
</a>
</div>
</div>
<script
src=
"../js/
sl
ide.js"
></script>
<script
src=
"../js/
fronts
ide.js"
></script>
<div
id=
"title"
>
<div
id=
"title"
>
<h1>
Length
</h1>
<h1>
Length
</h1>
</div>
</div>
...
...
categories/speed.php
View file @
afb01805
<?php
<?php
if
(
file_exists
(
'dbconnect.php'
))
{
if
(
file_exists
(
'dbconnect.php'
))
{
require
(
'dbconnect.php'
);
require
(
'dbconnect.php'
);
if
(
mysqli_connect_error
())
{
if
(
mysqli_connect_error
())
{
die
(
'Connect Error ('
.
mysqli_connect_errno
()
.
')'
.
mysqli_connect_error
());
die
(
'Connect Error ('
.
mysqli_connect_errno
()
.
')'
.
mysqli_connect_error
());
}
}
}
}
//Add function file
//Add function file
if
(
file_exists
(
'../includes/functions.php'
))
{
if
(
file_exists
(
'../includes/functions.php'
))
{
require_once
(
'../includes/functions.php'
);
require_once
(
'../includes/functions.php'
);
...
@@ -24,9 +24,9 @@ if ($_POST['submit']) {
...
@@ -24,9 +24,9 @@ if ($_POST['submit']) {
$to_value
=
convert_speed
(
$from_value
,
$from_unit
,
$to_unit
);
$to_value
=
convert_speed
(
$from_value
,
$from_unit
,
$to_unit
);
$sql
=
"INSERT INTO speed_entry(from_unit,to_unit,from_value,to_value) VALUES ('
$from_unit
','
$to_unit
','
$from_value
','
$to_value
');"
;
$sql
=
"INSERT INTO speed_entry(from_unit,to_unit,from_value,to_value) VALUES ('
$from_unit
','
$to_unit
','
$from_value
','
$to_value
');"
;
if
(
!
mysqli_query
(
$link
,
$sql
))
{
if
(
!
mysqli_query
(
$link
,
$sql
))
{
die
(
'An error occurred when submitting your review.'
);
die
(
'An error occurred when submitting your review.'
);
}
}
}
}
$speed_options
=
array
(
$speed_options
=
array
(
...
@@ -64,17 +64,17 @@ $speed_options = array(
...
@@ -64,17 +64,17 @@ $speed_options = array(
</nav>
</nav>
<div
id=
"side-menu"
class=
"side-nav"
>
<div
id=
"side-menu"
class=
"side-nav"
>
<a
href=
"#"
class=
"btn-close"
onclick=
"closeSlideMenu()"
>
×
</a>
<a
href=
"#"
class=
"btn-close"
onclick=
"closeSlideMenu()"
>
×
</a>
<a
href=
"
categories/
length.php"
>
Length
</a>
<a
href=
"length.php"
>
Length
</a>
<a
href=
"categories/
temperature.php"
>
Temperature
</a>
<a
href=
"
temperature.php"
>
Temperature
</a>
<a
href=
"categories/
area.php"
>
Area
</a>
<a
href=
"
area.php"
>
Area
</a>
<a
href=
"categories/
volume.php"
>
Volume
</a>
<a
href=
"
volume.php"
>
Volume
</a>
<a
href=
"categories/
weight.php"
>
Weight
</a>
<a
href=
"
weight.php"
>
Weight
</a>
<a
href=
"categories/
speed.php"
>
Speed
</a>
<a
href=
"
speed.php"
>
Speed
</a>
<a
href=
"
login/login.php"
>
Log in
</a>
<a
href=
"../
login/login.php"
>
Log in
</a>
</div>
</div>
<script
src=
"../js/
sl
ide.js"
></script>
<script
src=
"../js/
fronts
ide.js"
></script>
<div
id=
"title"
>
<div
id=
"title"
>
<h1>
Speed
</h1>
<h1>
Speed
</h1>
</div>
</div>
...
...
categories/temperature.php
View file @
afb01805
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
if
(
file_exists
(
'dbconnect.php'
))
{
if
(
file_exists
(
'dbconnect.php'
))
{
require
(
'dbconnect.php'
);
require
(
'dbconnect.php'
);
if
(
mysqli_connect_error
())
{
if
(
mysqli_connect_error
())
{
die
(
'Connect Error ('
.
mysqli_connect_errno
()
.
')'
.
mysqli_connect_error
());
die
(
'Connect Error ('
.
mysqli_connect_errno
()
.
')'
.
mysqli_connect_error
());
}
}
}
}
//Add function file
//Add function file
...
@@ -25,7 +25,7 @@ if ($_POST['submit']) {
...
@@ -25,7 +25,7 @@ if ($_POST['submit']) {
$to_value
=
convert_temp
(
$from_value
,
$from_unit
,
$to_unit
);
$to_value
=
convert_temp
(
$from_value
,
$from_unit
,
$to_unit
);
$sql
=
"INSERT INTO temperature_entry(from_unit,to_unit,from_value,to_value) VALUES ('
$from_unit
','
$to_unit
','
$from_value
','
$to_value
');"
;
$sql
=
"INSERT INTO temperature_entry(from_unit,to_unit,from_value,to_value) VALUES ('
$from_unit
','
$to_unit
','
$from_value
','
$to_value
');"
;
if
(
!
mysqli_query
(
$link
,
$sql
))
{
if
(
!
mysqli_query
(
$link
,
$sql
))
{
die
(
'An error occurred when submitting your review.'
);
die
(
'An error occurred when submitting your review.'
);
}
}
}
}
...
@@ -111,17 +111,17 @@ $temp_options = array(
...
@@ -111,17 +111,17 @@ $temp_options = array(
</nav>
</nav>
<div
id=
"side-menu"
class=
"side-nav"
>
<div
id=
"side-menu"
class=
"side-nav"
>
<a
href=
"#"
class=
"btn-close"
onclick=
"closeSlideMenu()"
>
×
</a>
<a
href=
"#"
class=
"btn-close"
onclick=
"closeSlideMenu()"
>
×
</a>
<a
href=
"
categories/
length.php"
>
Length
</a>
<a
href=
"length.php"
>
Length
</a>
<a
href=
"categories/
temperature.php"
>
Temperature
</a>
<a
href=
"
temperature.php"
>
Temperature
</a>
<a
href=
"categories/
area.php"
>
Area
</a>
<a
href=
"
area.php"
>
Area
</a>
<a
href=
"categories/
volume.php"
>
Volume
</a>
<a
href=
"
volume.php"
>
Volume
</a>
<a
href=
"categories/
weight.php"
>
Weight
</a>
<a
href=
"
weight.php"
>
Weight
</a>
<a
href=
"categories/
speed.php"
>
Speed
</a>
<a
href=
"
speed.php"
>
Speed
</a>
<a
href=
"
login/login.php"
>
Log in
</a>
<a
href=
"../
login/login.php"
>
Log in
</a>
</div>
</div>
<script
src=
"../js/
sl
ide.js"
></script>
<script
src=
"../js/
fronts
ide.js"
></script>
<div
id=
"title"
>
<div
id=
"title"
>
<h1>
Temperature
</h1>
<h1>
Temperature
</h1>
</div>
</div>
...
...
categories/volume.php
View file @
afb01805
This diff is collapsed.
Click to expand it.
categories/weight.php
View file @
afb01805
<?php
<?php
if
(
file_exists
(
'dbconnect.php'
))
{
if
(
file_exists
(
'dbconnect.php'
))
{
require
(
'dbconnect.php'
);
require
(
'dbconnect.php'
);
if
(
mysqli_connect_error
())
{
if
(
mysqli_connect_error
())
{
die
(
'Connect Error ('
.
mysqli_connect_errno
()
.
')'
.
mysqli_connect_error
());
die
(
'Connect Error ('
.
mysqli_connect_errno
()
.
')'
.
mysqli_connect_error
());
}
}
}
}
//Add function file
//Add function file
...
@@ -25,7 +25,7 @@ if ($_POST['submit']) {
...
@@ -25,7 +25,7 @@ if ($_POST['submit']) {
$to_value
=
convert_mass
(
$from_value
,
$from_unit
,
$to_unit
);
$to_value
=
convert_mass
(
$from_value
,
$from_unit
,
$to_unit
);
$sql
=
"INSERT INTO weight_entry(from_unit,to_unit,from_value,to_value) VALUES ('
$from_unit
','
$to_unit
','
$from_value
','
$to_value
');"
;
$sql
=
"INSERT INTO weight_entry(from_unit,to_unit,from_value,to_value) VALUES ('
$from_unit
','
$to_unit
','
$from_value
','
$to_value
');"
;
if
(
!
mysqli_query
(
$link
,
$sql
))
{
if
(
!
mysqli_query
(
$link
,
$sql
))
{
die
(
'An error occurred when submitting your review.'
);
die
(
'An error occurred when submitting your review.'
);
}
}
}
}
...
@@ -117,17 +117,17 @@ $mass_options = array(
...
@@ -117,17 +117,17 @@ $mass_options = array(
</nav>
</nav>
<div
id=
"side-menu"
class=
"side-nav"
>
<div
id=
"side-menu"
class=
"side-nav"
>
<a
href=
"#"
class=
"btn-close"
onclick=
"closeSlideMenu()"
>
×
</a>
<a
href=
"#"
class=
"btn-close"
onclick=
"closeSlideMenu()"
>
×
</a>
<a
href=
"categories/
length.php"
>
Length
</a>
<a
href=
"
length.php"
>
Length
</a>
<a
href=
"categories/
temperature.php"
>
Temperature
</a>
<a
href=
"
temperature.php"
>
Temperature
</a>
<a
href=
"categories/
area.php"
>
Area
</a>
<a
href=
"
area.php"
>
Area
</a>
<a
href=
"categories/
volume.php"
>
Volume
</a>
<a
href=
"
volume.php"
>
Volume
</a>
<a
href=
"categories/
weight.php"
>
Weight
</a>
<a
href=
"
weight.php"
>
Weight
</a>
<a
href=
"categories/
speed.php"
>
Speed
</a>
<a
href=
"
speed.php"
>
Speed
</a>
<a
href=
"
login/login.php"
>
Log in
</a>
<a
href=
"../
login/login.php"
>
Log in
</a>
</div>
</div>
<script
src=
"../js/
sl
ide.js"
></script>
<script
src=
"../js/
fronts
ide.js"
></script>
<div
id=
"title"
>
<div
id=
"title"
>
<h1>
Weight
</h1>
<h1>
Weight
</h1>
</div>
</div>
...
@@ -143,15 +143,33 @@ $mass_options = array(
...
@@ -143,15 +143,33 @@ $mass_options = array(
<input
id=
"Input"
class=
"Input-text"
placeholder=
"Enter amount"
name=
"from_value"
value=
"
<?php
echo
$from_value
;
?>
"
/>
<input
id=
"Input"
class=
"Input-text"
placeholder=
"Enter amount"
name=
"from_value"
value=
"
<?php
echo
$from_value
;
?>
"
/>
<label
for=
"Input"
class=
"Input-label"
>
Your entry
</label>
<label
for=
"Input"
class=
"Input-label"
>
Your entry
</label>
<select
name=
"from_unit"
>
<select
name=
"from_unit"
>
<option
value=
"ounces"
<?php
if
(
$from_unit
==
'ounces'
)
{
echo
" selected"
;
}
?>
>
ounces
</option>
<option
value=
"ounces"
<?php
if
(
$from_unit
==
'ounces'
)
{
<option
value=
"pounds"
<?php
if
(
$from_unit
==
'pounds'
)
{
echo
" selected"
;
}
?>
>
pounds
</option>
echo
" selected"
;
<option
value=
"stones"
<?php
if
(
$from_unit
==
'stones'
)
{
echo
" selected"
;
}
?>
>
stones
</option>
}
?>
>
ounces
</option>
<option
value=
"long_tons"
<?php
if
(
$from_unit
==
'long_tons'
)
{
echo
" selected"
;
}
?>
>
long tons
</option>
<option
value=
"pounds"
<?php
if
(
$from_unit
==
'pounds'
)
{
<option
value=
"short_tons"
<?php
if
(
$from_unit
==
'short_tons'
)
{
echo
" selected"
;
}
?>
>
short tons
</option>
echo
" selected"
;
<option
value=
"milligrams"
<?php
if
(
$from_unit
==
'milligrams'
)
{
echo
" selected"
;
}
?>
>
milligrams
</option>
}
?>
>
pounds
</option>
<option
value=
"grams"
<?php
if
(
$from_unit
==
'grams'
)
{
echo
" selected"
;
}
?>
>
grams
</option>
<option
value=
"stones"
<?php
if
(
$from_unit
==
'stones'
)
{
<option
value=
"kilograms"
<?php
if
(
$from_unit
==
'kilograms'
)
{
echo
" selected"
;
}
?>
>
kilograms
</option>
echo
" selected"
;
<option
value=
"metric_tonnes"
<?php
if
(
$from_unit
==
'metric_tonnes'
)
{
echo
" selected"
;
}
?>
>
metric tonnes
</option>
}
?>
>
stones
</option>
<option
value=
"long_tons"
<?php
if
(
$from_unit
==
'long_tons'
)
{
echo
" selected"
;
}
?>
>
long tons
</option>
<option
value=
"short_tons"
<?php
if
(
$from_unit
==
'short_tons'
)
{
echo
" selected"
;
}
?>
>
short tons
</option>
<option
value=
"milligrams"
<?php
if
(
$from_unit
==
'milligrams'
)
{
echo
" selected"
;
}
?>
>
milligrams
</option>
<option
value=
"grams"
<?php
if
(
$from_unit
==
'grams'
)
{
echo
" selected"
;
}
?>
>
grams
</option>
<option
value=
"kilograms"
<?php
if
(
$from_unit
==
'kilograms'
)
{
echo
" selected"
;
}
?>
>
kilograms
</option>
<option
value=
"metric_tonnes"
<?php
if
(
$from_unit
==
'metric_tonnes'
)
{
echo
" selected"
;
}
?>
>
metric tonnes
</option>
</select>
</select>
</div>
</div>
...
@@ -159,15 +177,33 @@ $mass_options = array(
...
@@ -159,15 +177,33 @@ $mass_options = array(
<input
readonly
id=
"Input"
class=
"Input-text"
placeholder=
"Wait for it"
name=
"to_value"
value=
"
<?php
echo
float_to_string
(
$to_value
);
?>
"
/>
<input
readonly
id=
"Input"
class=
"Input-text"
placeholder=
"Wait for it"
name=
"to_value"
value=
"
<?php
echo
float_to_string
(
$to_value
);
?>
"
/>
<label
for=
"Input"
class=
"input-label"
>
Converted Result
</label>
<label
for=
"Input"
class=
"input-label"
>
Converted Result
</label>
<select
name=
"to_unit"
>
<select
name=
"to_unit"
>
<option
value=
"ounces"
<?php
if
(
$to_unit
==
'ounces'
)
{
echo
" selected"
;
}
?>
>
ounces
</option>
<option
value=
"ounces"
<?php
if
(
$to_unit
==
'ounces'
)
{
<option
value=
"pounds"
<?php
if
(
$to_unit
==
'pounds'
)
{
echo
" selected"
;
}
?>
>
pounds
</option>
echo
" selected"
;
<option
value=
"stones"
<?php
if
(
$to_unit
==
'stones'
)
{
echo
" selected"
;
}
?>
>
stones
</option>
}
?>
>
ounces
</option>
<option
value=
"long_tons"
<?php
if
(
$to_unit
==
'long_tons'
)
{
echo
" selected"
;
}
?>
>
long tons/option>
<option
value=
"pounds"
<?php
if
(
$to_unit
==
'pounds'
)
{
<option
value=
"short_tons"
<?php
if
(
$to_unit
==
'short_tons'
)
{
echo
" selected"
;
}
?>
>
short tons
</option>
echo
" selected"
;
<option
value=
"milligrams"
<?php
if
(
$to_unit
==
'milligrams'
)
{
echo
" selected"
;
}
?>
>
milligrams
</option>
}
?>
>
pounds
</option>
<option
value=
"grams"
<?php
if
(
$to_unit
==
'grams'
)
{
echo
" selected"
;
}
?>
>
grams
</option>
<option
value=
"stones"
<?php
if
(
$to_unit
==
'stones'
)
{
<option
value=
"kilograms"
<?php
if
(
$to_unit
==
'kilograms'
)
{
echo
" selected"
;
}
?>
>
kilograms
</option>
echo
" selected"
;
<option
value=
"metric_tonnes"
<?php
if
(
$to_unit
==
'metric_tonnes'
)
{
echo
" selected"
;
}
?>
>
metric tonnes
</option>
}
?>
>
stones
</option>
<option
value=
"long_tons"
<?php
if
(
$to_unit
==
'long_tons'
)
{
echo
" selected"
;
}
?>
>
long tons/option>
<option
value=
"short_tons"
<?php
if
(
$to_unit
==
'short_tons'
)
{
echo
" selected"
;
}
?>
>
short tons
</option>
<option
value=
"milligrams"
<?php
if
(
$to_unit
==
'milligrams'
)
{
echo
" selected"
;
}
?>
>
milligrams
</option>
<option
value=
"grams"
<?php
if
(
$to_unit
==
'grams'
)
{
echo
" selected"
;
}
?>
>
grams
</option>
<option
value=
"kilograms"
<?php
if
(
$to_unit
==
'kilograms'
)
{
echo
" selected"
;
}
?>
>
kilograms
</option>
<option
value=
"metric_tonnes"
<?php
if
(
$to_unit
==
'metric_tonnes'
)
{
echo
" selected"
;
}
?>
>
metric tonnes
</option>
</select>
</select>
</div>
</div>
...
...
contact_data.csv
View file @
afb01805
...
@@ -7,3 +7,5 @@
...
@@ -7,3 +7,5 @@
6,,,
6,,,
7,,,
7,,,
8,,,
8,,,
9,,,
10,,,
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment