<?php db_include('create_or_update_blog_post'); lib_include('email_lib'); if (!is_admin()) { header('HTTP/1.0 403 Forbidden'); $display_message = 'Access forbidden!'; $redirect = '/index.php'; } else { $params = ['title' => $_POST['title'], 'body' => $_POST['body'], 'author' => SessionLib::get('user_member.member')]; $posted = create_or_update_blog_post($params); if ($posted) { $display_message = 'Wrote post! <br />'; $redirect = "/blog/blog.php?id={$posted}"; if (isset($_POST['sendemail']) && $_POST['sendemail']) { $sent_mail = send_html_email('*****@*****.**', $_POST['title'], $_POST['body']); $display_message .= $sent_email ? 'Sent email!' : 'Failed to send email!'; } } else { $display_message = 'Failed to write post!'; $redirect = '/blog/writeblog.php'; $_POST['blog_fail_return'] = true; } } ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Under the Couch - Posting Blog Post...</title>
function save_user($firstname, $lastname, $email, $password) { $ci =& get_instance(); $ci->load->model('user_m'); //echo $ci->input->post('ajax'); $firstname = $ci->input->post('fname') != '' ? $ci->input->post('fname') : $firstname; $lastname = $ci->input->post('lname') != '' ? $ci->input->post('lname') : $lastname; $email = $ci->input->post('email') != '' ? $ci->input->post('email') : $email; $password = $ci->input->post('password') != '' ? $ci->input->post('password') : $password; $usertype = $ci->input->post('usertype') != '' ? $ci->input->post('usertype') : '4'; $ci->form_validation->set_rules($ci->user_m->add_user_validation); $str = ''; if ($ci->form_validation->run() == FALSE) { //if there were errors add them to the errors array echo error_template(validation_errors()); } else { $user_data = array('fname' => $firstname, 'lname' => $lastname, 'email' => $email, 'usertype' => $usertype, 'password' => md5($password), 'dateadded' => mysqldate(), 'slug' => now() . random_string('numeric', 8)); //more validation special cases if ($ci->input->post('cpassword') != '') { //chek o see id the two match if ($ci->input->post('password') != $ci->input->post('cpassword')) { echo error_template('Passwords do not match'); } } else { $user_id = $ci->user_m->create($user_data); if ($user_id) { //add him to the roles tables //if online if (check_live_server()) { //send email to user $salutation = $content = '<p>Hello<strong> ' . ucwords($firstname . ' ' . $lastname) . '</strong>,</p>'; $content = '<p>Hello<strong> ' . ucwords($firstname . ' ' . $lastname) . '</strong>,</p> <p>You have created a new account on <a href="' . base_url() . '>' . base_url() . '</a>.</p> <p>Below are your login credentials:</p> <p><strong>Username</strong>: ' . $email . '</p> <p><strong>Password</strong>: ' . $password . '</p> <p>Click <a href="' . base_url() . 'admin/login">here</a> to login</p> '; send_html_email($ci->input->post('email'), 'New account', $salutation, $content, SITE_EMAIL); } //if there were errors add them to the errors array $str .= jquery_clear_fields(); echo $str; return $user_id; } else { //if there were errors add them to the errors array echo warning_template('User was not added. Please try one more time'); } } } }
\t<body> \t\tContact name: {$_POST['contactname']} \t\t<br /> \t\tEmail address: {$_POST['email']} \t\t<br /> \t\tContact number: {$phone} \t\t<br /> \t\tDate requested: {$_POST['date']} \t\t<br /> \t\tAdditional comments: {$comments} \t</body> </html> HTML; $to = EMAIL_BOOKING; $subject = '[UTC Recording] Recording Request'; $mailed = send_html_email($to, $subject, $email); if ($mailed) { $message1 = 'Recording request sent!'; $message2 = "We'll get back to you in a few days."; $redirect = "/index.php"; } else { $message1 = 'Recording request not sent!'; $message2 = 'Redirecting to form page...'; $redirect = '/booking/record.php'; } ?> <!doctype html> <html> <head> <meta charset="utf-8" />