Exemple #1
0
 public function sendemailtoagent($agent_id = '0')
 {
     $this->form_validation->set_rules('sender_name', 'Name', 'required');
     $this->form_validation->set_rules('sender_email', 'Email', 'required|valid_email');
     $this->form_validation->set_rules('subject', 'Subject', 'required');
     $this->form_validation->set_rules('msg', 'Message', 'required');
     $unique_id = $this->input->post('unique_id');
     $title = $this->input->post('title');
     if ($this->form_validation->run() == FALSE) {
         $this->detail($unique_id, $title);
     } else {
         $data['sender_email'] = $this->input->post('sender_email');
         $data['sender_name'] = $this->input->post('sender_name');
         $data['subject'] = $this->input->post('subject');
         $data['msg'] = $this->input->post('msg');
         add_user_meta($agent_id, 'query_email#' . time(), json_encode($data));
         $this->load->library('email');
         $config['mailtype'] = "html";
         $config['charset'] = "utf-8";
         $this->email->initialize($config);
         $this->email->from($this->input->post('sender_email'), $this->input->post('sender_name'));
         $this->email->to(get_user_email_by_id($agent_id));
         $this->email->subject($this->input->post('subject'));
         $this->email->message($this->input->post('msg'));
         $this->email->send();
         $this->session->set_flashdata('msg', '<div class="alert alert-success">Email sent</div>');
         redirect(site_url('property/' . $unique_id . '/' . $title));
     }
 }
Exemple #2
0
    echo get_user_fullname_by_id($row->created_by);
    ?>
</a>

                </div>

                <div class="phone"><?php 
    echo get_user_meta($row->created_by, 'phone');
    ?>
</div>

                <div class="email"><a href="mailto:<?php 
    echo get_user_email_by_id($row->created_by);
    ?>
"><?php 
    echo get_user_email_by_id($row->created_by);
    ?>
</a>

                    <div class="agent-properties"><a href="<?php 
    echo site_url('show/agentproperties/' . $row->created_by);
    ?>
"><?php 
    echo get_user_properties_count($row->created_by);
    ?>
 Properties</a></div>

                </div>

            </div><!-- /.agent -->
                                            <th><?php 
echo lang_key('address');
?>
</th>
                                            <td><?php 
echo $full_address;
?>
</td>
                                        </tr>
                                        <tr>
                                            <th><?php 
echo lang_key('email');
?>
</th>
                                            <td><?php 
echo get_user_email_by_id($post->created_by);
?>
</td>
                                        </tr>
                                        <tr>
                                            <th><?php 
echo lang_key('phone');
?>
</th>
                                            <td><?php 
echo $post->phone_no;
?>
</td>
                                        </tr>
                                    </table>
                                </div>
