本文整理汇总了PHP中setMessage函数的典型用法代码示例。如果您正苦于以下问题:PHP setMessage函数的具体用法?PHP setMessage怎么用?PHP setMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setMessage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action
public function action()
{
if ($this->input->post('register')) {
$fname = $this->input->post('fname');
$lname = $this->input->post('lname');
$email = $this->input->post('email');
$phone = $this->input->post('phone');
$username = $this->input->post('username');
if ($fname and $lname and $email and $phone and $username) {
$data = ['fname' => $fname, 'lname' => $lname, 'email' => $email, 'phone' => $phone, 'username' => $username];
$ret = $this->users_model->insert($data);
if ($ret['status'] == 'OK') {
setMessage('Successfully Registered.', 'success');
//Email sending
//We have password in $ret['password']
echo $ret['password'];
//sredirect('Register/validation');
} else {
$message = "Error({$ret['error']['code']}): " . $ret['error']['message'];
setMessage($message, 'error');
redirect('Register');
}
} else {
setMessage('Please enter all fields', 'error');
$this->index();
}
}
}
示例2: logoff
public function logoff()
{
$this->session->unset_userdata(array('id' => '', 'nome' => '', 'email' => '', 'admin' => '', 'logged' => false));
$this->session->sess_destroy();
setMessage('logoff', 'Você saiu do sistema!', "Você realizou o logoff com sucesso. \n Esperamos você em breve!");
redirect('users/login/?msg=logoff');
}
示例3: modify
function modify()
{
$db =& $this->db;
// Check the token
if (!Kit::CheckToken()) {
trigger_error('Token does not match', E_USER_ERROR);
}
$refer = Kit::GetParam('refer', _POST, _STRING);
$usertype = Kit::GetParam('usertype', _SESSION, _INT);
$ids = Kit::GetParam('id', _POST, _ARRAY);
$values = Kit::GetParam('value', _POST, _ARRAY);
$size = count($ids);
if ($usertype != 1) {
setMessage(__("Only admin users are allowed to modify settings"));
return $refer;
}
// Get the SettingId for LIBRARY_LOCATION
$SQL = sprintf("SELECT settingid FROM setting WHERE setting = '%s'", 'LIBRARY_LOCATION');
if (!($result = $db->query($SQL))) {
trigger_error($db->error());
trigger_error(__('Cannot find the Library Location Setting - this is serious.'), E_USER_ERROR);
}
if ($db->num_rows($result) == 0) {
trigger_error(__('Cannot find the Library Location Setting - this is serious.'), E_USER_ERROR);
}
$row = $db->get_row($result);
$librarySettingId = $row[0];
// Loop through and modify the settings
for ($i = 0; $i < $size; $i++) {
$value = Kit::ValidateParam($values[$i], _STRING);
$id = $ids[$i];
// Is this the library location setting
if ($id == $librarySettingId) {
// Check for a trailing slash and add it if its not there
$value = rtrim($value, '/') . '/';
// Attempt to add the directory specified
if (!file_exists($value . 'temp')) {
// Make the directory with broad permissions recursively (so will add the whole path)
mkdir($value . 'temp', 0777, true);
}
if (!is_writable($value . 'temp')) {
trigger_error(__('The Library Location you have picked is not writable'), E_USER_ERROR);
}
}
$SQL = sprintf("UPDATE setting SET value = '%s' WHERE settingid = %d ", $db->escape_string($value), $id);
if (!$db->query($SQL)) {
trigger_error($db->error());
trigger_error(__('Update of settings failed.'), E_USER_ERROR);
}
}
$response = new ResponseManager();
$response->SetFormSubmitResponse(__('Settings Updated'), false);
$response->Respond();
}
示例4: setPasswordAction
public function setPasswordAction()
{
$data = ['password' => $this->input->post('newPassword'), 'user_id' => $this->input->post('user_id'), 'access_token' => $this->input->post('access_token')];
if ($data['password']) {
$ret = $this->users_model->setPassword($data);
if (isset($ret['id'])) {
setMessage('Password changed successfully', 'success');
redirect(base_url('Logout'));
} else {
setMessage('Something goes wrong while changind password', 'error');
redirect(base_url('Logout'));
}
}
}
示例5: doQuery
function doQuery()
{
global $sql;
global $link;
global $SiteErrorMessage;
global $NextURL;
//echo "$sql<br>";
if ($link->query($sql)) {
// good, send back to NextURL
$NextURL = "AdminActionPage.php";
header("Location: {$NextURL}");
} else {
// Error
setMessage($SiteErrorMessage, "AdminActionPage.php");
}
}
示例6: pertingkat
function pertingkat()
{
$this->form_validation->set_rules('isisms', 'Isi SMS', 'required');
if ($this->form_validation->run() === FALSE) {
$this->data['kls'] = $this->sms->get_data_tingkat();
$this->LoadView('broadcastsms/pertingkat', $this->data);
} else {
if (isset($_POST['j_action']) && $_POST['j_action'] == 'add_param') {
$ret = $this->sms->get_nohp_by_tingkat($_POST['kelas']);
foreach ($ret->result() as $q) {
$f['DestinationNumber'] = $q->TELP;
$f['TextDecoded'] = $_POST['isisms'];
$this->db->insert('outbox', $f);
$this->data['msg'] = setMessage('insert', 'broadcastsms/pertingkat');
$this->LoadView('template/msg', $this->data);
}
}
}
}
示例7: data
function data($id = '')
{
$this->form_validation->set_rules('db_NIS', 'NIS', 'required|callback_cek_deposit');
if ($this->form_validation->run() === FALSE) {
$this->LoadView('voucher/form', $this->data);
} else {
if (isset($_POST['j_action']) and $_POST['j_action'] !== '') {
if ($_POST['j_action'] == 'add_param') {
$d = parseForm($_POST);
$d['TGLAWAL'] = date('Y-m-d');
$d['SISAPULSA'] = $_POST['db_PULSA'];
$this->db->insert('pulsa', $d);
$this->data['msg'] = setMessage('insert', 'voucher');
$this->LoadView('template/msg', $this->data);
}
} else {
redirect('voucher');
}
}
}
示例8: data
function data($id = '')
{
$this->form_validation->set_rules('db_tanggal', 'Tanggal', 'required');
$this->form_validation->set_rules('db_NIS', 'NIS', 'required');
if ($this->form_validation->run() === FALSE) {
$this->load->model('referensi_model', 'ref');
$this->data['ta'] = $this->ref->get_ta_aktif();
$this->data['sem'] = $this->ref->get_sem_aktif();
$this->LoadView('absensi/form', $this->data);
} else {
if (isset($_POST['j_action']) and $_POST['j_action'] !== '') {
if ($_POST['j_action'] == 'add_param') {
$d = parseForm($_POST);
$this->db->insert('absensi', $d);
$this->data['msg'] = setMessage('insert', 'absensi');
$this->LoadView('template/msg', $this->data);
}
} else {
redirect('absensi');
}
}
}
示例9: data
function data($id = '')
{
$this->load->model('referensi_model', 'ref');
$this->form_validation->set_rules('db_kelas', 'Kelas', 'required');
$this->form_validation->set_rules('db_walikls', 'Wali Kelas', 'required|callback_cek_walikelas');
if ($this->form_validation->run() === FALSE) {
$this->data['sem'] = $this->ref->get_sem_aktif();
$this->data['tahunajaran'] = $this->refkelas->get_tahun_ajaran();
$this->data['tingkat'] = array('0' => '-- Silakan Pilih --', '1' => '1', '2' => '2', '3' => '3');
$this->data['program'] = array('0' => '-- Silakan Pilih --', '-' => '-', 'IPA' => 'IPA', 'IPS' => 'IPS');
$this->LoadView('refkelas/form', $this->data);
} else {
if (isset($_POST['j_action']) and $_POST['j_action'] !== '') {
if ($_POST['j_action'] == 'add_param') {
$d = parseForm($_POST);
$this->db->insert('refkelas', $d);
$this->data['msg'] = setMessage('insert', 'refkelas');
$this->LoadView('template/msg', $this->data);
}
} else {
redirect('refkelas');
}
}
}
示例10: data
function data($id = '')
{
$this->form_validation->set_rules('db_TANGGAL', 'Tanggal', 'required');
$this->form_validation->set_rules('db_JAM', 'Waktu', 'required|callback_cek_jadwal');
if ($this->form_validation->run() === FALSE) {
$this->data['ta'] = $this->ref->get_ta_aktif();
$this->data['sem'] = $this->ref->get_sem_aktif();
$this->data['tingkat'] = array('0' => '-- Silakan Pilih --', '1' => 'I', '2' => 'II', '3' => 'III');
$this->data['hari'] = array('SENIN' => 'SENIN', 'SELASA' => 'SELASA', 'RABU' => 'RABU', 'KAMIS' => 'KAMIS', 'JUMAT' => 'JUMAT', 'SABTU' => 'SABTU', 'MINGGU' => 'MINGGU');
$this->LoadView('ujian/form', $this->data);
} else {
if (isset($_POST['j_action']) and $_POST['j_action'] !== '') {
if ($_POST['j_action'] == 'add_param') {
$d = parseForm($_POST);
$d['ALIASHARI'] = substr($_POST['db_HARI'], 0, 3);
$this->db->insert('ujian', $d);
$this->data['msg'] = setMessage('insert', 'ujian');
$this->LoadView('template/msg', $this->data);
}
} else {
redirect('ujian');
}
}
}
示例11: time
include 'connect2db.php';
include 'functions.php';
if ($isAdministrator == 1) {
if (isset($_REQUEST['ConfirmDelete'])) {
$ConfirmDelete = $link->real_escape_string(trim($_REQUEST['ConfirmDelete']));
}
$days = $link->real_escape_string(trim($_REQUEST['days']));
$thisMoment = time();
if (is_numeric($days) && $ConfirmDelete == "Confirmed") {
$timeDifference = $thisMoment - $days * 86400;
// 1 day in seconds is 86400.
$sql = "DELETE FROM `Sessions` WHERE `REQUEST_TIME` <= '{$timeDifference}'";
if ($link->query($sql)) {
// good, send back to usernameTracking.
$NextURL = "showSessions.php";
header("Location: {$NextURL}");
} else {
// Error
$link->close();
setMessage($SiteErrorMessage, "showSessions.php");
}
} else {
$link->close();
setMessage($invalidData, "showSessions.php");
}
} else {
//Not an admin, redirect to home.
$NextURL = "jane.php";
header("Location: {$NextURL}");
}
}
示例12: login
/**
* Login a user
* @return
* @param $username Object
* @param $password Object
*/
function login($username, $password)
{
$db =& $this->db;
Kit::ClassLoader('userdata');
// Get the SALT for this username
if (!($userInfo = $db->GetSingleRow(sprintf("SELECT UserID, UserName, UserPassword, UserTypeID, CSPRNG FROM `user` WHERE UserName = '%s'", $db->escape_string($username))))) {
setMessage(__('Username or Password incorrect'));
return false;
}
// User Data Object to check the password
$userData = new Userdata($db);
// Is SALT empty
if ($userInfo['CSPRNG'] == 0) {
// Check the password using a MD5
if ($userInfo['UserPassword'] != md5($password)) {
setMessage(__('Username or Password incorrect'));
return false;
}
// Now that we are validated, generate a new SALT and set the users password.
$userData->ChangePassword(Kit::ValidateParam($userInfo['UserID'], _INT), null, $password, $password, true);
} else {
// Check the users password using the random SALTED password
if ($userData->validate_password($password, $userInfo['UserPassword']) === false) {
setMessage(__('Username or Password incorrect'));
return false;
}
}
// there is a result so we store the userID in the session variable
$_SESSION['userid'] = Kit::ValidateParam($userInfo['UserID'], _INT);
$_SESSION['username'] = Kit::ValidateParam($userInfo['UserName'], _USERNAME);
$_SESSION['usertype'] = Kit::ValidateParam($userInfo['UserTypeID'], _INT);
// Set the User Object
$this->usertypeid = $_SESSION['usertype'];
$this->userid = $_SESSION['userid'];
// update the db
// write out to the db that the logged in user has accessed the page
$SQL = sprintf("UPDATE user SET lastaccessed = '" . date("Y-m-d H:i:s") . "', loggedin = 1 WHERE userid = %d", $_SESSION['userid']);
$db->query($SQL) or trigger_error(__('Can not write last accessed info.'), E_USER_ERROR);
// Switch Session ID's
global $session;
$session->setIsExpired(0);
$session->RegenerateSessionID(session_id());
return true;
}
示例13: setMessage
include 'vars.php';
include 'verifysession.php';
if ($SessionIsVerified == "1") {
include 'connect2db.php';
include 'functions.php';
if (isset($_REQUEST['Confirm']) && isset($_REQUEST['newUsername']) && isset($_REQUEST['oldUsername']) && isset($_REQUEST['trackingImportedID'])) {
$Confirm = $link->real_escape_string(trim($_REQUEST['Confirm']));
$newUsername = $link->real_escape_string(trim($_REQUEST['newUsername']));
$oldUsername = $link->real_escape_string(trim($_REQUEST['oldUsername']));
$trackingImportedID = $link->real_escape_string(trim($_REQUEST['trackingImportedID']));
} else {
$link->close();
setMessage($incomplete, "usernameTracking.php");
}
if ($Confirm == "Confirmed") {
$sql = "UPDATE `usernameTracking` SET `trackingUserName`='{$newUsername}',`trackingIsAbnormal`='1' WHERE `trackingImportedID` = '{$trackingImportedID}' AND `trackingUserName` = '{$oldUsername}'";
if ($link->query($sql)) {
// good, send back to usernameTracking.
$NextURL = "usernameTracking.php";
header("Location: {$NextURL}");
} else {
// Error
$link->close();
setMessage($SiteErrorMessage, "usernameTracking.php");
}
} else {
$link->close();
setMessage($incomplete, "usernameTracking.php");
}
}
示例14: unset
unset($OldSMBPassword);
}
if ($NewSMBPassword == "") {
unset($NewSMBPassword);
}
if (!isset($StoredSMBPassword, $OldSMBPassword, $NewSMBPassword)) {
setMessage($incomplete, "ChangeSMBPasswordPage.php");
}
if ($StoredSMBPassword == $OldSMBPassword) {
$sql = "UPDATE `janeUsers` SET `JaneSMBPassword` = '{$NewSMBPassword}' WHERE `JaneUserID` = {$JaneUserID}";
if ($link->query($sql)) {
// good, send back to jane.php
$NextURL = "jane.php";
header("Location: {$NextURL}");
} else {
// Error
$link->close();
setMessage($SiteErrorMessage, "ChangeSMBPasswordPage.php");
}
} else {
//Mistyped password.
$link->close();
setMessage($BadLoginError, "ChangeSMBPasswordPage.php");
}
} else {
setMessage($incomplete, "ChangeSMBPasswordPage.php");
}
} else {
$NextURL = "login.php";
header("Location: {$NextURL}");
}
示例15: forgotten
function forgotten()
{
//Called by a submit to the Forgotten Details form
// Checks the validity of the data provided, and emails a new password to the user
$db =& $this->db;
$username = Kit::GetParam('f_username', _POST, _USERNAME);
$email = Kit::GetParam('f_email', _POST, _STRING);
$return = "index.php";
if ($username == "" || $email == "") {
setMessage("Username and Email address need to be filled in");
return $return;
}
//send the email
$from = Config::GetSetting("mail_from");
if ($from == "") {
setMessage("Email is not set up, please contact your IT manager");
return $return;
}
//check the user details
$SQL = sprintf("SELECT userid FROM user WHERE username = '%s' AND email = '%s'", $db->escape_string($username), $db->escape_string($email));
if (!($results = $db->query($SQL))) {
trigger_error($db->error);
trigger_error("Can not get the user information", E_USER_ERROR);
}
if ($db->num_rows($results) < 0 || $db->num_rows($results) > 1) {
setMessage("The details you entered are incorrect.");
return $return;
}
$row = $db->get_row($results);
$userid = Kit::ValidateParam($row[0], _INT);
//user ID for the user that wants a new password
$password_plain = $this->random_word(8);
//generate a new password
$password = md5($password_plain);
//update the password
$SQL = sprintf("UPDATE user SET UserPassword = '%s' WHERE userid = %d", $db->escape_string($password), $userid);
if (!$db->query($SQL)) {
trigger_error($db->error());
trigger_error("Unable to send new password", E_USER_ERROR);
}
$headers = "From: {$from}" . "\r\n" . "Reply-To: {$from}" . "\r\n" . "X-Mailer: PHP/" . phpversion();
if (!@mail($email, "Xibo: New Password request for {$username}", "Your new password is {$password_plain} \n . You may now login with these details.", $headers)) {
setMessage("Email is not set up, please contact your IT manager");
return $return;
}
setMessage("New Password Sent to your email address");
return $return;
}