本文整理汇总了PHP中set_alert函数的典型用法代码示例。如果您正苦于以下问题:PHP set_alert函数的具体用法?PHP set_alert怎么用?PHP set_alert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_alert函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: LoginParticulier
public function LoginParticulier()
{
$this->mLayout = "empty";
$this->mTheme = 'login-page';
$this->mViewFile = 'loginparticulier';
if (validate_form()) {
$username = $this->input->post('username');
$password = $this->input->post('password');
$this->load->model('User_model', 'user_model');
$user = $this->user_model->get_by('email', $username);
// only admin and staff can login
/*if ( verify_role(['admin', 'staff'], $user) )
{*/
// password correct
if (verify_pw($password, $user['password'])) {
// limited fields to store in session
$fields = array('id', 'role', 'email', 'first_name', 'last_name', 'created_at');
$user_data = elements($fields, $user);
login_user($user);
// success
set_alert('success', 'Connexion réussie');
redirect('home');
exit;
}
//}
// failed
set_alert('danger', 'Nom d\'utilisateur ou Mot de passe incorrect');
redirect('/login/Loginparticulier');
}
}
开发者ID:Joohelmer,项目名称:Pdld,代码行数:30,代码来源:login.php
示例2: update_product_table
function update_product_table()
{
$action = $this->action;
if ($action == 'visibility') {
$this->update_product_table_visibility();
$type = 'success';
$msg = 'Changes successfully saved.';
} else {
if ($action == 'delete') {
$this->update_product_table_delete();
$type = 'success';
$msg = 'Item(s) successfully deleted.';
} else {
if ($action == 'new') {
$this->update_product_table_new();
} else {
if ($action == 'status') {
$this->update_product_active();
$type = 'success';
$msg = 'Changes successfully saved.';
}
}
}
}
$page = 'self';
set_alert($type, $msg);
safe_redirect($page);
}
开发者ID:nickyudha,项目名称:huntstreet-v3,代码行数:28,代码来源:update.php
示例3: form_basic
public function form_basic()
{
$form = $this->form_builder->create_form('example/form_basic');
$form->add_text('name', 'Name', TRUE);
$form->add_text('email', 'Email', TRUE);
$form->add_text('subject', 'Subject');
$form->add_textarea('message', 'Message', TRUE);
$form->add_recaptcha();
$form->add_submit();
if (!empty($this->input->post()) && $form->validate()) {
// passed validation
$email = $this->input->post('email');
$password = $this->input->post('password');
if (empty($user_id)) {
// failed
$form->add_custom_error('Failed to create user');
} else {
// success
set_alert('success', 'Thanks for registration. We have sent you a email and please follow the instruction to activate your account.');
redirect('account/login');
}
}
// display form when no POST data, or validation failed
$this->mViewData['form'] = $form;
$this->_render('example/form_basic');
}
开发者ID:wisutsak,项目名称:ci_bootstrap_3,代码行数:26,代码来源:Example.php
示例4: index
/**
* Login page and submission
*/
public function index()
{
// Login form
$this->load->library('form_builder');
$form = $this->form_builder->create_form('admin/login');
$form->add_text('username', '', 'Username', 'admin');
$form->add_password('password', '', 'Password', 'admin');
$form->add_submit('Sign In', 'primary', TRUE);
if (!empty($this->input->post()) && $form->validate()) {
// passed validation
$username = $this->input->post('username');
$password = $this->input->post('password');
$this->load->model('admin_user_model', 'users');
$user = $this->users->login($username, $password);
if (empty($user)) {
// login failed
set_alert('danger', 'Invalid Login');
refresh();
} else {
// login success
$this->session->set_userdata('admin_user', $user);
redirect('admin');
}
}
// display form when no POST data, or validation failed
$this->mViewData['form'] = $form;
$this->mBodyClass = 'login-page';
$this->render('login', 'empty');
}
开发者ID:joelviseu,项目名称:ci_bootstrap_3,代码行数:32,代码来源:Login.php
示例5: index
public function index()
{
$this->mLayout = "empty";
$this->mTheme = 'login-page';
$this->mViewFile = 'login';
if (validate_form()) {
$username = $this->input->post('username');
$password = $this->input->post('password');
$this->load->model('Backend_user_model', 'backend_users');
$user = $this->backend_users->get_by('username', $username);
// only admin and staff can login
if (verify_role(['admin', 'staff-1', 'staff-2', 'staff-3'], $user)) {
// password correct
if (verify_pw($password, $user['password'])) {
// limited fields to store in session
$fields = array('id', 'role', 'username', 'full_name', 'created_at');
$user_data = elements($fields, $user);
login_user($user);
// success
set_alert('success', 'Login success');
redirect('home');
exit;
}
}
// failed
set_alert('danger', 'Invalid Login');
redirect('login');
}
}
开发者ID:januarfonti,项目名称:komoditas,代码行数:29,代码来源:login.php
示例6: change_password
/**
* Submission of Change Password form
*/
public function change_password()
{
$this->load->model('admin_user_model', 'admin_users');
$updated = $this->admin_users->change_password($this->mUser->id, $this->input->post('new_password'));
if ($updated) {
set_alert('success', 'Successfully changed password.');
} else {
set_alert('danger', 'Failed to changed password.');
}
redirect('admin/account');
}
开发者ID:rooyzhang,项目名称:ci_bootstrap_3,代码行数:14,代码来源:Account.php
示例7: change_password
/**
* Submission of Change Password form
*/
public function change_password()
{
$form_url = 'account';
if (validate_form($form_url)) {
// update db
$password = $this->input->post('password');
$update_data = ['password' => hash_pw($password)];
$result = $this->backend_users->update($this->mUser['id'], $update_data);
// success
set_alert('success', 'Mot de passe changé.');
}
// back to form
redirect($form_url);
}
开发者ID:Joohelmer,项目名称:Pdld,代码行数:17,代码来源:account.php
示例8: reset_password
/**
* Reset password for backend users
*/
public function reset_password($user_id)
{
$this->mTitle = "Backend Users";
$this->mViewFile = 'admin/reset_password';
$this->mViewData['target'] = $this->backend_users->get($user_id);
if (validate_form('', 'admin/reset_password')) {
// update db
$password = $this->input->post('password');
$result = $this->backend_users->update($user_id, ['password' => hash_pw($password)]);
// success or failed
if ($result) {
set_alert('success', 'Successfully updated.');
} else {
set_alert('danger', 'Database error.');
}
// refresh page to show alert msg
redirect(current_url());
}
}
开发者ID:msd1310,项目名称:ci_bootstrap,代码行数:22,代码来源:admin.php
示例9: register
public function register()
{
if (post('register')) {
$pengguna = ['username' => post('username'), 'email' => post('email'), 'level' => 0, 'aktif' => 1];
$pelanggan = ['nama_lengkap' => post('nama'), 'alamat' => post('alamat'), 'kota' => post('kota'), 'telp' => post('telp')];
if (post('password') == post('passconf')) {
$pengguna['password'] = md5(post('password'));
}
if ($userId = User::add($pengguna)) {
$pelanggan['id_pengguna'] = $userId;
if (Customer::add($pelanggan)) {
set_alert('success', 'Registrasi berhasil, silahkan login ke akun yang baru saja anda buat');
redirect('login');
} else {
set_alert('error', 'Maaf registrasi gagal');
redirect('register');
}
}
}
return $this->render('form-register', ['heading' => 'Silahkan register']);
}
开发者ID:gaiius,项目名称:tokonlen,代码行数:21,代码来源:function.php
示例10: validate_form
function validate_form($form_url = '', $rule_set = '')
{
$CI =& get_instance();
$CI->load->library('form_validation');
if ($CI->form_validation->run($rule_set) == FALSE) {
if (validation_errors()) {
// save error messages to flashdata
set_alert('danger', validation_errors());
// save all fields to flashdata for repopulating
// note: set_value() will not work upon redirection
$CI->session->set_flashdata('form_fields', $CI->input->post());
// refresh or jump page to show error messagees
$url = empty($form_url) ? current_url() : $form_url;
redirect($url);
exit;
}
// display form
return FALSE;
} else {
// success
return TRUE;
}
}
开发者ID:msd1310,项目名称:ci_bootstrap,代码行数:23,代码来源:MY_form_helper.php
示例11: insert_product
function insert_product()
{
//include("static/thumbnail.php");
/* --- DEFINED VARIABLE --- */
$date = date('Y-m-d H:i:s');
$date_only = date('d-m-y-H-i-s');
$product_category = filter_var($this->product_category, FILTER_SANITIZE_NUMBER_INT);
$product_name = filter_var($this->product_name, FILTER_SANITIZE_STRING);
$product_size_type_id = filter_var($this->size_type, FILTER_SANITIZE_NUMBER_INT);
$product_id = filter_var($this->product_id, FILTER_SANITIZE_NUMBER_INT);
$type_id = $this->type_id;
//array
$color_id = $this->color_id;
//array
$type_name = $this->type_name;
//array
$type_code = $this->type_code;
//array
$type_price = $this->type_price;
//array
$type_description = $this->type_description;
//array
$type_sizefit = $this->type_sizefit;
//array
$type_image = $this->color_image;
//double_array
$type_delete = $this->type_delete;
//array
$order = $this->order;
//double_array
$image_id = $this->image_id;
$image_delete = $this->image_delete;
$stock_quantity = $this->stock_quantity;
//double_array
$stock_name = $this->stock_name;
//double_array
$type_weight = $this->type_weight;
$page_title = filter_var($this->page_title, FILTER_SANITIZE_STRING);
$page_description = filter_var($this->page_description, FILTER_SANITIZE_STRING);
$page_keywords = filter_var($this->page_keywords, FILTER_SANITIZE_STRING);
$product_alias = cleanurl($this->product_name, FILTER_SANITIZE_STRING);
/* --- EDIT PRODUCT --- */
$this->update_product($product_category, $product_name, $product_size_type_id, $product_alias, $page_title, $page_description, $page_keywords, $product_id);
/* --- TYPE PRODUCT --- */
$i = 0;
$max_order = $this->get_max_type_order();
foreach ($type_name as $key => $type_name) {
$i = $key;
$i = $i + $max_order->maximum_order;
$temp_type_order = $this->get_type_data($this->type_id[$key]);
/* --- DELETE PRODUCTS --- */
if ($this->type_delete[$key] == '1') {
if ($this->type_id[$key] != '') {
$type_id_ = $this->type_id[$key];
$this->update_delete_product('1', $type_id_);
$this->delete_stocks($type_id);
}
} else {
$type_code = filter_var($this->type_code[$key], FILTER_SANITIZE_STRING);
$type_name = filter_var($type_name, FILTER_SANITIZE_STRING);
$type_alias = cleanurl($type_name);
$type_price = filter_var($this->type_price[$key], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
$type_description = $this->type_description[$key];
$type_sizefit = $this->type_sizefit[$key];
$type_information = $this->type_information[$key];
$color_id = filter_var($this->color_id[$key], FILTER_SANITIZE_NUMBER_INT);
$type_weight = filter_var($this->type_weight[$key], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
$product_id = filter_var($this->product_id, FILTER_SANITIZE_NUMBER_INT);
$type_id = filter_var($this->type_id[$key], FILTER_SANITIZE_NUMBER_INT);
/* --- ADD --- */
if ($type_id == '') {
$this->insert_type_id($type_code, $type_name, $type_price, $type_description, $type_sizefit, $type_information, $color_id, $type_weight, $product_id, $i, $page_title, $page_description, $type_alias);
} else {
$this->update_type_id($type_code, $type_name, $type_price, $type_description, $type_sizefit, $type_information, $color_id, $type_weight, $temp_type_order->type_order, $type_alias, $page_title, $page_description, $type_id);
}
if ($type_id == '') {
$temp = $this->get_max_type_id();
$type_id = $temp->max_type_id;
} else {
$type_id = $type_id;
}
/* --- END: ADD --- */
/* --- TYPE COLOR IMAGE--- */
$i = $key;
if ($this->color_image["tmp_name"][$i] != null) {
$file_type = substr($this->color_image["name"][$i], -4);
$file_name = substr($this->color_image["name"][$i], 0, -4);
$tmp_name = $this->color_image["tmp_name"][$i];
$name = cleanurl($type_name) . "_" . $date_only . "_" . substr(cleanurl($file_name), 0, 20) . '-' . $k . $file_type;
$error = $this->color_image["error"][$i];
if ($error == 0) {
move_uploaded_file($tmp_name, "../files/uploads/type_color_image/{$name}");
$img_src = "files/uploads/type_color_image/{$name}";
} else {
$type = 'error';
$msg = 'Error: ' . $error;
set_alert($type, $msg);
safe_redirect('self');
}
$this->insert_type_color($img_src, $type_id);
//.........这里部分代码省略.........
开发者ID:nickyudha,项目名称:hillpak-v2,代码行数:101,代码来源:update.php
示例12: users
public function users($do = '', $id = '')
{
$data = ['heading' => 'Administrasi: Pengguna'];
switch ($do) {
case 'form':
if (post('submit')) {
$data = ['username' => post('username'), 'email' => post('email')];
if (User::is('admin')) {
$data['level'] = post('level');
}
if ($password = post('password') and $password == post('passconf')) {
$data['password'] = $password;
}
if (User::save($data, $id)) {
if ($id) {
set_alert('success', 'Berhasil memperbarui data pengguna <b>' . $data['username'] . '</b>');
} else {
set_alert('success', 'Berhasil menambahkan <b>' . $data['username'] . '</b> sebagai pengguna');
}
return redirect('admin/users');
}
set_alert('error', 'Terjadi kesalahan dalam penyimpanan pengguna <b>' . $data['username'] . '</b>');
return redirect($this->uri->path());
}
if ($id) {
$data['data'] = User::show([User::primary() => $id])->fetchOne();
}
return $this->render('user-form', $data);
break;
case 'delete':
if (User::del([User::primary() => $id])) {
set_alert('success', 'Pengguna berhasil terhapus');
} else {
set_alert('error', 'Terjadi kesalahan dalam penghapusan pengguna');
}
return redirect('admin/users');
break;
default:
$data['data'] = User::show();
return $this->render('user-table', $data);
break;
}
}
开发者ID:gaiius,项目名称:tokonlen,代码行数:43,代码来源:function.php
示例13: upload_file
function upload_file($global_url, $type, $file, $prefix, $upload_dir, $ini_max_upload)
{
/* ----------------------------------------------------------------------
* TYPE:
* string: images / files
* ----------------------------------------------------------------------
*/
$files_name = substr($file['name'], 0, -4);
$file_type = $file['type'];
if ($type === 'images') {
if ($file_type === 'image/jpeg') {
$file_type = '.jpg';
} else {
if ($file_type === 'image/png') {
$file_type = '.png';
} else {
if ($file_type === 'image/gif') {
$file_type = '.gif';
}
}
}
} else {
if ($type === 'files') {
if ($file_type === 'application/zip') {
$file_type = '.zip';
} else {
if ($file_type === 'application/x-rar-compressed') {
$file_type = '.rar';
} else {
if ($file_type === 'application/pdf') {
$file_type = '.pdf';
}
}
}
}
}
$uploads_dir = __DIR__ . '/../../../' . $upload_dir;
$userfile_name = cleanurl(str_replace(array('(', ')', ' '), '_', substr($files_name, 0, 20))) . $file_type;
$userfile_tmp = $file['tmp_name'];
$file_error = $file['error'];
$file_type = $file['type'];
$slideshow_size = $file['size'];
$prefix = $prefix . '-' . date('d-m-y-H-i-s') . '-';
$prod_img = $uploads_dir . $prefix . $userfile_name;
$filename = $upload_dir . $prefix . $userfile_name;
if ($type === 'images') {
$allowed_type = array('image/jpeg', 'image/png', 'image/gif');
} else {
if ($type === 'files') {
$allowed_type = array('application/zip', 'application/x-rar-compressed', 'application/pdf');
}
}
/* --- TOTAL SIZE SLIDESHOW --- */
if ($slideshow_size > $ini_max_upload) {
$type = 'danger';
$msg = 'Maximum file size: ' . price(1, $ini_max_upload) . 'Byte(s)';
set_alert($type, $msg);
safe_redirect('self');
/* --- FILE TYPE (IMAGE: JPG, PNG, GIF & FILES: PDF, ZIP) --- */
} else {
if (!in_array($file_type, $allowed_type)) {
$type = 'danger';
$msg = 'Only allowed images format: .jpg, .png, .gif & files format: .pdf, .zip, .rar';
set_alert($type, $msg);
safe_redirect('self');
} else {
if (!move_uploaded_file($userfile_tmp, $prod_img)) {
$type = 'danger';
$msg = 'Error: Permission denied, check folder: ' . $uploads_dir . ' permission';
set_alert($type, $msg);
safe_redirect('self');
} else {
if (move_uploaded_file($userfile_tmp, $prod_img) && $file_error == 0) {
}
}
}
}
return $filename;
}
开发者ID:nickyudha,项目名称:spalosophy,代码行数:79,代码来源:_general.php
示例14: delete
/**
* Menghapus data pada $table
*
* @param string $table Nama Tabel
* @param array $where Kondisi
* @return bool
*/
public function delete($table, $where = [])
{
$wheres = $this->_parseWhere($where);
try {
return $this->query("DELETE FROM `%s` %s", $table, $wheres);
} catch (Exception $e) {
set_alert('error', $e->getMessage());
return false;
}
}
开发者ID:gaiius,项目名称:tokonlen,代码行数:17,代码来源:Db.php
示例15: delete_category
function delete_category($category_id)
{
$sql = "SELECT IFNULL(total_product_main,0)+IFNULL(total_product_child,0) AS total_product\n\t\t\t \n\t\t\t FROM tbl_category AS cat \n\t\t\t LEFT JOIN (SELECT product_category, COUNT(tbl_product.id) AS total_product_main FROM tbl_product\n\t\t\t WHERE product_delete!='1'\n\t\t\t GROUP BY product_category) AS prod\n\t\t\t ON cat.category_id = prod.product_category\n\t\t\t \n\t\t\t LEFT JOIN (SELECT COUNT(x.id) AS total_product_child, category_parent FROM tbl_product AS x LEFT JOIN tbl_category_relation AS y\n\t\t\t ON x.product_category = y.category_child\n\t\t\t \t WHERE product_delete!='1'\n\t\t\t \t GROUP BY category_parent) AS prod2\n\t\t\t \t ON cat.category_id = prod2.category_parent\n\t\t\t \n\t\t\t \t LEFT JOIN (SELECT * from tbl_category_relation WHERE relation_level = '1') AS relation\n\t\t\t \t ON cat.category_id = relation.category_child\n\t\t\t \t WHERE (category_id = '{$category_id}')";
$query = $this->conn->query($sql);
$row = array();
while ($result = $query->fetch_object()) {
array_push($row, $result);
}
$total_product = $row[0]->total_product;
if ($total_product != 0) {
$type = 'danger';
$msg = "Can't delete item(s) because it contains one or more item under it.";
} else {
$sql = "SELECT * from tbl_category WHERE category_id = '{$category_id}'";
$query = $this->conn->query($sql);
$result = $query->fetch_object();
if ($query->num_rows != null) {
$get_order_array = $query->fetch_object();
$category_order = $get_order_array->category_order;
}
$sql = "UPDATE tbl_category SET category_order = '(category_order - 1)' WHERE category_order > ?";
$stmt = $this->conn->prepare($sql);
if ($stmt === false) {
trigger_error('Database error: ' . $sql . ' Error: ' . $this->conn->errno . ' ' . $this->conn->error, E_USER_ERROR);
} else {
$stmt->bind_param("s", $category_order);
$stmt->execute();
}
$stmt->close();
$sql = "DELETE FROM tbl_category WHERE category_id = ?";
$stmt = $this->conn->prepare($sql);
if ($stmt === false) {
trigger_error('Database error: ' . $sql . ' Error: ' . $this->conn->errno . ' ' . $this->conn->error, E_USER_ERROR);
} else {
$stmt->bind_param("s", $category_id);
$stmt->execute();
}
$stmt->close();
$sql = "SELECT * from tbl_category_relation WHERE category_parent = '{$category_id}'";
$query = $this->conn->query($sql);
if ($query->num_rows != null) {
for ($counter = 1; $counter <= $query->num_rows; $counter++) {
$category_relation_array = $query->fetch_object();
$category_child = $category_relation_array->category_child;
$sql = "DELETE FROM tbl_category_relation WHERE category_parent = ? OR category_child = ?";
$stmt = $this->conn->prepare($sql);
if ($stmt === false) {
trigger_error('Database error: ' . $sql . ' Error: ' . $this->conn->errno . ' ' . $this->conn->error, E_USER_ERROR);
} else {
$stmt->bind_param("ss", $category_child, $category_child);
$stmt->execute();
}
$stmt->close();
$sql = "DELETE FROM tbl_category WHERE category_id = ?";
$stmt = $this->conn->prepare($sql);
if ($stmt === false) {
trigger_error('Database error: ' . $sql . ' Error: ' . $this->conn->errno . ' ' . $this->conn->error, E_USER_ERROR);
} else {
$stmt->bind_param("s", $category_child);
$stmt->execute();
}
$stmt->close();
}
}
$sql = "DELETE FROM tbl_category_relation WHERE category_child = ? OR category_parent = ?";
$stmt = $this->conn->prepare($sql);
if ($stmt === false) {
trigger_error('Database error: ' . $sql . ' Error: ' . $this->conn->errno . ' ' . $this->conn->error, E_USER_ERROR);
} else {
$stmt->bind_param("ss", $category_id, $category_id);
$stmt->execute();
}
$stmt->close();
$type = 'success';
$msg = "Successfully deleted category";
}
set_alert($type, $msg);
}
开发者ID:nickyudha,项目名称:spalosophy,代码行数:78,代码来源:update.php
示例16: upload_image
function upload_image($files, $upload_dir, $prefix, $page)
{
/* --- FILE: NAME & TYPE --- */
$files_name = substr($files['name'], 0, -4);
$file_type = substr($files['name'], -4);
$uploads_dir = $upload_dir;
$name = cleanurl(str_replace(array('(', ')', ' '), '_', $files_name)) . $file_type;
$tmp = $files['tmp_name'];
$prefix = $prefix;
$prod_img = $uploads_dir . $prefix . $name;
$error = $files['error'];
if ($error == 0) {
if (move_uploaded_file($tmp, $prod_img)) {
$filename = $prod_img;
} else {
$type = 'danger';
$msg = "Image upload failed";
set_alert($type, $msg);
safe_redirect($page);
}
} else {
$type = 'danger';
$msg = 'Error: ' . upload_code_message($error);
set_alert($type, $msg);
safe_redirect($page);
}
return $filename;
}
开发者ID:nickyudha,项目名称:huntstreet-v3,代码行数:28,代码来源:_general.php
示例17: update_product_table_delete
function update_product_table_delete()
{
$type_id = $this->type_id;
$product_id = $this->product_id;
$counter = 1;
foreach ($type_id as $type_id) {
$ordered = $this->count_ordered($type_id);
if ($ordered->rows > 0) {
$counter++;
/* --- SET INACTIVE --- */
$delete = '0';
$this->update_active_status($delete, $type_id);
} else {
/* --- DELETE --- */
//$this->update_type_delete($delete, $type_id);
$img = $this->get_product_img($type_id);
foreach ($img as $img) {
if (is_file('../' . $img->img_src)) {
unlink('../' . $img->img_src);
}
}
$this->update_type_delete($type_id);
}
}
$type = 'success';
if ($counter > 1) {
$msg = 'Item(s) successfully deleted. However ' . $counter . ' item(s) are set to be inactive because it related with order(s)';
} else {
$msg = 'Item(s) successfully deleted.';
}
foreach ($product_id as $product_id) {
$type_delete = '0';
$result = $this->count_product_type($product_id, $type_delete);
if ($result->rows == 0) {
$result = $this->count_max_id($product_id);
$delete = '1';
$product_id = $result->max_id;
$this->update_delete($product_id);
}
}
$page = 'self';
set_alert($type, $msg);
safe_redirect($page);
}
开发者ID:nickyudha,项目名称:spalosophy,代码行数:44,代码来源:update.php
示例18: checkout
public function checkout()
{
if (!User::current('id')) {
redirect('login');
}
if ($items = session('cart-items')) {
$userId = User::current('id');
$userKey = User::primary();
$custKey = Customer::primary();
$pelanggan = Customer::show([$userKey => $userId])->fetchOne();
$order = [$userKey => $userId, $custKey => $pelanggan->{$custKey}, 'tanggal' => date('Y-m-d'), 'produk' => $items, 'belanja' => post('belanja'), 'kurir' => post('kurir'), 'ongkir' => post('ongkir'), 'bayar' => 0, 'kembali' => 0];
if (!$order['ongkir'] && !$order['kurir']) {
set_alert('error', 'Estimasi ongkos kirim belum ada, pastikan field kurir sudah diisi.');
return redirect('cart');
}
$order['total'] = $order['belanja'] + $order['ongkir'];
if ($return = Order::add($order)) {
session('cart-items', '');
set_alert('success', ['Terima kasih telah berbelanja di ' . conf('app.title') . '.', 'Segeralah melakukan pembayaran agar pesanan anda dapat secepatnya kami proses.']);
} else {
set_alert('error', 'Terjadi kesalahan dalam penghapusan order');
return redirect('cart');
}
}
if (User::loggedin()) {
return redirect('admin-shop/orders/form/' . $return);
}
return redirect('shop');
}
开发者ID:gaiius,项目名称:tokonlen,代码行数:29,代码来源:function.php
示例19: inscription_newsletter
public function inscription_newsletter()
{
$recherche = $this->input->post('newsletter', TRUE);
set_alert('success_newsletter', 'Inscription réussi.');
}
开发者ID:Joohelmer,项目名称:Pdld,代码行数:5,代码来源:home.php
示例20: reset_password
/**
* Account - Reset Password
*/
public function reset_password()
{
// skip when code not found or invalid
$code = $this->input->get_post('code');
if (!$this->users->verify_forgot_password_code($code)) {
set_alert('danger', 'Invalid Code');
redirect('account/login');
}
$this->load->library('form_builder');
$form = $this->form_builder->create_form('account/reset_password');
$form->add_password('password', 'Password');
$form->add_password('retype_password', 'Retype Password');
$form->add_hidden('code', $code);
$form->add_submit();
$post_data = $this->input->post();
if (!empty($post_data) && $form->validate()) {
// passed validation
$email = $this->input->post('email');
$password = $this->input->post('password');
$result = $this->users->reset_password($code, $password);
if ($result) {
set_alert('success', 'Your password has been reset. Please login again.');
redirect('account/login');
} else {
set_alert('danger', 'Reset password failed');
refresh();
}
}
// display form when no POST data, or validation failed
$this->mViewData['form'] = $form;
$this->render('_partials/form');
}
开发者ID:RCVDangTung,项目名称:ci_bootstrap_3,代码行数:35,代码来源:Account.php
注:本文中的set_alert函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论