本文整理汇总了PHP中Success函数的典型用法代码示例。如果您正苦于以下问题:PHP Success函数的具体用法?PHP Success怎么用?PHP Success使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Success函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OptimizeTable
function OptimizeTable($Token, $Table = null)
{
$total = 0;
if (($mundane_id = Ork3::$Lib->authorization->IsAuthorized($Token)) > 0 && Ork3::$Lib->authorization->HasAuthority($mundane_id, AUTH_ADMIN, 0, AUTH_CREATE)) {
if (is_null($Table)) {
$tables = $this->db->query('show tables');
$t = 'Tables_in_' . DB_DATABASE;
do {
set_time_limit(60 * 60);
$this->db->query('optimize table "' . $tables->{$t} . '"');
$total++;
} while ($tables->next());
} else {
if (is_array($Table) && count($Table > 0)) {
foreach ($Table as $k => $t) {
set_time_limit(60 * 60);
$this->db->query('optimize table "' . $t . '"');
$total++;
}
}
}
return Success($total);
}
return NoAuthorization();
}
示例2: save
public function save()
{
$aid = $this->admin['aid'];
$password = ForceStringFrom('password');
$passwordconfirm = ForceStringFrom('passwordconfirm');
$email = ForceStringFrom('email');
$fullname = ForceStringFrom('fullname');
$fullname_en = ForceStringFrom('fullname_en');
if (strlen($password) or strlen($passwordconfirm)) {
if (strcmp($password, $passwordconfirm)) {
$errors[] = '两次输入的密码不相同!';
}
}
if (!$email) {
$errors[] = '请输入Email地址!';
} elseif (!IsEmail($email)) {
$errors[] = 'Email地址不规范!';
} elseif (APP::$DB->getOne("SELECT aid FROM " . TABLE_PREFIX . "admin WHERE email = '{$email}' AND aid != '{$aid}'")) {
$errors[] = 'Email地址已占用!';
}
if (!$fullname) {
$errors[] = '请输入中文昵称!';
}
if (!$fullname_en) {
$errors[] = '请输入英文昵称!';
}
if (isset($errors)) {
Error($errors, '编辑我的信息错误');
} else {
APP::$DB->exe("UPDATE " . TABLE_PREFIX . "admin SET \r\n\t\t\t" . Iif($password, "password = '" . md5($password) . "',") . "\r\n\t\t\temail = '{$email}',\r\n\t\t\tfullname = '{$fullname}',\r\n\t\t\tfullname_en = '{$fullname_en}'\r\n\t\t\tWHERE aid = '{$aid}'");
Success('myprofile');
}
}
示例3: Attempt
/**
* @param callable $hof
* @return Success|Failure
*/
function Attempt(callable $hof)
{
try {
return Success(call_user_func($hof));
} catch (\Exception $e) {
return Failure($e);
}
}
示例4: updatemessages
public function updatemessages()
{
$page = ForceIntFrom('p', 1);
//页码
$deletemids = $_POST['deletemids'];
for ($i = 0; $i < count($deletemids); $i++) {
$mid = ForceInt($deletemids[$i]);
APP::$DB->exe("DELETE FROM " . TABLE_PREFIX . "msg WHERE mid = '{$mid}'");
}
Success('messages?p=' . $page);
}
示例5: updateguests
public function updateguests()
{
$page = ForceIntFrom('p', 1);
//页码
$deletegids = $_POST['deletegids'];
for ($i = 0; $i < count($deletegids); $i++) {
$gid = ForceInt($deletegids[$i]);
$this->DeleteGuest($gid);
//批量删除客人及对话记录
}
Success('guests?p=' . $page);
}
示例6: CreateGame
public function CreateGame($request)
{
if (($mundane_id = Ork3::$Lib->authorization->IsAuthorized($request['Token'])) > 0) {
switch ($request['Type']) {
case 'flag-capture':
return Success($this->create_flag_capture($request['Name'], $mundane_id, $request['Configuration']));
break;
default:
return Success($this->create_game($request['Name'], 'custom', $mundane_id, $request['Configuration'], array()));
break;
}
} else {
return NoAuthorization();
}
}
示例7: restore
public function restore()
{
$filename = ForceStringFrom('file');
$fp = openFileRead($this->backupDir . $filename);
while (!eof($fp)) {
$query .= readFileData($fp, 10000);
}
closeFile($fp);
$queries = ParseQueries($query, ';');
for ($i = 0; $i < count($queries); $i++) {
$sql = trim($queries[$i]);
if (!empty($sql)) {
APP::$DB->query($sql);
}
}
Success('database');
}
示例8: RemoveLastDuesPaid
public function RemoveLastDuesPaid($request)
{
logtrace('RemoveLastDuesPaid', $request);
if (($player = Ork3::$Lib->player->player_info($request['MundaneId'])) === false) {
return InvalidParameter('Player could not be found.');
}
logtrace('Found Player', $request);
if (($mundane_id = Ork3::$Lib->authorization->IsAuthorized($request['Token'])) > 0 && Ork3::$Lib->authorization->HasAuthority($mundane_id, AUTH_PARK, $player['ParkId'], AUTH_EDIT)) {
$sql = "select \n\t\t\t s.transaction_id \n\t\t\t from " . DB_PREFIX . "split s \n\t\t\t left join " . DB_PREFIX . "transaction t on s.transaction_id = t.transaction_id\n\t\t\t where \n\t\t\t src_mundane_id = '" . mysql_real_escape_string($request['MundaneId']) . "' and is_dues = 1 order by t.date_created desc limit 1";
logtrace('Passed Security', $sql);
$lastdues = $this->db->query($sql);
if ($lastdues != false && $lastdues->size() == 1) {
$this->remove_transaction($lastdues->transaction_id);
return Success('Transaction ' . $lastdues->transaction_id . ' removed.');
}
}
return NoAuthorization('You lack authoratah.');
}
示例9: updatecomments
public function updatecomments()
{
$page = ForceIntFrom('p', 1);
//页码
if (IsPost('updatecomms')) {
$updatecids = $_POST['updatecids'];
for ($i = 0; $i < count($updatecids); $i++) {
$cid = ForceInt($updatecids[$i]);
APP::$DB->exe("UPDATE " . TABLE_PREFIX . "comment SET readed = 1 WHERE cid = '{$cid}'");
}
} else {
$deletecids = $_POST['deletecids'];
for ($i = 0; $i < count($deletecids); $i++) {
$cid = ForceInt($deletecids[$i]);
APP::$DB->exe("DELETE FROM " . TABLE_PREFIX . "comment WHERE cid = '{$cid}'");
}
}
Success('comments?p=' . $page);
}
示例10: updatephrases
public function updatephrases()
{
$page = ForceIntFrom('p', 1);
//页码
if (IsPost('updatephrases')) {
$pids = $_POST['pids'];
$sorts = $_POST['sorts'];
$activateds = $_POST['activateds'];
$msgs = $_POST['msgs'];
$msg_ens = $_POST['msg_ens'];
for ($i = 0; $i < count($pids); $i++) {
$pid = ForceInt($pids[$i]);
APP::$DB->exe("UPDATE " . TABLE_PREFIX . "phrase SET sort = '" . ForceInt($sorts[$i]) . "',\n\t\t\t\t\tactivated = '" . ForceInt($activateds[$i]) . "',\n\t\t\t\t\tmsg = '" . ForceString($msgs[$i]) . "',\n\t\t\t\t\tmsg_en = '" . ForceString($msg_ens[$i]) . "'\t\t\t\t\t\n\t\t\t\t\tWHERE pid = '{$pid}'");
}
} else {
$deletepids = $_POST['deletepids'];
for ($i = 0; $i < count($deletepids); $i++) {
$pid = ForceInt($deletepids[$i]);
APP::$DB->exe("DELETE FROM " . TABLE_PREFIX . "phrase WHERE pid = '{$pid}'");
}
}
Success('phrases?p=' . $page);
}
示例11: AssistedLDAPModify
$in2['uidNumber'] = $in['uidNumber'];
// Incrementing maxUID entry
$mod = AssistedLDAPModify($ldapc, $moddn, $in2);
}
// If the modification went OK, we send the notification e-mail to the user
if ($mod) {
$send = AssistedEMail("NewUserDo", $mail);
}
// If the mailing went OK ...
if ($send) {
// We need to get rid of the temporary entry
$del_q = sprintf("DELETE FROM NewUser" . " WHERE uid='%s'" . " AND token='%s'", mysql_real_escape_string($uid), mysql_real_escape_string($token));
// Deleting the row from the table ...
$del_r = AssistedMYSQLQuery($del_q);
// We log the event
WriteLog("NewUserDo");
// Print the good news to the user
Success("NewUserDo");
} else {
// We fail nicely, at least
Fail("NewUserDo");
}
}
}
}
}
// Closing the connection
$ldapx = AssistedLDAPClose($ldapc);
// Closing the connection
$mysqlx = AssistedMYSQLClose($mysqlc);
require_once "./themes/{$app_theme}/footer.php";
示例12: AddParticipant
public function AddParticipant($request)
{
if (!$this->check_auth($request)) {
return NoAuthorization();
}
if (valid_id($request['ParticipantId'])) {
$sql = "insert into " . DB_PREFIX . "participant (tournament_id, bracket_id, alias, mundane_id, unit_id, park_id, kingdom_id, team_id) \n\t\t\t\t\t\tselect tournament_id, " . mysql_real_escape_string($request['BracketId']) . ", alias, mundane_id, unit_id, park_id, kingdom_id, team_id from " . DB_PREFIX . "participant where participant_id = '" . mysql_real_escape_string($request['ParticipantId']) . "'";
$this->db->query($sql);
return Success($this->db->getInsertId());
} else {
$this->Participant->clear();
$this->Participant->tournament_id = $request['TournamentId'];
$this->Participant->bracket_id = $request['BracketId'];
$this->Participant->alias = $request['Alias'];
$this->Participant->unit_id = $request['UnitId'];
$this->Participant->park_id = $request['ParkId'];
$this->Participant->kingdom_id = $request['KingdomId'];
$this->Participant->team_id = $request['TeamId'];
$this->Participant->save();
if (!valid_id($request['MundaneId'])) {
foreach ($request['Members'] as $k => $member) {
$this->Player->clear();
$this->Player->participant_id = $this->Participant->participant_id;
$this->Player->mundane_id = $member['MundaneId'];
$this->Player->tournament_id = $member['TournamentId'];
$this->Player->bracket_id = $member['BracketId'];
$this->Player->save();
}
}
return Success($this->Participant->participant_id);
}
}
示例13: personal_
public function personal_()
{
eval(USER);
try {
$data = $_POST;
unset($data['__hash__']);
$root = C('ROOT');
if (isset($_FILES["picture"])) {
$upload = uploadImage();
if (!is_string($upload)) {
$data['picture'] = $root . $upload[0]["savepath"] . $upload[0]["savename"];
}
if ($data["picture"] == $root) {
unset($data["picture"]);
}
}
DBModel::updateDB('cernet_user', array('username' => session('username')), $data);
$this->success(Success('modify'), '__ROOT__/User/personal');
} catch (Exception $e) {
throw_exception($e->getMessage());
}
}
示例14: NextYear
public function NextYear($request)
{
$sql = "select event.event_id, event.name, detail.event_start, detail.event_end, detail.url, detail.description from " . DB_PREFIX . "event event left join " . DB_PREFIX . "event_calendardetail detail on detail.event_id = event.event_id where event_start >= '" . mysql_real_escape_string($request['Date']) . "' and event_end <= date_add('" . mysql_real_escape_string($request['Date']) . "', interval 1 year)";
return array('Status' => Success(), 'Dates' => array_merge($this->_make_calendar_set($sql), $this->_park_days(strtotime($request['Date']), 'year')));
}
示例15: sp_UpdateRankPower
}
}
}
if (!$fail) {
if (!$rankFail) {
//Update Old Ranks
for ($i = 0; $i < $anotherOldCount; $i++) {
global $oldRankIds, $oldRankNewPower;
$sql = "Call sp_UpdateRankPower(" . $oldRankIds[$i] . ", " . $oldRankNewPower[$i] . ")";
$result = mysql_query($sql, $conn) or die(mysql_error());
}
//Add New Ranks
for ($i = 0; $i < $newRankCount; $i++) {
$sql = "Call sp_AddNewRank('" . $newRankNames[$i] . "', " . $newRankPower[$i] . ")";
$result = mysql_query($sql, $conn) or die(mysql_error());
}
} else {
Fail("You cannot Create or Edit the Rank of a Rank with higher or Equal Power as yourself");
}
Success();
} else {
Fail("Bad Data");
}
function Fail($error)
{
header('Location: ./TDSInError.php?Error=' . $error . '');
}
function Success()
{
header('Location: ./TDSInAdminTools.php');
}