From be8e64ca785c9281d09b42aeaa917e8a1673af42 Mon Sep 17 00:00:00 2001 From: cflem Date: Sun, 1 Jan 2017 19:46:20 -0700 Subject: Moved ad displaying to dash_functions.php; finished settings.php --- dash/css/dash.css | 22 ++++++++++++--- dash/dash_employee.php | 27 ++----------------- dash/dash_employer.php | 8 +++--- dash/dash_functions.php | 24 +++++++++++++++++ dash/footer.php | 1 + dash/headless.php | 24 +---------------- dash/settings.php | 71 ++++++++++++++++++++++++++++--------------------- 7 files changed, 91 insertions(+), 86 deletions(-) (limited to 'dash') diff --git a/dash/css/dash.css b/dash/css/dash.css index f6f390d..8792c52 100644 --- a/dash/css/dash.css +++ b/dash/css/dash.css @@ -209,11 +209,11 @@ body { #fjfright { text-align: center; } -#fulljob a { +#fulljob a, .errbox a { text-decoration: none; color: #fb4d00; } -#fulljob a:hover { +#fulljob a:hover, .errbox a:hover { color: #fb7700; } #fulljob #ebio { @@ -222,7 +222,7 @@ body { } #fulljob.fjsettings { margin: 2em auto 0 auto; - height: 500px; + height: 455px; border-radius: 5px; } .fjsettings #fjbody { @@ -234,7 +234,7 @@ body { .fjsettings #fjbody p { margin: 0; } -.fjsettings form { +.fjsettings .pseudoform { margin-bottom: 1em; } .fjsettings input, .fjsettings select { @@ -271,3 +271,17 @@ body { .fjsettings input[type=submit]:hover { background-color: #fb7700; } +.errbox { + width: 512px; + margin: 2em auto; + background-color: #ffffff; + padding: 1em; + box-shadow: 0px 0px 5px rgba(0,0,0,0.75); + border-radius: 5px; + text-align: center; + word-break: break-all; +} +#setchgbtn { + margin: 0; + text-align: center; +} diff --git a/dash/dash_employee.php b/dash/dash_employee.php index 0c7e47c..d4a3df1 100644 --- a/dash/dash_employee.php +++ b/dash/dash_employee.php @@ -3,32 +3,9 @@ if (!defined('HEIRARCHY')) die; $title = 'Dashboard / Bulletin'; require('header.php'); $page = 1; -if (!empty($_GET['p'])) $page = max(1, intval($_GET['p'])); +// if (!empty($_GET['p'])) $page = max(1, intval($_GET['p'])); $result = $db->query('SELECT ads.*, categories.cat_name, SUM(ratings.stars) / COUNT(ratings.stars) AS rating FROM ads LEFT JOIN categories ON ads.cat = categories.id LEFT JOIN ratings ON ads.uid = ratings.rated GROUP BY ads.id LIMIT ' . $b_config['ads_per_page']*($page-1) . ', '.$b_config['ads_per_page']) or fatal($db->error); -while ($row = $result->fetch_assoc()) { -?> -
- -

-Uncategorized

'.PHP_EOL; - else - echo '

'.htmlentities($row['cat_name']).'

'.PHP_EOL; -?> -

-Employer Not Rated

'.PHP_EOL; - else - echo '

'.intval($row['rating']).' Star Employer

'.PHP_EOL; -?> -

Pays $

-

[...]

-

-
-fetch_assoc()) draw_ad($row); $result->free(); require('footer.php'); ?> diff --git a/dash/dash_employer.php b/dash/dash_employer.php index 28c5ed1..78debfd 100644 --- a/dash/dash_employer.php +++ b/dash/dash_employer.php @@ -2,8 +2,10 @@ if (!defined('HEIRARCHY')) die; $title = 'Dashboard / Bulletin'; require('header.php'); -?> -

