Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
abalsh
/
Garlix
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
b2525742
authored
May 08, 2019
by
Florian Shllaku
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
currency validated with non-numeric value
parent
7fadc840
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
10 deletions
database/seeds/CurrencyUpdates.php
resources/views/currency.blade.php
database/seeds/CurrencyUpdates.php
View file @
b2525742
...
...
@@ -23,6 +23,12 @@ class CurrencyUpdates extends Seeder
$i
=
0
;
DB
::
table
(
'currency'
)
->
updateOrInsert
(
[
'iso'
=>
"EUR"
,
'name'
=>
"Euro"
],
[
'rates'
=>
1
]
);
foreach
(
$XMLContent
as
$line
){
if
(
preg_match
(
"/currency='([[:alpha:]]+)'/"
,
$line
,
$currencyCode
)){
if
(
preg_match
(
"/rate='([[:graph:]]+)'/"
,
$line
,
$rate
)){
...
...
resources/views/currency.blade.php
View file @
b2525742
...
...
@@ -27,18 +27,21 @@
<button class="
btn
btn
--
pill
" type="
submit
">Convert!</button>
</form>
<?php
if( isset(
$_GET["From"]
))
if( isset(
$_GET["From"]
)
&& isset(
$_GET["Amount"]
) && isset(
$_GET["To"]
)
)
{
$value
=
$_GET['Amount']
;
$arrFrom
= (DB::table('currency')->select('rates')->where('iso', '=',
$_GET['From']
)->get())->pluck('rates');
$From
=
$arrFrom[0]
;
if (!empty(
$_GET["From"]
) && !empty(
$_GET["Amount"]
) && !empty(
$_GET["To"]
)){
$arrTo
= (DB::table('currency')->select('rates')->where('iso', '=',
$_GET['To']
)->get())->pluck('rates');
$To
=
$arrTo[0]
;
$rez
= (
$value
/
$From
) *
$To
;
echo
$rez
;
$value
=
$_GET['Amount']
;
$arrFrom
= (DB::table('currency')->select('rates')->where('iso', '=',
$_GET['From']
)->get())->pluck('rates');
$From
=
$arrFrom[0]
;
$arrTo
= (DB::table('currency')->select('rates')->where('iso', '=',
$_GET['To']
)->get())->pluck('rates');
$To
=
$arrTo[0]
;
$rez
= (
$value
/
$From
) *
$To
;
echo
$rez
;
}
}
?>
</div>
...
...
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