Exemple #4
0
function user_form($user_id = 0)
{
    global $mysqli;
    global $user;
    if ($user_id) {
        $form_user = new User(get_user_email_by_id($user_id));
        $form_type = 'update';
        if ($form_user->email != $_SESSION['email'] && !$user->is_allowed('edit_ashp_users')) {
            echo edgimo_error('Your user role (' . $user->role . ') is not allowed to make edits on this page.');
            return;
        }
    } else {
        if (!$user->is_allowed('add_user')) {
            echo edgimo_error('Your user role (' . $user->role . ') is not allowed to add users.');
            return;
        }
        $form_user = new User();
        $form_type = 'insert';
    }
    $html = '';
    $fields = array('first_name' => array('var' => 'first_name', 'label' => 'First Name', 'type' => 'text', 'std' => $form_user->first_name, 'validate' => 'required|valid_name', 'filter' => 'trim|sanitize_string', 'param' => 's', 'desc' => ''), 'last_name' => array('var' => 'last_name', 'label' => 'Last Name', 'type' => 'text', 'std' => $form_user->last_name, 'validate' => 'required|valid_name', 'filter' => 'trim|sanitize_string', 'param' => 's', 'desc' => ''), 'email' => array('var' => 'email', 'label' => 'Email', 'type' => 'text', 'std' => $form_user->email, 'validate' => 'required|valid_email', 'filter' => 'trim|sanitize_string', 'param' => 's', 'desc' => ''), 'password' => array('var' => 'password', 'label' => 'Password', 'type' => 'password', 'std' => '', 'validate' => 'required', 'filter' => '', 'param' => 's', 'desc' => ''));
    if ($user->is_allowed('change_roles')) {
        $fields['role'] = array('var' => 'role', 'label' => 'Role', 'type' => 'select', 'options' => unserialize(ROLES), 'std' => $form_user->role, 'validate' => 'required', 'filter' => 'trim|sanitize_string', 'param' => 's', 'desc' => '');
    }
    //special instructions for updating password
    if ($form_type == 'update') {
        $fields['password']['desc'] = 'Only enter a new password here if you wish to update the existing password';
    }
    if (isset($_POST['submit'])) {
        $gump = new GUMP();
        //password can be left blank when updating account. If it is, just plug in the saved value
        if ($form_type == 'update') {
            if ($_POST['form']['password'] === '') {
                $_POST['form']['password'] = $form_user->password;
            }
        }
        //add values to the validate and filter gump arrays
        foreach ($_POST['form'] as $k => $v) {
            //update the std value for form output below
            $fields[$k]['std'] = $v;
            if (!empty($fields[$k]['validate'])) {
                $validate[$k] = $fields[$k]['validate'];
            }
            if (!empty($fields[$k]['filter'])) {
                $filter[$k] = $fields[$k]['filter'];
            }
        }
        //run gump
        $gump->validation_rules($validate);
        $gump->filter_rules($filter);
        //get validated data
        $validated_data = $gump->run($_POST['form']);
        if (empty($validated_data['role'])) {
            $validated_data['role'] = $form_user->role;
        }
        if ($validated_data === false) {
            $errors = $gump->get_readable_errors(false);
            $error_text = '';
            foreach ($errors as $error) {
                $error_text .= $error . '<br />';
            }
            echo edgimo_error($error_text);
        } else {
            if (mysqli_connect_errno()) {
                printf("Connect failed: %s\n", mysqli_connect_error());
                exit;
            }
            if ($form_type == 'update') {
                $query = $mysqli->prepare("UPDATE ashp_users SET first_name=?, last_name=?, email=?, role=?, password=? WHERE user_id=?");
                $password = sha1($validated_data['password']);
                $query->bind_param('sssssi', $validated_data['first_name'], $validated_data['last_name'], $validated_data['email'], $validated_data['role'], $password, $form_user->user_id);
                echo edgimo_success('Account details have been updated.');
            }
            if ($form_type == 'insert') {
                $query = $mysqli->prepare("INSERT INTO ashp_users (email, first_name, last_name, password, role, status) VALUES (?,?,?,?,?,?)");
                $password = sha1($validated_data['password']);
                $status = 'active';
                $query->bind_param('ssssss', $validated_data['email'], $validated_data['first_name'], $validated_data['last_name'], $password, $validated_data['role'], $status);
                echo edgimo_success('New user created.');
            }
            $query->execute();
            $query->close();
            $new_user = new User($validated_data['email']);
            $user_vars = get_object_vars($new_user);
            echo '<script>table_insert(' . json_encode($user_vars) . ');</script>';
        }
    }
    $html .= '<form class="form-horizontal" role="form" method="post">';
    foreach ($fields as $field) {
        isset($errors) && array_key_exists($field['var'], $errors) ? $error = 'has-error' : ($error = '');
        $html .= '<div class="form-group ' . $error . '">';
        switch ($field['type']) {
            case 'password':
                $type = 'password';
                $field['std'] = '';
            case 'text':
                if (!isset($type)) {
                    $type = 'text';
                }
                $html .= '
				<label class="col-lg-2 control-label" for="form[' . $field['var'] . ']">' . $field['label'] . '</label>
				<div class="col-lg-6">
					<input class="form-control" type="' . $type . '" name="form[' . $field['var'] . ']" value="' . $field['std'] . '">
				</div>';
                break;
            case 'select':
                $html .= '
				<label class="col-lg-2 control-label" for="form[' . $field['var'] . ']">' . $field['label'] . '</label>
				<div class="col-lg-6">
					<select class="form-control" name="form[' . $field['var'] . ']">';
                foreach ($field['options'] as $option) {
                    $field['std'] == $option ? $selected = 'selected' : ($selected = '');
                    $html .= '<option ' . $selected . ' value="' . $option . '">' . $option . '</option>';
                }
                $html .= '</select>
				</div>';
                break;
        }
        $html .= '
			<div class="col-lg-4">
				<p class="description">' . $field['desc'] . '</p>
			</div>
		</div>';
    }
    $html .= '
	<div class="form-group">
		<div class="col-lg-6 col-lg-offset-2">
			<button type="submit" class="btn btn-primary" name="submit">Submit</button>
		</div>
	</div>
	</form>
	';
    return $html;
}
 public function sendemailtoagent($agent_id = '0')
 {
     $this->form_validation->set_rules('sender_name', 'Name', 'required');
     $this->form_validation->set_rules('sender_email', 'Email', 'required|valid_email');
     $this->form_validation->set_rules('subject', 'Subject', 'required');
     $this->form_validation->set_rules('msg', 'Message', 'required');
     $this->form_validation->set_rules('ans', 'Code', 'required|callback_check_code');
     $this->form_validation->set_rules('terms_conditon', 'Terms and condition', 'xss_clean|callback_terms_check');
     $unique_id = $this->input->post('unique_id');
     $title = $this->input->post('title');
     if ($this->form_validation->run() == FALSE) {
         $this->load_contact_agent_view($unique_id);
     } else {
         $detail_link = $this->input->post('url');
         $data['sender_email'] = $this->input->post('sender_email');
         $data['sender_name'] = $this->input->post('sender_name');
         $data['subject'] = $this->input->post('subject');
         $data['msg'] = $this->input->post('msg');
         $data['msg'] .= "<br /><br /> This email was sent from the following page:<br /><a href=\"" . $detail_link . "\" target=\"_blank\">" . site_url('ads/' . $unique_id . '/' . $title) . "</a>";
         add_user_meta($agent_id, 'query_email#' . time(), json_encode($data));
         $this->load->library('email');
         $config['mailtype'] = "html";
         $config['charset'] = "utf-8";
         $config['newline'] = '\\r\\n';
         $this->email->initialize($config);
         $this->email->from($this->input->post('sender_email'), $this->input->post('sender_name'));
         $this->email->to(get_user_email_by_id($agent_id));
         $msg = $this->input->post('msg');
         $msg .= "<br/><br/>Email sent from : " . '<a href="' . $detail_link . '">' . $detail_link . '</a>';
         $this->email->subject($this->input->post('subject'));
         $this->email->message($msg);
         $this->email->send();
         $this->session->set_flashdata('msg', '<div class="alert alert-success">' . lang_key('email_sent') . '</div>');
         $this->load_contact_agent_view($unique_id);
     }
 }