-query('SELECT ads.*, categories.cat_name, SUM(ratings.stars) / COUNT(ratings.stars) AS rating FROM ads LEFT JOIN categories ON ads.cat = categories.id LEFT JOIN ratings ON ads.uid = ratings.rated GROUP BY ads.id LIMIT ' . $b_config['ads_per_page']*($page-1) . ', '.$b_config['ads_per_page']) or fatal($db->error); +while ($row = $result->fetch_assoc()) draw_ad($row); +$result->free(); require('footer.php'); ?> diff --git a/dash/dash_functions.php b/dash/dash_functions.php index 49664a3..b9fd9db 100644 --- a/dash/dash_functions.php +++ b/dash/dash_functions.php @@ -6,4 +6,28 @@ function dash_fatal ($msg = null, $link = null, $label = null) { require('footer.php'); die; } +function draw_ad ($row) { +?> +
+ +

+Uncategorized

'.PHP_EOL; + else + echo '

'.htmlentities($row['cat_name']).'

'.PHP_EOL; +?> +

+Employer Not Rated

'.PHP_EOL; + else + echo '

'.intval($row['rating']).' Star Employer

'.PHP_EOL; +?> +

Pays $

+

[...]

+

+
+ diff --git a/dash/footer.php b/dash/footer.php index 963d525..11e6462 100644 --- a/dash/footer.php +++ b/dash/footer.php @@ -1,5 +1,6 @@ close(); ?> diff --git a/dash/headless.php b/dash/headless.php index bc321f2..ca090aa 100644 --- a/dash/headless.php +++ b/dash/headless.php @@ -6,29 +6,7 @@ $db = new bdb(); $result = $db->query('SELECT ads.*, categories.cat_name, SUM(ratings.stars) / COUNT(ratings.stars) AS rating FROM ads LEFT JOIN categories ON ads.cat = categories.id LEFT JOIN ratings ON ads.uid = ratings.rated GROUP BY ads.id LIMIT '.($clicks+$b_config['ads_per_page']).', 1') or die(); if ($result->num_rows) { $row = $result->fetch_assoc(); -?> -
- -

-Uncategorized

'.PHP_EOL; - else - echo '

'.htmlentities($row['cat_name']).'

'.PHP_EOL; -?> -

-Employer Not Rated

'.PHP_EOL; - else - echo '

'.intval($row['rating']).' Star Employer

'.PHP_EOL; -?> -

Pays $

-

[...]

-

- -
-free(); $db->close(); diff --git a/dash/settings.php b/dash/settings.php index 5dc2e3d..9a7179a 100644 --- a/dash/settings.php +++ b/dash/settings.php @@ -2,16 +2,25 @@ define('HEIRARCHY', 1); require('dash_common.php'); +global $b_config, $b_user; $title = 'Account Settings / Bulletin'; require('header.php'); -if (!empty($_POST['changepass'])) { +if (!empty($_POST['oldpass'])) { if ($b_user['password'] != hash('sha512', $_POST['oldpass'])) dash_fatal('The password you entered does not match your current password.'); - if ($_POST['newpass1'] != $_POST['newpass2']) dash_fatal('Your new passwords do not match.'); - $db->query('UPDATE users SET password = \''.hash('sha512', $_POST['newpass1']).'\' WHERE id = '.$b_user['id']) or dash_fatal($db->error); - if ($db->affected_rows < 1) dash_fatal('No user with your ID is in the database'); - dash_fatal('Password changed successfully.'); -} else if (!empty($_POST['changetype'])) { - if ($b_user['password'] != hash('sha512', $_POST['curpass'])) dash_fatal('The password you entered does not match your current password.'); + if (!empty($_POST['newpass1'])) { + if ($_POST['newpass1'] != $_POST['newpass2']) dash_fatal('Your new passwords do not match.'); + $db->query('UPDATE users SET password = \''.hash('sha512', $_POST['newpass1']).'\' WHERE id = '.$b_user['id']) or dash_fatal($db->error); + if ($db->affected_rows < 1) dash_fatal('Your password could not be changed.'); + } + + $type = $b_user['type']; + if ($_POST['newtype'] == 0) $type = 'EMPLOYEE'; + else if ($_POST['newtype'] == 1) $type = 'EMPLOYER'; + if ($type != $b_user['type']) { + $db->query('UPDATE users SET type = \''.$type.'\' WHERE id = '.$b_user['id']) or dash_fatal($db->error); + if ($db->affected_rows < 1) dash_fatal('Your account type could not be changed.'); + } + dash_fatal('Account settings successfully updated.'); } ?>
@@ -19,31 +28,31 @@ if (!empty($_POST['changepass'])) {

Account Settings

Adjusting for

-
-

Current Password

-

Your current password is needed to change your account settings.

-

-
-
-
-

Change Password

-

-

-

-
-
-

Change Account Type

-

- -

-

-
-
+
+
+

Current Password

+

Your current password is needed to change your account settings.

+

+
+
+
+

Change Password

+

+

+
+
+

Change Account Type

+

+ +

+
+

+
+
free(); require('footer.php'); ?> -- cgit v1.2.3