本文整理汇总了PHP中setNotification函数的典型用法代码示例。如果您正苦于以下问题:PHP setNotification函数的具体用法?PHP setNotification怎么用?PHP setNotification使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setNotification函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: logout
public static function logout()
{
setNotification("You've been successfully logged out.'");
$_SESSION["username"] = null;
$_SESSION["name"] = null;
redirect("../index.php");
}
示例2: getNotification
function getNotification()
{
if (isset($_GET["notification"])) {
setNotification($_GET["notification"]);
}
if (notificationIsSet()) {
echo "<div id='response'>" . $_SESSION["response"] . "</div>";
}
echo "<script>\$('#response').slideDown();</script>";
$_SESSION["response"] = null;
}
示例3: forgot
public function forgot()
{
$this->load->library('email');
$this->email->from('info@my_property.com', 'My Property');
$this->email->to('admin@my_property.com');
// $this->email->cc('another@another-example.com');
// $this->email->bcc('them@their-example.com');
$this->email->subject('Password Recovery');
$this->email->message('Your new password is "123456". Kindly change your password from tools to more secure password.');
// $this->email->send();
setNotification('success', 'Check your inbox.');
redirect(base_url('admin/login'));
}
示例4: index
public function index()
{
if ($this->input->post('submit')) {
$result = $this->login_model->validate();
if (!$result) {
setNotification('danger', 'Invalid User name or Password.');
redirect(base_url('login'));
} else {
redirect(base_url('admin/dashboard'));
}
}
$data = array();
$this->render('login', $data);
}
示例5: index
public function index()
{
if ($this->input->post('submit')) {
try {
$result = $this->misc_model->register();
if ($result) {
$this->uploadImage('user/' . $result, 'profile_pic');
setNotification('success', 'Your account created sucessfully.');
redirect(base_url('welcome'));
}
} catch (Exception $e) {
setNotification('danger', 'Error. Coudn\'t register. Try later.');
}
}
$data = array();
$data['cities'] = $this->misc_model->getCities(1);
// country_id
$this->render('register', $data);
}
示例6: uploadImage
protected function uploadImage($Path, $FileName)
{
$config['upload_path'] = $_SERVER['DOCUMENT_ROOT'] . '/property/public/uploads/' . $Path;
$config['allowed_types'] = 'gif|jpg|jpeg|png';
// $config['max_size'] = 100;
// $config['max_width'] = 1024;
// $config['max_height'] = 768;
$config['overwrite'] = TRUE;
if (!file_exists($config['upload_path']) && !is_dir($config['upload_path'])) {
mkdir($config['upload_path'], 0777, TRUE);
}
$this->load->library('upload', $config);
$this->upload->initialize($config);
if (!$this->upload->do_upload($FileName)) {
$error = $this->upload->display_errors();
setNotification('danger', 'Error. File not uploaded.');
return false;
}
return true;
}
示例7: send
public static function send($message)
{
$usernames = array();
if (User::isNotAlone()) {
//get a random username
$receiver = User::getRandomUser();
global $link;
//send message
$sql = "INSERT INTO messages(message, sender, receiver) " . "VALUES(:message, :username, :receiver);";
$statement = $link->prepare($sql);
$statement->bindParam(":message", $message, PDO::PARAM_STR);
$statement->bindParam(":username", $_SESSION["username"], PDO::PARAM_STR);
$statement->bindParam(":receiver", $receiver, PDO::PARAM_STR);
$statement->execute();
$statement->closeCursor();
//remove bottle
if (!User::isInfinite()) {
User::removeBottle();
}
} else {
setNotification("There are no other accounts :(<br/>You are alone..");
}
}
示例8: sprintf
if ($statusOld != $status) {
$action = "";
if ($status == "Requested") {
$action = "Request";
} else {
if ($status == "Approved") {
$action = "Approval - Exempt";
//Notify original creator that it is approved
$notificationText = sprintf(_('Your expense request for "%1$s" in budget "%2$s" has been fully approved.'), $row["title"], $row["budget"]);
setNotification($connection2, $guid, $row["gibbonPersonIDCreator"], $notificationText, "Finance", "/index.php?q=/modules/Finance/expenses_manage_view.php&gibbonFinanceExpenseID={$gibbonFinanceExpenseID}&gibbonFinanceBudgetCycleID={$gibbonFinanceBudgetCycleID}&status=&gibbonFinanceBudgetID=" . $row["gibbonFinanceBudgetID"]);
} else {
if ($status == "Rejected") {
$action = "Rejection";
//Notify original creator that it is rejected
$notificationText = sprintf(_('Your expense request for "%1$s" in budget "%2$s" has been rejected.'), $row["title"], $row["budget"]);
setNotification($connection2, $guid, $row["gibbonPersonIDCreator"], $notificationText, "Finance", "/index.php?q=/modules/Finance/expenses_manage_view.php&gibbonFinanceExpenseID={$gibbonFinanceExpenseID}&gibbonFinanceBudgetCycleID={$gibbonFinanceBudgetCycleID}&status=&gibbonFinanceBudgetID=" . $row["gibbonFinanceBudgetID"]);
} else {
if ($status == "Ordered") {
$action = "Order";
} else {
if ($status == "Paid") {
$action = "Payment";
} else {
if ($status == "Cancelled") {
$action = "Cancellation";
}
}
}
}
}
}
示例9: sprintf
if ($row["gibbonPersonIDTutor2"] != "") {
$ids[$countInner][0] = $row["gibbonRollGroupID"];
$ids[$countInner][1] = $row["gibbonPersonIDTutor2"];
$countInner++;
}
if ($row["gibbonPersonIDTutor3"] != "") {
$ids[$countInner][0] = $row["gibbonRollGroupID"];
$ids[$countInner][1] = $row["gibbonPersonIDTutor3"];
$countInner++;
}
}
}
}
if (isset($count)) {
if ($count == 0) {
$report = sprintf(_('All form groups have been registered today (%1$s).'), dateConvertBack($guid, $currentDate));
} else {
$report = sprintf(_('%1$s form groups have not been registered today (%2$s).'), $count, dateConvertBack($guid, $currentDate)) . "<br/><br/>" . $reportInner;
}
}
print $report;
//Notify non-completing tutors
foreach ($ids as $id) {
$notificationText = _('You have not taken attendance yet today. Please do so as soon as possible.');
setNotification($connection2, $guid, $id[1], $notificationText, "Attendance", "/index.php?q=/modules/Attendance/attendance_take_byRollGroup.php&gibbonRollGroupID=" . $id[0] . "¤tDate=" . dateConvertBack($guid, date('Y-m-d')));
}
//Notify admin {
$notificationText = _('An Attendance CLI script has run.') . " " . $report;
setNotification($connection2, $guid, $_SESSION[$guid]["organisationAdministrator"], $notificationText, "Attendance", "/index.php?q=/modules/Attendance/report_rollGroupsNotRegistered_byDate.php");
}
}
示例10: putenv
if ($_SESSION[$guid]["i18n"]["code"] != NULL) {
putenv("LC_ALL=" . $_SESSION[$guid]["i18n"]["code"]);
setlocale(LC_ALL, $_SESSION[$guid]["i18n"]["code"]);
bindtextdomain("gibbon", getcwd() . "/../i18n");
textdomain("gibbon");
}
}
//Set timezone from session variable
date_default_timezone_set($_SESSION[$guid]["timezone"]);
//Check for CLI, so this cannot be run through browser
//if (php_sapi_name()!="cli") {
// print _("This script cannot be run from a browser, only via CLI.") . "\n\n" ;
//}
//else {
//SCAN THROUGH ALL OVERDUE LOANS
$today = date("Y-m-d");
try {
$data = array("today" => $today);
$sql = "SELECT gibbonLibraryItem.*, surname, preferredName, email FROM gibbonLibraryItem JOIN gibbonPerson ON (gibbonLibraryItem.gibbonPersonIDStatusResponsible=gibbonPerson.gibbonPersonID) WHERE gibbonLibraryItem.status='On Loan' AND borrowable='Y' AND returnExpected<:today AND gibbonPerson.status='Full' ORDER BY surname, preferredName";
$result = $connection2->prepare($sql);
$result->execute($data);
} catch (PDOException $e) {
}
if ($result->rowCount() > 0) {
while ($row = $result->fetch()) {
//For every student
$notificationText = sprintf(_('You have an overdue loan item that needs to be returned (%1$s).'), $row["name"]);
setNotification($connection2, $guid, $row["gibbonPersonIDStatusResponsible"], $notificationText, "Library", "/index.php?q=/modules/Library/library_browse.php&gibbonLibraryItemID=" . $row["gibbonLibraryItemID"]);
}
}
//}
示例11: catch
$sql = "INSERT INTO gibbonPerson SET surname=:surname, firstName=:firstName, preferredName=:preferredName, officialName=:officialName, gender=:gender, dob=:dob, email=:email, username=:username, password='', passwordStrong=:passwordStrong, passwordStrongSalt=:passwordStrongSalt, status=:status, gibbonRoleIDPrimary=:gibbonRoleIDPrimary, gibbonRoleIDAll=:gibbonRoleIDAll";
$result = $connection2->prepare($sql);
$result->execute($data);
} catch (PDOException $e) {
//Fail 2
print $e->getMessage();
exit;
$URL .= "&addReturn=fail2";
header("Location: {$URL}");
break;
}
$gibbonPersonID = $connection2->lastInsertId();
if ($status == "Pending Approval") {
//Attempt to notify Admissions
if ($_SESSION[$guid]["organisationAdmissions"]) {
$notificationText = sprintf(_('An new public registration, for %1$s, is pending approval.'), formatName("", $preferredName, $surname, "Student"));
setNotification($connection2, $guid, $_SESSION[$guid]["organisationAdmissions"], $notificationText, "User Admin", "/index.php?q=/modules/User Admin/user_manage_edit.php&gibbonPersonID={$gibbonPersonID}&search=");
}
//Success 1
$URL .= "&addReturn=success1";
header("Location: {$URL}");
} else {
//Success 0
$URL .= "&addReturn=success0";
header("Location: {$URL}");
}
}
}
}
}
}
示例12: session_start
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
session_start();
date_default_timezone_set('Asia/Tokyo');
function setNotification($message, $user_id)
{
try {
$dbh = new PDO('mysql:host=mysql488.db.sakura.ne.jp;dbname=meganeshibu_db;charset=utf8', 'meganeshibu', 'DBmaster777', array(PDO::ATTR_EMULATE_PREPARES => false));
} catch (PDOException $e) {
exit('データベース接続失敗。' . $e->getMessage());
}
$registTime = new DateTime();
$sql = "insert into NotificationTable(UserID, NotificationInfo, RegistTime) values('" . $user_id . "',' " . $message . "',' " . $registTime->format('Y-m-d H:i:s') . "')";
$stmt = $dbh->query($sql);
$dbh = null;
}
if (filter_input(INPUT_POST, "message") != NULL) {
$message = filter_input(INPUT_POST, "message");
$id = $_SESSION["user_id"];
setNotification($message, $id);
}
示例13: delete
public function delete($PropertyID)
{
try {
$result = $this->property_model->delete($PropertyID);
if ($result) {
setNotification('success', 'Record deleted successfully');
redirect(base_url('admin/dashboard'));
// Pending: Get last state and redirect there...
}
} catch (Exception $e) {
setNotification('error', 'Error in deleting record');
redirect(base_url('admin/dashboard'));
// Pending: Get last state and redirect there...
}
}
示例14: setNotification
<?php
require 'load.php';
$entry = Entries::get($_GET['id']);
if (!$entry->success) {
setNotification('error', $entry->msg);
redirect('index.php');
}
$tpl = new Layout();
echo $tpl->entriesLayout($tpl->loadTemplate('post', array('post' => $entry->data)));
示例15: header
$URL .= "?loginReturn=fail1";
header("Location: {$URL}");
} else {
$row = $result->fetch();
//Check fail count, reject & alert if 3rd time
if ($row["failCount"] >= 3) {
try {
$dataSecure = array("lastFailIPAddress" => $_SERVER["REMOTE_ADDR"], "lastFailTimestamp" => date("Y-m-d H:i:s"), "failCount" => $row["failCount"] + 1, "username" => $username);
$sqlSecure = "UPDATE gibbonPerson SET lastFailIPAddress=:lastFailIPAddress, lastFailTimestamp=:lastFailTimestamp, failCount=:failCount WHERE (username=:username)";
$resultSecure = $connection2->prepare($sqlSecure);
$resultSecure->execute($dataSecure);
} catch (PDOException $e) {
}
if ($row["failCount"] == 3) {
$notificationText = sprintf(_('Someone failed to login to account "%1$s" 3 times in a row.'), $username);
setNotification($connection2, $guid, $_SESSION[$guid]["organisationAdministrator"], $notificationText, "System", "/index.php?q=/modules/User Admin/user_manage.php&search={$username}");
}
setLog($connection2, $_SESSION[$guid]["gibbonSchoolYearIDCurrent"], NULL, $row["gibbonPersonID"], "Login - Failed", array("username" => $username, "reason" => "Too many failed logins"), $_SERVER["REMOTE_ADDR"]);
$URL .= "?loginReturn=fail6";
header("Location: {$URL}");
} else {
$passwordTest = false;
//If strong password exists
$salt = $row["passwordStrongSalt"];
$passwordStrong = $row["passwordStrong"];
if ($passwordStrong != "" and $salt != "") {
if (hash("sha256", $row["passwordStrongSalt"] . $password) == $row["passwordStrong"]) {
$passwordTest = true;
}
} else {
if ($row["password"] != "") {