diff --git a/public/account/login.php b/public/account/login.php index 548129b..a44be3d 100644 --- a/public/account/login.php +++ b/public/account/login.php @@ -4,8 +4,8 @@ $pageTitle = 'iBuy - Login'; $pageContent = '

Don\'t have an account?Click here to register

Login

- - + +
'; $stylesheet = '../assets/ibuy.css'; diff --git a/public/account/register.php b/public/account/register.php index 64dc1df..918977d 100644 --- a/public/account/register.php +++ b/public/account/register.php @@ -22,10 +22,10 @@ $pageTitle = 'iBuy - Register'; $pageContent = '

Already have an account?Click here to Login

Register

- - - - + + + +
'; diff --git a/public/admin/addCategory.php b/public/admin/addCategory.php index fc28488..895c505 100644 --- a/public/admin/addCategory.php +++ b/public/admin/addCategory.php @@ -6,7 +6,7 @@ require_once '../../functions.php'; adminCheck(); $pageContent = '

Add Category

- +
'; require '../../layout.php'; diff --git a/public/admin/editCategory.php b/public/admin/editCategory.php index e69de29..af33a9e 100644 --- a/public/admin/editCategory.php +++ b/public/admin/editCategory.php @@ -0,0 +1,32 @@ + Edit Category +
+ + +
'; +require '../../layout.php'; + +if (isset($_GET['category_id'])) { + $_SESSION['cat_id'] = $_GET['category_id']; +} +else if (isset($_POST['submit'])) { + $server = 'mysql'; + $username = 'student'; + $password = 'student'; + $schema = 'assignment1'; + $pdo = new PDO('mysql:dbname=' . $schema . ';host=' . $server, $username, $password); + $stmt = $pdo->prepare('UPDATE category SET name= :cat_name WHERE category_id= :category_id'); + $values = [ + 'cat_name' => $_POST['name'], + 'category_id' => $_SESSION['cat_id'] + ]; + $stmt->execute($values); + unset($_SESSION['cat_id']); + echo ''; +} +?> \ No newline at end of file