Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation and animation #18

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/semgrep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on:
pull_request: {}
push:
branches:
- main
- master
paths:
- .github/workflows/semgrep.yml
schedule:
# random HH:MM to avoid a load spike on GitHub Actions at 00:00
- cron: 23 15 * * *
name: Semgrep
jobs:
semgrep:
name: Scan
runs-on: ubuntu-20.04
env:
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
container:
image: returntocorp/semgrep
steps:
- uses: actions/checkout@v3
- run: semgrep ci
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ If you find this project useful...
[Donate](https://www.paypal.com/biz/fund?id=ZDR2NTBSKK7JE)
****

Enhanced by Cory J. Potter aka CoreConduit Consulting Services 2018 - 2020
# Enhanced by Cory J. Potter aka CoreConduit Consulting Services 2018 - 2020

# Core Contributor: Juan Gimpaya
YT link:https://www.youtube.com/c/ClevergunsYT/featured


The application was initially created by Siamon Hasan, using [php](http:php.net),
[mysql](https://www.mysql.com) and [bootstrap](http://getbootstrap.com).
Expand Down
3 changes: 2 additions & 1 deletion includes/formatcurrency.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ function formatcurrency($floatcurr, $curr = 'USD')
'TOP' => array(NULL,2,'.',',',0), // Tonga, Paanga
'AED' => array(NULL,2,'.',',',0), // UAE Dirham
'UAH' => array(NULL,2,',',' ',0), // Ukraine, Hryvnia
'USD' => array('$',2,'.',',',0), // US Dollar
/* i just change peso sign but not php*/
'USD' => array('₱',2,'.',',',0), // US Dollar
'VUV' => array(NULL,0,'',',',0), // Vanuatu, Vatu
'VEF' => array(NULL,2,',','.',0), // Venezuela Bolivares Fuertes
'VEB' => array(NULL,2,',','.',0), // Venezuela, Bolivar
Expand Down
7 changes: 5 additions & 2 deletions includes/sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,12 @@ function updateLastLogIn($user_id)

/*--------------------------------------------------------------*/
/* Function to log the action of a user
/*--------------------------------------------------------------*/

function logAction($user_id, $remote_ip, $action)
(old version)function logAction($user_id, $remote_ip, $action )


/*--------------------------------------------------------------*/
function logAction($user_id = null, $remote_ip = null, $action = null)
{
global $db;
$date = make_date();
Expand Down
30 changes: 11 additions & 19 deletions products/add_product.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

$all_categories = find_all('categories');
$all_photo = find_all('media');

if (isset($_POST['add_product'])) {
$req_fields = array('product-title', 'product-category', 'product-quantity', 'cost-price', 'sale-price' );
validate_fields($req_fields);
Expand Down Expand Up @@ -44,8 +44,6 @@
$product_id = $product['id'];
if ( $product_id == 0 ) {
$session->msg('d', ' Sorry, Failed to Add!');
$log_action = "failed";
logAction( $log_action );
redirect('../products/add_product.php', false);
}

Expand All @@ -58,21 +56,15 @@
$result = $db->query($sql);
if ( $result && $db->affected_rows() === 1) {
$session->msg('s', "Product Added ");
$log_action = "success";
logAction( $log_action );
redirect('../products/products.php', false);
}
} else {
$session->msg('d', ' Sorry, Failed to Add!');
$log_action = "failed";
logAction( $log_action );
redirect('../products/add_product.php', false);
}

} else {
$session->msg("d", $errors);
$log_action = $errors;
logAction( $log_action );
redirect('../products/add_product.php', false);
}

Expand Down Expand Up @@ -108,7 +100,7 @@
<span class="input-group-addon">
<i class="glyphicon glyphicon-th-large"></i>
</span>
<input type="text" class="form-control" name="product-title" value="<?php echo remove_junk($product['name']);?>" placeholder="Name">
<input type="text" class="form-control" name="product-title" value="" placeholder="Name">
</div>
</div>

Expand All @@ -118,23 +110,23 @@
<span class="input-group-addon">
<i class="glyphicon glyphicon-th-large"></i>
</span>
<input type="text" class="form-control" name="product-desc" value="<?php echo remove_junk($product['description']);?>" placeholder="Description">
<input type="text" class="form-control" name="product-desc" value="" placeholder="Description">
</div>
</div>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">
<i class="glyphicon glyphicon-th-large"></i>
</span>
<input type="text" class="form-control" name="product-sku" value="<?php echo remove_junk($product['sku']);?>" placeholder="SKU">
<input type="text" class="form-control" name="product-sku" value="" placeholder="SKU">
</div>
</div>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">
<i class="glyphicon glyphicon-th-large"></i>
</span>
<input type="text" class="form-control" name="product-location" value="<?php echo remove_junk($product['location']);?>" placeholder="Location">
<input type="text" class="form-control" name="product-location" value="" placeholder="Location">
</div>
</div>

Expand All @@ -145,7 +137,7 @@
<select class="form-control" name="product-category">
<option value=""> Select a category</option>
<?php foreach ($all_categories as $cat): ?>
<option value="<?php echo (int)$cat['id']; ?>" <?php if ($product['category_id'] === $cat['id']): echo "selected"; endif; ?> >
<option value="<?php echo (int)$cat['id']; ?>">
<?php echo remove_junk($cat['name']); ?></option>
<?php endforeach; ?>
</select>
Expand All @@ -154,14 +146,14 @@
<select class="form-control" name="product-photo">
<option value=""> No image</option>
<?php foreach ($all_photo as $photo): ?>
<option value="<?php echo (int)$photo['id'];?>" <?php if ($product['media_id'] === $photo['id']): echo "selected"; endif; ?> >
<option value="<?php echo (int)$photo['id'];?>">
<?php echo $photo['file_name'] ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
</div>

<div class="form-group">
<div class="row">
<div class="col-md-4">
Expand All @@ -171,7 +163,7 @@
<span class="input-group-addon">
<i class="glyphicon glyphicon-shopping-cart"></i>
</span>
<input type="number" class="form-control" name="product-quantity" value="<?php echo remove_junk($product['quantity']); ?>">
<input type="number" class="form-control" name="product-quantity" value="">
</div>
</div>
</div>
Expand All @@ -182,7 +174,7 @@
<span class="input-group-addon">
<i class="glyphicon glyphicon-piggy-bank"></i>
</span>
<input type="number" min="0" step="any" class="form-control" name="cost-price" value="<?php echo remove_junk($product['buy_price']);?>">
<input type="number" min="0" step="any" class="form-control" name="cost-price" value="">
</div>
</div>
</div>
Expand All @@ -193,7 +185,7 @@
<span class="input-group-addon">
<i class="glyphicon glyphicon-piggy-bank"></i>
</span>
<input type="number" min="0" step="any" class="form-control" name="sale-price" value="<?php echo remove_junk($product['sale_price']);?>">
<input type="number" min="0" step="any" class="form-control" name="sale-price" value="">
</div>
</div>
</div>
Expand Down
Loading