$action = 'updated'; $q = "UPDATE posts SET user = {$_POST['user']}, slug = '{$_POST['slug']}', title = '{$title}', label = '{$label}', header = '{$header}', body = '{$body}' WHERE id = {$_GET['id']}"; } else { $action = 'added'; $q = "INSERT INTO posts (type, user, slug, title, label, header, body) VALUES (1, {$_POST['user']}, '{$_POST['slug']}', '{$title}', '{$label}', '{$header}', '{$body}')"; } $r = mysqli_query($dbc, $q); if ($r) { $message = '<p class="alert alert-success">Page was ' . $action . '!</p>'; } else { $message = '<p class="alert alert-danger">Page could not be ' . $action . ' because: ' . mysqli_error($dbc); $message .= '<p class="alert alert-warning">Query: ' . $q . '</p>'; } } if (isset($_GET['id'])) { $opened = data_post($dbc, $_GET['id']); } break; case 'users': if (isset($_POST['submitted']) == 1) { if ($_POST['password'] != '') { if ($_POST['password'] == $_POST['passwordv']) { $password = sha1($_POST['password']); $verify = true; } else { $verify = false; } } else { $verify = false; } $data = new User($_POST['first'], $_POST['last'], $_POST['email'], $_POST['status']);
public function change_password() { $user_id = $this->session->userdata('id') != $this->uri->segment(3) ? $this->session->userdata('id') : $this->session->userdata('id'); $this->user_model->set_validation('password'); if ($this->user_model->validate(data_post(['old_password', 'password'])) === FALSE) { $this->session->set_flashdata('m', validation_errors()); } else { $new_pass = $this->user_model->encrypt_pass($this->input->post('password')); if ($this->user_model->update($user_id, ['password' => $new_pass], TRUE)) { $this->session->set_flashdata('m', '<p>Saved</p>'); redirect('auths/user/' . $user_id); } else { $this->session->set_flashdata('m', 'Problem saving password'); } } }
$side_w5 = widget_value($dbc, 'side-w5'); $side_w6 = widget_value($dbc, 'side-w6'); $contact_w1 = widget_value($dbc, 'contact-w1'); $contact_w2 = widget_value($dbc, 'contact-w2'); # If a path is not declared then set it to home page $path = get_path(); if (!isset($path['call_parts'][0]) || $path['call_parts'][0] == '') { $path['call_parts'][0] = $home_page; } $pre_url = './'; //if(isset($path['call_parts'][1])) { $pre_url = './../'; } # Constants: DEFINE('D_TEMPLATE', $pre_url . 'themes/' . $site_theme . ''); # Page Setup $page = @data_page($dbc, $path['call_parts'][0]); $post = @data_post($dbc, $path['call_parts'][0]); if (isset($page['id']) != '') { $view = data_page_type($dbc, $page['type']); } # Hit Counter $visitors = "Visitor"; if (empty($_COOKIE['visits'])) { $counterFile = "config/hitcount.txt"; if (file_exists($counterFile)) { $hits = file_get_contents($counterFile); ++$hits; } else { $hits = 1; } if (file_put_contents($counterFile, $hits)) { setcookie("visits", $visitors, time() + 3600);
<?php // Setup File: error_reporting(0); # Database Connection: include 'config/connection.php'; # Constants: DEFINE('D_TEMPLATE', 'template'); DEFINE('D_VIEW', 'views'); # Functions: include 'functions/sandbox.php'; include 'functions/data.php'; include 'functions/template.php'; # Site Setup: $debug = data_setting_value($dbc, 'debug-status'); $path = get_path(); $site_title = 'AtomCMS 2.0'; if (!isset($path['call_parts'][0]) || $path['call_parts'][0] == '') { //$path['call_parts'][0] = 'home'; // Set $path[call_parts][0] to equal the value given in the URL header('Location: home'); } # Page Setup: $page = data_post($dbc, $path['call_parts'][0]); $view = data_post_type($dbc, $page['type']);