Skip to content

Commit

Permalink
removed unused files
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexxmao committed Aug 30, 2023
1 parent cc884c4 commit 7cd7e3b
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 102 deletions.
6 changes: 6 additions & 0 deletions api/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
RewriteEngine On

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
37 changes: 19 additions & 18 deletions api/connect.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
<?php
define('DB_DSN','mysql:host=localhost;dbname=serverside;charset=utf8');
define('DB_USER','serveruser');
define('DB_PASS','gorgonzola7!');

// PDO is PHP Data Objects
// mysqli <-- BAD.
// PDO <-- GOOD.
try {
// Try creating new PDO connection to MySQL.
$db = new PDO(DB_DSN, DB_USER, DB_PASS);
//,array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
} catch (PDOException $e) {
print "Error: " . $e->getMessage();
die(); // Force execution to stop on errors.
// When deploying to production you should handle this
// situation more gracefully. ¯\_(ツ)_/¯
}
?>
define('DB_DSN', 'mysql:host=localhost;dbname=serverside;charset=utf8');
define('DB_USER', 'serveruser');
define('DB_PASS', 'gorgonzola7!');

// PDO is PHP Data Objects
// mysqli <-- BAD.
// PDO <-- GOOD.
try {
// Try creating new PDO connection to MySQL.
$db = new PDO(DB_DSN, DB_USER, DB_PASS);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
//,array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
} catch (PDOException $e) {
print "Error: " . $e->getMessage();
die(); // Force execution to stop on errors.
// When deploying to production you should handle this
// situation more gracefully. ¯\_(ツ)_/¯
}
?>
2 changes: 1 addition & 1 deletion api/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function sanitizeInput($input)
$image = $_FILES['image']['name'];
$image_temp = $_FILES['image']['tmp_name'];
$imageType = $_FILES['image']['type'];
$destination = $_SERVER['DOCUMENT_ROOT'] . '/images' . "/" . $image;
$destination = $_SERVER['DOCUMENT_ROOT'] . '/uploads' . "/" . $image;
$query = "INSERT INTO pokemon(id, name, type, rarity, price, stock, image, created_at, updated_at) VALUES(null, :name, :type, :rarity, :price, :stock, :image, :created_at, :updated_at)";
$stmt = $db->prepare($query);
$created_at = date('Y-m-d');
Expand Down
35 changes: 0 additions & 35 deletions src/components/CreateUser.js

This file was deleted.

Empty file removed src/components/DeleteListing.js
Empty file.
4 changes: 2 additions & 2 deletions src/components/DisplayListing.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default function DisplayListing({admin}) {
editClose();
axios.put(`http://localhost:31337/api/listing/${id}/edit`, inputs).then((response) => {
console.log(response.data);
window.location.reload(true);
// window.location.reload(true);
});
}

Expand Down Expand Up @@ -112,7 +112,7 @@ export default function DisplayListing({admin}) {
<SimpleGrid columns={4} spacing={8}>
{listings.map((listing, key) =>
<Box key={key} color='black' borderWidth='4px' borderRadius='lg' w={350}>
<Image src={`http://localhost:31337/images/${listing.image}`}/>
<Image src={`http://localhost:31337/uploads/${listing.image}`}/>
<Box m={4}>
<Heading mb={4}>{listing.name}</Heading>
{/* TODO: ADD COLOURED TAG FOR TYPE */}
Expand Down
46 changes: 0 additions & 46 deletions src/components/EditListing.js

This file was deleted.

0 comments on commit 7cd7e3b

Please sign in to comment.