Exemple #6
0
<?php

include 'includes/functions.php';
include 'includes/session.php';
confirm_logged_in();
include 'includes/connection.php';
?>

<?php 
if (isset($_GET['id'])) {
    if (isset($_GET['user_id'])) {
        $user_id = $_GET['user_id'];
    } else {
        $user_id = $_SESSION['id'];
    }
    $course_id = $_GET['id'];
    $query = "INSERT INTO taken_course (user_id, course_id)\n\tVALUES ('{$user_id}', '{$course_id}');";
    $rs = mysql_query($query);
    if ($rs) {
        $rs = get_user_email_by_id($user_id);
        $row = mysql_fetch_array($rs);
        redirect_to("profile.php?email=" . urlencode($row['Email']));
    }
} else {
    redirect_to("index.php");
}
include 'includes/closeconnection.php';
                    </table>
                </form>
            <?php 
    } else {
        if (isset($_POST['save'])) {
            $id = $_POST['user_id'];
            $firstname = $_POST['firstname'];
            $lastname = $_POST['lastname'];
            $department = $_POST['department'];
            $email = $_POST['email'];
            save_user($id, $firstname, $lastname, $email, $department);
        }
    }
}
foreach ($users as $user) {
    $email = get_user_email_by_id($user['ID']);
    $department = get_department_name(get_user_department($user['ID']));
    ?>
                <form action="<?php 
    echo $_SERVER['PHP_SELF'];
    ?>
" method="post" class="users">
                    <table>
                        <tbdoy>
                            <tr>
                                <td><?php 
    echo $user['ID'];
    ?>
</td>
                                <td><?php 
    echo $user['Firstname'];
Exemple #8
0
 public function renewpackage()
 {
     $this->form_validation->set_rules('package_id', 'Package id', 'required');
     if ($this->form_validation->run() == FALSE) {
         $this->renew();
     } else {
         $this->load->helper('date');
         $user_id = $this->session->userdata('user_id');
         $package_id = $this->input->post('package_id');
         $this->session->set_userdata('package_id', $package_id);
         $datestring = "%Y-%m-%d";
         $time = time();
         $request_date = mdate($datestring, $time);
         $this->load->model('admin/package_model');
         $package = $this->package_model->get_package_by_id($this->session->userdata('package_id'));
         $payment_data = array();
         $payment_data['unique_id'] = uniqid();
         $payment_data['user_id'] = $user_id;
         $payment_data['package_id'] = $package->id;
         $payment_data['amount'] = $package->price;
         $payment_data['request_date'] = $request_date;
         $payment_data['is_active'] = 2;
         #pending
         $payment_data['status'] = 1;
         #active
         $payment_data['payment_medium'] = 'paypal';
         $this->load->model('user/user_model');
         $unique_id = $this->user_model->insert_payment_data($payment_data);
         $this->session->set_userdata('unique_id', $unique_id);
         $this->session->set_userdata('amount', $package->price);
         $userdata = array();
         $userdata['user_name'] = $this->session->userdata('user_name');
         $userdata['user_email'] = get_user_email_by_id($this->session->userdata('user_id'));
         $this->send_signup_notification_email($userdata, $unique_id);
         redirect(site_url('account/confirmation'));
     }
 }